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

Backup your hard drive with dd
This will create an exact duplicate image of your hard drive that you can then restore by simply reversing the "if" & "of" locations. $ sudo dd if=/media/disk/backup/sda.backup of=/dev/sda Alternatively, you can use an SSH connection to do your backups: $dd if=/dev/sda | ssh user@ssh.server.com dd of=~/backup/sda.backup

Show the PATH, one directory per line (part 2)
Here is another way to show the path, one directory per line. The command `tr` translates the colon into the new line, taking input from the $PATH variable

find broken symbolic links
== remove broken links == find -L . -type l -exec rm -rf {} \; == how this work == "symbolic link; this is never true if the -L option or the -follow option is in effect, unless the symbolic link is broken. If you want to search for symbolic links when -L is in effect, use -xtype." -- manpage of find.

Limit the cpu usage of a process
Similar to `cpulimit`, although `prlimit` can be found shipped with recent util-linux. Example: limit CPU consumption to 10% for a math problem which ordinarily takes up 100% CPU: Before: $ bc -l

insert ip range using vim
fast method for insert ip range using vim

Compress blank lines

Remove all the files except abc in the directory
This is for zsh with extended globbing.

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"

Send test prints to networked printer.
This will send a test print job to a networked printer.

Generate list of words and their frequencies in a text file.


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: