What’s the most useful Bash command you know?
スレッド
会話
返信先: さん
sudo !! really can’t be beat. It’ll run your last command as sudo.
Also love a good ls -la (lists what’s in your current directory plus information about each item).
16
3
169
Ctrl-l for a shortcut!
1
14
返信を表示
The preferred answer of cynics
1
9
返信を表示
cd
After that, probably echo, and then while.
And its kinky cousin, <().
1
9
返信を表示
Unless you meant Bash builtins!
1
返信を表示
Someone had to
2
2
返信を表示
返信先: さん, さん
| grep [search-item]
It helps to be able to easily filter stuff out of the results of another command.
9
返信先: さん
Not a command but “command substitution”. $() comes in handy a lot especially for one liners
1
1
Ooo, mind sharing an example?
2
返信を表示
"But it's not compatible with the classic Unix shell!"
"Exactly."
1
3
返信を表示
削除されたアカウントによるツイートです。詳細はこちら
What’s the -n add?
1
返信を表示
AKA "Ctrl+shift+r"
This is a reverse history search, and it's BALLER!!! No, srsly, it's a fucking life safer, it will literally save you more than a day of your life if you use Linux a lot.
5
返信先: さん
xargs, honestly. Being able to pipe data and use xargs in super creative ways is my favorite!
16
I don't even wanna... Does this dump the contents of every file to return?
1
1
返信を表示
haha look at Mr WordPress over here
30
A real favorite bash tip: functions can be like this:
foo() { ... }
but leaks variables and `cd` changes etc. unless you're super careful.
You can tighten this up by using a subshell:
foo() ( ... )
and now nothing inside the function leaks out.
3
2
43
返信を表示
I actually do use this pretty regularly when not being truly lazy and just press up a dozen times.
Go back to the directory you last ran cd in. 
返信先: さん
I use !$ all the time. It's the last field of the previous command...
sudo vi /complicated/path/to/file/somewhere
sudo chown apache:apache !$
4
81
Once I stumbled on ESC+. I gave up on !$
Instead of substitution on execute, it populates that last value immediately on the cli for editing.
3
3
55
返信を表示
返信先: さん
pushd/popd: manipulates the command line directory stack.
I find this much more useful than trying to cd around.
1
8
There's a directory stack?
1
返信を表示
返信を表示
Twitterを使ってみよう
今すぐ登録して、タイムラインをカスタマイズしましょう。
トレンド
いまどうしてる?
音楽
ライブ
EXO・CHENさんの誕生日
ニュース
42 分前
20日のNYダウ平均株価
東洋経済オンライン
昨日
小4で娘が不登校になった親が知った衝撃の事態
日本のトレンド
ジェラピケ
24,156件のツイート
日本のトレンド
バンタン
14,755件のツイート