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

Git Global search and replace
Find all the occurrences in the git repo of 'foo' and replace with 'bar'

mkdir & cd into it as single command
The biggest advantage of this over the functions is that it is portable.

BASH one-liner to get the current week number
Not as cool as the python example, but it still works.

Remove git branches that do not have a remote tracking branch anymore

ignore .DS_Store forever in GIT
With a couple of little commands, you?ll be able to ignore the .DS_Store files forever from your git repositories on mac! The following command will add the .gitignore file to the git configuration git config --global core.excludesfile ~/.gitignore then, the following, will add the .DS_Store to the list echo .DS_Store >> ~/.gitignore

Find the processes that are on the runqueue. Processes with a status of
Want to know why your load average is so high? Run this command to see what processes are on the run queue. Runnable processes have a status of "R", and commands waiting on I/O have a status of "D". On some older versions of Linux may require -emo instead of -eo. On Solaris: ps -aefL -o s -o user -o comm | egrep "^O|^R|COMMAND"

pid of manually selecting window

get xclip to own the clipboard contents
"Copying" things to the X clipboard doesn't normally create a copy. Rather the data to be 'copied' is referenced. This means that if the application that you 'copied' stuff from is closed, that data is lost. If the application that you 'copied' from is suspended with CTRL-Z, there could be some issues if you try to paste it into something. This command will create a copy of referenced data and have xclip be the provider of it, so you can then go ahead and close the app that contains the original information. Caveat: I'm not sure if this is binary-safe (though i would expect it to be), and don't know what would happen if you used it to clip a 20 meg gimp image. This technique becomes more convenient if you set it up as an action in a clipboard manager (eg klipper, parcellite). Some of these applets can take automatic action based on a variety of parameters, so you could probably just get it to always own the clipped data whenever data is clipped.

Remove all cached images for icons related to your profile
Run inside Command Prompt (cmd.exe) as admin. Note that you must close explorer.exe first, and even so some files will not be deleted, will say "Access is denied." To definitely delete them enter with another admin user or from other operating system and access the drive.

Speak & Spell-esque glitch sounds
The Speak & Spell's sound chip uses a compressed audio format called "linear predictive coding". This command will read random bytes and attempt to decompress them as if it were audio data compressed in this format, then play it. This results in a unique sound which is similar to a glitching Speak & Spell.


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: