All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands


Check These Out

Create a backup of file being edited while using vi
At the start of a vi session and *before* saving any changes use ":!cp % %-" to make a backup of the current file being edited. example: vi /data/some/long/path/file :!cp% %- creates /data/some/long/path/file-

execute a shell with netcat without -e
how to execute a shell on a server with a netcat binary which doesn't support -e option

Zip a directory on Mac OS X and ignore .DS_Store (metadata) directory
If you want to generate a cross-platform compatible zip file and ignore the Finder's hidden metadata directory

Force logout after 24 hours idle
Shell timeout variables (TMOUT) can be very liberal about what is classified as 'activity', like having an editor open. This command string will terminate the login shell for an user with more than a day's idle time.

Selecting a random file/folder of a folder
Also looks in subfolders

alias to close terminal with :q
Put this in your ~/.bashrc file (or the equivalent) If you use vim a lot, this alias will be immediately obvious. Your brain will thank you.

Completely wipe all data on your Synology NAS and reinstall DSM. (BE CAREFUL)

Auto download Ubuntu 10.04 LTS with super fast zsync
Need to have rc iso pre-downloaded before running command.

Display the standard deviation of a column of numbers with awk
This will calculate a running standard deviation in one pass and should never have the possibility for overflow that can happen with other implementations. I suppose there is a potential for underflow in the corner case where the deltas are small or the values themselves are small.

exclude a column with awk
Here's an awk alternative, for those lacking the version of cut with the --complement argument.


Stay in the loop…

Follow the Tweets.

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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

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: