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

show installed but unused linux headers, image, or modules
will show: installed linux headers, image, or modules: /^ii/!d avoiding current kernel: /'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d only application names: s/^[^ ]* [^ ]* \([^ ]*\).*/\1/ avoiding stuff without a version number: /[0-9]/!d

Prefix every line with a timestamp
Useful to add a timestamp to every line printed to stdout. You can use `-Ins` instead of `-Iseconds` if you want more precision.

Equivalent to ifconfig -a in HPUX

Extract all 404 errors from your apache accesslog (prefix lines by occurrences number)

Finding the number of cpu's

Apply permissions only to files
To apply only to dirs: $ chmod 755 $(find . -type d) Use -R parameters for recursive walk.

Squish repeated delimiters into one
This can be particularly useful used in conjunction with a following cut command like $echo "hello::::there" | tr -s ':' | cut -d':' -f2 which prints 'there'. Much easier that guessing at -f values for cut. I know 'tr -s' is used in lots of commands here already but I just figured out the -s flag and thought it deserved to be highlighted :)

check the status of 'dd' in progress (OS X)
"killall -USR1 dd" does not work in OS X for me. However, sending INFO instead of USR1 works.

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

Relocate a file or directory, but keep it accessible on the old location throug a simlink.
Used for moving stuff around on a fileserver


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: