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 newline to space in a file just using echo
Changing newline to spaces using just echo

Get your commandlinefu points (upvotes - downvotes)
Like command #4845, prints score, number of entries, and average score.

Convert any sequence of spaces/tabs to single space/tab
Remove empty lines additionally: $ tr -s ' \t\n' 2.txt identical with: $ tr -s '[:space:]' 2.txt To "clean perfectly" a text or code file, You can combine this command with another one: $ while read l; do echo -e "$l"; done 2.txt (= remove all leading and trailing spaces or tabs from all lines of a text file)

Quickly graph a list of numbers
Useful when you've produced a large file of numbers, and want to quickly see the distribution. The value of y halfway along the x axis is the median. Simple! Just create the listOfNumbers.txt file with a number on each line to try it out.

Determine what version of bind is running on a dns server.
Due to the recent dynamic update vulnerability with bind, I was forced to dig a little deeper into dig...

live ssh network throughput test
connects to host via ssh and displays the live transfer speed, directing all transferred data to /dev/null needs pv installed Debian: 'apt-get install pv' Fedora: 'yum install pv' (may need the 'extras' repository enabled)

Split a tarball into multiple parts
Create a tar file in multiple parts if it's to large for a single disk, your filesystem, etc. Rejoin later with `cat .tar.*|tar xf -`

Create a directory and go inside it
$_ expands to the last argument of the last command that was executed

tar and remove files which are older that 100 days
tar does not have a -mtime option as find. tar appends all the file to an existing tar file.

Count the number of deleted files
It does not work without the verbose mode (-v is important)


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: