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:
After you execute a command (or shell script) in the background using
&, if you logout from the session, the command will get killed. To avoid
that, you should use nohup as shown below.
Convert long list of ' ' to a single space. Compress space and other characters.
Display the 1st field (employee name) from a colon delimited file
The following displays only the entries that are duplicates.
Uniq command is mostly used in combination with sort command, as
uniq removes duplicates only from a sorted file. i.e In order for uniq to
work, all the duplicate entries should be in the adjacent lines.
ls -al gives all files, sort +4n sorts by 5th field numerically
Sort using kth column using : delimiter
Translates first set into second set
Join command combines lines from two files based on a common field.
This will be very helpful when you are debugging shell scripts, where
you don?t want to display the echo statement and interested in only
looking at the error messages. Similarly use 2> to supress error messages
This pattern matches empty lines in the file and -c gives the count
Use shopt -s cdspell to correct the typos in the cd command
manage directory stack
switch to previous directory or toggle
Creates a directory and then cds into it directly
While logged into ssh, type ~s to see stats of ssh
Suspend ssh session
Sometimes it is necessary to view debug messages to troubleshoot any
SSH connection issues. pass -v (lowercase v) option to the ssh as shown
below to view the ssh debug messages.