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

A DESTRUCTIVE command to render a drive unbootable
Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

know the current running shell (the true)
Return the current shell. It is better than print $SHELL which can sometimes return a false value.

Get current Xorg resolution via xrandr
Not sure if it works the same on any shell.

add all files not under version control to repository
This should handle whitespaces well and will not get confused if your filenames have "?" in them

Selecting a random file/folder of a folder
Also looks in subfolders

Protect directory from an overzealous rm -rf *
Forces the -i flag on the rm command when using a wildcard delete.

list files recursively by size

Verify if ntpd is working properly
Used to verify if Network Time Protocol daemon is working properly.

disable caps lock
a quick one-line way to disable caps lock while running X.


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: