What's this?

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.

Get involved!

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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Commands by servermanaged from sorted by
Terminal - Commands by servermanaged - 56 results
ps -o comm,%mem,args -u www-data
mkdir dir; cd $_
2010-01-13 11:56:36
Functions: cd mkdir
_ expands to the last argument of the last command that was executed
watch vmstat -sSM
2009-12-04 22:35:45
Functions: vmstat watch

Monitor with watch command and vmstat, memory usage

2009-11-26 21:41:28
Functions: ftp

By putting ! in front of a command, we are able to run it from an ftp session.

cat > list -
2009-10-29 20:20:11
Functions: cat

Quick write some notes to a file with cat. Ctrl+C when you have finish.

nethogs -p eth0
2009-10-24 19:43:31

Nethogs is a useful tool for monitor bandwidth consumption by pid. Tested on Debian an CentOs

for i in $(netstat --inet -n|grep ESTA|awk '{print $5}'|cut -d: -f1);do geoiplookup $i;done
2009-10-18 20:41:47
Functions: awk cut grep netstat

Sample command to obtain a list of geographic localization for established connections, extracted from netstat. Need geoiplookup command ( part of geoip package under CentOS)

ls -alh #mycomment
2009-10-06 13:55:06
Functions: ls

Comments can be used directly on the command line so I can save in the history a brief description of what command does.

awk '{print(substr($0,1,5))}' file
2009-10-05 18:58:49
Functions: awk

Consider this file :




with awk

hello to


I can use awk substring to laminate words :







Similar to http://www.commandlinefu.com/commands/view/2000/laminate-files-line-by-line

hardinfo -am benchmark.so -f html > report.html
2009-10-05 17:41:25

Nicely display in html format a detailed report of the machine, including cpu benchmarks.

egrep 'Failed password for invalid' /var/log/secure | awk '{print $13}' | uniq
2009-10-04 18:08:13
Functions: awk egrep

Work for me on CentOS, grep and print ip addresses of ssh bruteforce attempts

ps ax -o "%p %U %u %x %c %n"
2009-07-14 17:21:59
Functions: ps

ps command gives the possibility to display information with custom formatting with the -o options followed by the format specifier list.

ruby -e " 3.times { system 'pdflatex mydoc.tex' } "
2009-07-05 09:55:59

When I make a latex document, I need to compile three times for generate an updated index of contents. With ruby on command line, I run this operation with a fast one liner.

cat /var/log/auth.log | logtool -o HTML > auth.html
2009-07-03 18:17:22
Functions: cat

Logtool is a nice tool that can export log file to various format, but its strength lies in the capacity of colorize logs. This command take a log as input and colorize it, then export it to an html file for a more confortable view. Logtool is part of logtool package.Tested on Debian.

vim -c new myfile
2009-07-03 17:54:43
Functions: vim

: new command allow to split a Vim screen in two separate windows. Each window can handle its own buffer.

Passing the -c new options when Vim start cause to split screen automatically.

nload -u m eth0
2009-07-03 17:47:38

Nload is part of nload package, tested under Debian. Nload display network bandwidth statistics, -u m options stands for MBit unit measure.

clamscan -ir --bell ~user/
2009-05-21 13:09:31

Scan for viruses, recursively and print only infected files, with bell sound. Clamscan is part of clamav package. Tested on Debian.

notifyme -C `cat /etc/passwd | cut -d: -f1`
2009-05-19 19:17:05
Functions: cut

Notifyme is a program that listen in background for users login, and report on login and logout. Users can be specified from a list or in a ~/notify.rc file. -C options force to display messages on the center of the screen.See man notifyme for more details. Part of notifyme package, tested on Debian.

2009-05-19 19:07:11

From man tiger : Tiger is a package consisting of Bourne Shell scripts, C code and data files which is used for checking for security problems on a UNIX system. It scans system configuration files, file systems, and user configuration files for possible security problems and reports them.

mytop --prompt
2009-05-19 19:04:57

mytop is a top like monitor for displaying Mysql server statistic and performance. Part of mytop package ,tested on Debian.

kudzu -p
2009-05-12 10:34:59
Functions: kudzu

Kudzu is available on CentOS, used for configuring and detecting new hardware device installed, is also usefull for device listing.

perl -lane 'print "$F[0]:$F[1]:$F[2]"' myfile
2009-05-09 21:30:55
Functions: perl

Consider this line :

random perl language this make possible is

is possible to rearrange words with $F perl variable and word index, starting from 0.

2009-05-09 20:33:27

wmwave is part of wmwave package, when launched display a small wireless link monitor on your desktop with noise, level and link power.

setfont cybercafe
2009-05-09 20:08:47

setfont load vga console font. The default font directory is usually in /lib/kbd/consolefonts. Setfont is part of kbd package. Tested on CentOS.

ethstatus -i eth0
2009-05-09 19:33:39

ethstatus part of ethstatus package, is a consolle based monitor for network interfaces. Nicely display on screen a real time summary about bandwidth, speed and packets.