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

Use result of the last command
\$ which python /usr/bin/python \$ ll `!!` lrwxrwxrwx 1 root root 9 2010-11-08 22:01 /usr/bin/python -> python2.6

Boooted as EFI/UEFI or BIOS

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"

Show the UUID of a filesystem or partition
Shows the UUID of a filesystem or partition that can be used in kernel root options and in fstab. Run it without the -u option to generate more information. eg: ~/ sudo vol_id /dev/sda2 ID_FS_USAGE=other ID_FS_TYPE=swap ID_FS_VERSION=2 ID_FS_UUID=27fca13d-97b7-4d28-882c-6d03353f0a82 ID_FS_UUID_ENC=27fca13d-97b7-4d28-882c-6d03353f0a82 ID_FS_LABEL= ID_FS_LABEL_ENC=

memory usage

Rename files in batch

Delete empty directories
Recursively delete empty directories. Use with care.

sort ip by count quickly with awk from apache logs
creates associative array from apache logs, assumes "combined" log format or similar. replace awk column to suit needs. bandwidth per ip is also useful. have fun. I haven't found a more efficient way to do this as yet. sorry, FIXED TYPO: log file should obviously go after awk, which then pipes into sort.

total percentage of memory use for all processes with a given name
This command will add up RAM usage of all processes whose name contains "java" and output the sum of percentages in HRF. Also, unlike the original #15430, it wont fail on processes with a usage of >9.9%. Pleases note that this command wont work reliably in use cases where a significant portion of processes involved are using less than 0.1% of RAM, because they will be counted as "0", even though a great number of them could add up to significant amounts.

camelcase to underscore
Convert a camelCase string into snake_case. To complement senorpedro's command.


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: