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

Displays the current time using HTTP
This command will show the current GMT time using HTTP. This might be useful if you just want to know what's the current human-readable and accurate-enough time, without changing the system time, using a simple command that would work regardless of the availability of NTP. Note: To get a quicker and more accurate response, replace google.com with your local NTP server. Also can be used as an alternative to the "htpdate" program: http://www.commandlinefu.com/commands/view/668/set-your-computers-clock-using-http-and-htp-http-time-protocol-when-ntpsntp-is-not-available

View ~/.ssh/known_hosts key information
Will return the SSH server key information for each host you have in your ~/.ssh/known_hosts file, including key size, key fingerprint, key IP address or domain name, and key type.

Create a zip archive excluding all SVN folders

Emulate tail using awk.
This awk codes emulates tail. For efficiency it uses a circular array, which stores only N number of records. Using awk gives the flexibility of modifying the output as needed, for example adding the record number (NR) at the output and much more.

Speed up upgrades for a debian/ubuntu based system.
Please install aria2c before you try the above command. On ubuntu the command to install aria2c would be: $sudo aptitude install aria2

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Backup with versioning
Apart from an exact copy of your recent contents, also keep all earlier versions of files and folders that were modified or deleted. Inspired by EVACopy http://evacopy.sourceforge.net

find file/dir by excluding some unwanted dirs and filesystems
Consider using this cmd when: 1. You are planning to traverse a big directory. 2. There is a subdir you don't want find to decend to. (entirely ignore) 3. You don't want find to decend to any mounted filesystems under this dir. * The -xdev flag tells find do not go to other filesystems. * -path ./junk_dir -prune is the pattern to ignore ./junk_dir entirely. * The rest is the typical search and print. To ignore multiple subdirs, you can just iterate the pattern, e.g. find . -path ./junk1 -prune -o -path ./junk2 -prune ... If you do want to include other filesystems, then remove -xdev flag. If you want to search files, then change -type d to -type f.

Rename all files in a directory to the md5 hash

Files extension change
Changing a file extension to a new one for all files in a directory.


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: