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

Tweak system files without invoking a root shell
only for sudo-style systems. Use this construct instead of I/O re-directors ``>'' or ``>>'' because sudo only elevates the commands and *not* the re-directors. ***warning: remember that the `tee` command will clobber file contents unless it is given the ``-a'' argument Also, for extra security, the "left" command is still run unprivileged.

View the current number of free/used inodes in a file system
tune2fs also provides the same information . But the information does not give the current usage , it gives the information when the file system was last mounted. http://www.zaman4linux.in/2010/10/using-up-all-the-free-inodes.html

remove newlines from specific lines in a file using sed

Grep all non-ascii character in file
It will highlight non-ascii character in a file. those character can cause problem for some application parsing ascii file.

bash shell expansion
The expansion {,} in bash will repeat the given string once for each item seperated by commas. The given command will result in the following being run: cp /really/long/path/and/file/name /really/long/path/and/file/name-`date -I` These can be embedded as needed, ex: rm file{1,2,3{1,2,3}} would delete the files file1, file2, file31, file32, file32, and no other files.

run command on a group of nodes in parallel redirecting outputs
Do the same as pssh, just in shell syntax. Put your hosts in hostlist, one per line. Command outputs are gathered in output and error directories.

purge all packages marked with 'rc'
After you install/remove lots of packages, there are many packages marked with 'rc'. This script help you to purge these packages, it will save some spaces from your disk.

AWK command to extract log files between dates

To find the count of each open file on a system (that supports losf)

show hidden chars in vi


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: