Hide

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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

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.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

All commands from sorted by
Terminal - All commands - 11,591 results
watch '/home/mm/bash/keypress.sh |/home/mm/bash/evento.sh'
2009-06-07 20:57:49
User: m33600
Functions: watch
-7

evento.sh needed for awk syntax

the aplay command makes a camera sound. It takes a picture of who looked at the display

#!/bin/bash

# evento.sh: deteta evento e fala

awk '{print}' | espeak -v pt -stdin

awk '/e/{print "emergencia"}' | espeak -v pt -stdin

aplay -q /home/mm/bash/camera.wav # -q inibe verbose do comand aplay

exit 0

dir /ad /s /b
vifind() { vi `find . -name "$1"` }
dd if=/dev/zero bs=1M | ssh somesite dd of=/dev/null
help
2009-09-10 00:43:31
User: suxer
-7

for bash commands don't use man use help

find . -name "-help" -exec mv {} help.txt \;
ps auxwww | grep outofcontrolprocess | awk '{print $9}' | xargs kill -9
<Ctrl+o>
2011-08-19 00:09:53
User: bugmenot
Tags: bash hotkey
-7

Type out the command and simply press to see the list of options for that command without having to type --help.

Shift ZZ
man ettercap
2010-01-29 14:28:38
User: Abiden
Functions: man
-7

A very interesting man page!

sort -u filename > newfilename
2009-04-16 20:00:34
User: deijmaster
Functions: sort
-7

For users looking to simplify management of large entries in files and directories, this command is the key to fun and simplicity. Using the power sort, only a couple of seconds are necessary to accomplish what would take minutes or hours in ?standard? client applications.

find . -name "*" -print0 | xargs -0 -I {} chmod 777 {}
2010-10-11 19:05:41
User: aardvark4
Functions: chmod find xargs
-7

This will handle the case that the filename has spaces or other characters that need to be escaped.

tail -n 4 | head -n 1
2010-07-08 19:50:06
User: puddy
Functions: head tail
-7

tail -n X | head -n 1

prints a specific line, where X is the line number

ls -lAhutr
2010-09-07 05:49:46
Functions: ls
-7

This is a simple command, but useful when you don't remember what episode need to see :D

killall -9 wineserver
lsb_release -a
2009-05-17 02:49:18
User: Vasudev
-7

Get the complete distro information from shell prompt like distributor ID,code name etc.

export HISTFILE=/dev/null && kill -9 $$
ls *.c | while read F; do gcc -Wall -o `echo $F | cut -d . -f 1 - ` $F; done
2009-08-28 13:01:56
User: pichinep
Functions: cut gcc ls read
-7

Compile *.c files with "gcc -Wall" in actual directory, using as output file the file name without extension.

sudo apt-get install preload
2009-02-13 19:34:57
User: danfernbanck
Functions: install sudo
-7

this application monitors the apps you use most often and load them into memory with their libraries and other dependencies.

So now, when you launch Firefox or Thunderbird or OpenOffice, the display is immediate as on Mac.

find . -type f -exec chmod 0644 {} \;
2009-02-18 14:36:39
User: osantana
Functions: chmod find
-7

WARNING! This command may set an invalid permission under your current directory.

This command will set the 0644 permissions to all files under your current directory. An alternative version of this command is: find ~/.ssh -type f -exec chmod 0600 {} \;

sudo -i; add-apt-repository ppa:webupd8team/sublime-text-2; apt-get update; apt-get install sublime-text-2
2011-03-16 23:57:41
User: xmonkey
Functions: install sudo
-7

This is the first version of the Sublime Text 2 packaging so there might be bugs.

doskey l=dir /OD $*
2009-02-15 00:29:23
User: VonC
-7

doskey is the Windows cmd.exe equivalent of the Unix alias. '$*' means 'all parameters'

This example is like alias l='ls -alrt': it will display files from oldest to newest, for one or more directories.

doskey /MACROS list macros defined for cmd.exe, like 'alias' list aliases defined for the current Unix shell.

perfmon.msc
2009-02-15 05:27:57
User: Williebee
-7

Starts the Performance Monitor console that monitors the system load. It will help to observe and test the system or parts of the system and also help to find any problems.

telnet fics.freechess.org 5000
/etc/init.d/cron restart && tail -100 /var/log/syslog
2010-05-05 09:56:30
User: root
Functions: tail
-7

Debian-specific but very useful as cron files are prone to very subtle gotchas