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

Copy ssh keys to user@host to enable password-less ssh logins.
Alternative for machines without ssh-copy-id

tar+pbzip2 a dir

urldecoding with one pure BASH builtin
You can use ordinary printf to convert "%23%21%2fbin%2fbash" into "#!/bin/bash" with no external utilities, by using a little known printf feature -- the "%b" specifier converts shell escapes. Replace % with \x and printf will understand the urlencoded string. BASH's printf has an extension to set a variable directly, too. So you get to convert urlencoded strings from garble to plaintext in one step with no externals and no backticks.

Execute a command without saving it in the history
Yes, by correctly setting the HIST* variables you can make certain commands not saved in history. But that's complicated and easy to make a mistake. If you set HISTFILE= to blank, nothing in your current shell session will be saved in history. Although this is not a precise answer to the subject, but it's very simple.

Find inside files two different patterns in the same line and for matched files show number of matched lines
The option -print0 for find and -0 for grep help prevent issue with weird characters or spaces in filenames. Furthermore with xargs there is no limited number of arguments that find can throw.

Most used command

Gentoo: Get the size of all installed packets, sorted
On a Gentoo system, this command will tell you which packets you have installed and sort them by how much space they consume. Good for finding out space-hogs when tidying up disk space.

finding cr-lf files aka dos files with ^M characters
its useful to run dos2unix command later on them.

send file to remote machine and unzip using ssh
This version transfers gzipped data which is unzipped as it arrives at the remote host.

Change Random Wallpaper on Gnome 3
Change Random Wallpaper on Gnome 3


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: