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

Grep only files matching certain pattern (Advanced)

Find out current working directory of a process

Add a function you've defined to .bashrc
Example: To store the function addfunction after you have defined it: $ addfunction addfunction

Open Remote Desktop (RDP) from command line having a custom screen size
This example uses xfreerdp, which builds upon the development of rdesktop. This example usage will also send you the remote machine's sound.

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"

Find and copy scattered mp3 files into one directory
I used this command to recursively gather all mp3 files that were previously imported into their own directories (sorted by band name) in Songbird.

Encode a string using ROT47
This command will encode a string using the ROT47 cipher.

Number of .... indicate how far down to cd
Use dots to cd down directories instead of having to remember all of the pesky back slashes! Better yet, works on even and odd number of dots! Now, just estimate how far down you want to traverse.

kill all processes using a directory/file/etc
This command will kill all processes using a directory. It's quick and dirty. One may also use a -9 with kill in case regular kill doesn't work. This is useful if one needs to umount a directory.

Takes all file except file between !()
Go to tmp : cd /tmp; mkdir retmp; cd retmp Create 10 files : for i in {1..10}; do touch test$i; done Remove all files except test10 : rm !(test10)


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: