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

Formatted list - WWNs of all LUNs
Use `scsi_id` to positively identify which LUNs are which (i.e. compare with the list of LUNs you created on your disk array) (shown: RHEL5 usage) Debian usage: $ # for i in /dev/sd* ; do wwn=`/lib/udev/scsi_id -g --device $i` ; [ "$wwn" != "" ] && echo -e ${i##*/}'\t'$wwn ;done

Hiding password while reading it from keyboard
Allow to read password in a script without showing the password inserted by the user

Copy files and directories from a remote machine to the local machine
This command will copy files and directories from a remote machine to the local one. Ensure you are in the local directory you want to populate with the remote files before running the command. To copy a directory and it's contents, you could: $ ssh user@host "(cd /path/to/a/directory ; tar cvf - ./targetdir)" | tar xvf - This is especially useful on *nix'es that don't have 'scp' installed by default.

Extract title from HTML files
previous version leaves lots of blank lines

kill process by name
Or even easier, if it's available: $ killall firefox I have no idea why you would want to rely on two unusual dependencies to do something that can be done a hundred ways from coreutils...

Filter IP's in apache access logs based on use
The first sort is necessary for ips in a list to be actually unique.

ignore hidden directory in bash completion (e.g. .svn)
add it in ~/.bashrc install bash-completion

get a rough estimate about how much disk space is used by all the currently installed debian packages
The vaule is expressed in megabytes

using tee to echo to a system file with sudo privileges
We sometimes need to change kernel parameters by echoing the file . This needs root privilege and if we do it using sudo like this , it fails $ sudo echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor -bash: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied We can achieve this with the tee command by just doing sudo without logging as root user http://www.zaman4linux.in/2010/09/using-tee-to-echo-to-system-file-with.html

On screen display of a command.
This is very useful if you need to show someone some text from a distance. (Like someone standing over your shoulder...) I'd recommend aliasing it to something like: alias osd_cat="osd_cat -o 400 -s 8 -c blue -d 60 -f -*-bitstream\ vera\ sans-*-*-*--200-*-*-*-*-*-*-*" xosd is the utility that provides osd_cat.


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: