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

Reuse last parameter
Reuse the last parameter of the previous command line

Use vi commands to edit your command lines
If you spend all day editing in vi then switching your fingers to Emacs mode just for the command line can be difficult. Use set -o vi in your bash shell and enjoy the power of a real editor.

Install pip with Proxy
Installs pip packages defining a proxy

Quick searching with less
This command enables the user to append a search pattern on the command line when using less as the PAGER. This is especially convenient (as the example shows) in compressed files and when searching man pages (substituting the zcat command with man, however).

Suspend, background, and foreground a process
1. Start a process, such as 'top' command 2. # suspend process {ctrl-Z} 3. # background process bg 4. # list all backgrounded jobs jobs 5. # bring it back to foreground fg

Switch to a user with "nologin" shell
You need sudo privileges for this command. Replace username with actual username.

Retrieve a random command from the commandlinefu.com API
Can be integrated into your .bashrc if you like. You'll probably want to grep out my name.

locate bin, src, and man file for a command

Validate all XML files in the current directory and below
If everything validates, there's no output. Can be handy to run on a cron job set up to email output.

Archive a directory with datestamp on filename
A useful bash function: gztardir() { if [ $# -ne 1 ] ; then echo "incorrect arguments: should be gztardir " else tar zcvf "${1%/}-$(date +%Y%m%d-%H%M).tar.gz" "$1" fi }


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: