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

Change the default editor for modifying the sudoers list.
On Ubuntu, the default editor for visudo is nano. To change the editor to something else (e.g., vi) use this command.

Find the package that installed a command

Check your hard drive for bad blocks (destructive)
WARNING!!! ALL DATA WILL BE LOST!!! This command should ONLY be run on drives that are meant to be wiped. Data destruction will result from running this command with the '-w' switch. You may run this command with the '-n' switch in place of '-w' if you want to retain all data on the drive, however, the test won't be as detailed, since the '-n' switch provides a non-destructive read-write mode only, whereas '-w' switch actually writes patterns while scanning for bad blocks.

vim easter egg
inside vim try: :help 42 to get the meaning of life, the universe and everything !

Capture video of a linux desktop
This will grab the image from desktop, starting with the upper-left corner at x=100, y=200 with a width and height of 1024?768.

Prints a file leaving out all blank lines and comment-only lines
Does not print any line that either: - is empty - contains only spaces or tabs - starts with # - starts with spaces/tabs followed by a #

clone a hard drive to a remote directory via ssh tunnel, and compressing the image

Replace duplicate files by hardlinks
This variation can handle file paths containing spaces.

Generate a binary file with all ones (0xff) in it
This is similar to how you would generate a file with all zeros $ dd if=/dev/zero of=allzeros bs=1024 count=2k

Quick notepad
Quick write some notes to a file with cat. Ctrl+C when you have finish.


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: