commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
This is a command template for achiving the following:
* loop over files --> find -name "" | while read file; do ...; done
* output progress --> echo -n .
* execute some command on each file and save output for later usage --> output=$()
* if command failed, open subshell and echo newline --> || (echo;...;...;)
* echo output of command --> echo "$output"
Perfect time for the rarely used sub shell.
Ummmm.. Saw that gem on some dead-head hippies VW bus at phish this summer.. It's actually one of my favorite ways of using bash, very clean. It shows what you can do with the cool advanced features like job control, redirection, combining commands that don't wait for each other, and the thing I like the most is the use of the ( ) to make this process heirarchy below, which comes in very handy when using fifos for adding optimization to your scripts or commands with similar acrobatics.
F UID PID PPID WCHAN RSS PSR CMD
1 gplovr 30667 1 wait 1324 1 -bash
0 gplovr 30672 30667 - 516 3 \_ sleep 3
1 gplovr 30669 1 wait 1324 1 -bash
0 gplovr 30673 30669 - 516 0 \_ sleep 5
1 gplovr 30671 1 wait 1324 1 -bash
0 gplovr 30674 30671 - 516 1 \_ sleep 7