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

List all directories only.
Undocumented syntax, but should work on every shell. It'll list all directories in the current one. Change `*/` into globbing `**/` for recursivity.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Short Information about loaded kernel modules
I modify 4077 and marssi commandline to simplify it and skip an error when parsing the first line of lsmod (4077). Also, it's more concise and small now. I skip using xargs ( not required here ). This is only for GNU sed. For thoses without GNU sed, use that : $ modinfo $(lsmod | awk 'NR>1 {print $1}') | sed -e '/^dep/s/$/\n/g' -e '/^file/b' -e '/^desc/b' -e '/^dep/b' -e d

Get full directory path of a script regardless of where it is run from
Also resolves symlinks, showing the full path of the link target

convert a line to a space

Given $PID, print all child processes on stdout
Simpler.

wrap long lines of a text
wraps text lines at the specified width (90 here). -s option is to force to wrap on blank characters -b count bytes instead of columns

Given process ID print its environment variables
Same as previous but without fugly sed =x

Fibonacci numbers with awk
Another combination of seq and awk. Not very efficient, but sufficiently quick.

Top 10 Memory Consuming Processes


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: