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

clear the X clipboard
Clears your clipboard if xsel is installed on your machine. If your xsel is dumb, you can also use $xsel --clear --clipboard

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Edit 2 or more files in vim using vim -d
Is this not the same

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Piping Microphone Audio Over Netcat
Send microphone audio to another computer using netcat and arecord. Connect to the stream using "nc [other ip] 3333|aplay" You can set up two-way communication by piping audio the reverse direction on another port: Machine #1: $arecord -D hw:0,0 -f S16_LE -c2|nc -l 3333 &;nc -l 3334|aplay Machine #2: $$ip=[machine1_ip];arecord -D hw:0,0 -f S16_LE -c2|nc $ip 3334 &;nc $ip 3333|aplay

Rename files in batch

Do quick arithmetic on numbers from STDIN with any formatting using a perl one liner.
Good for summing the numbers embedded in text - a food journal entry for example with calories listed per food where you want the total calories. Use this to monitor and keep a total on anything that ouputs numbers.

Load your [git-controlled] working files into the vi arglist.
Branch name may be substituted, of course.

count and number lines of output, useful for counting number of matches
Write each FILE to standard output, with line numbers added. With no FILE, or when FILE is -, read standard input.

SED - Substitute string in next line
source: http://sed.sourceforge.net/sed1line.txt


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: