### Commands by Wamith (1) the last day the last week the last month all time sorted by date votes

• I sue this in my .bashrc file This will also do auto-completion for scp and sftp

1
complete -o default -o nospace -W "$(grep -i -e '^host ' ~/.ssh/config | awk '{print substr($0, index($0,$2))}' ORS=' ')" ssh scp sftp
· 2013-11-19 14:44:41

### 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.

### Check These Out

Start a command on only one CPU core
This is useful if you have a program which doesn't work well with multicore CPUs. With taskset you can set its CPU affinity to run on only one core.

find external links in all html files in a directory list
Just a handy way to get all the unique links from inside all the html files inside a directory. Can be handy on scripts etc.

Backup with versioning
Apart from an exact copy of your recent contents, also keep all earlier versions of files and folders that were modified or deleted. Inspired by the excellent EVACopy http://evacopy.sourceforge.net

list block devices
Shows all block devices in a tree with descruptions of what they are.

use the real 'rm', distribution brain-damage notwithstanding
The backslash avoids any 'rm' alias that might be present and runs the 'rm' command in $PATH instead. In a misguided attempt to be more "friendly", some Linux distributions (or sites/etc.) alias 'rm' to 'rm -i'. Unfortunately, this trains users to expect that files won't actually be deleted until they okay it. This expectation will fail with catastrophic results when they use other distributions, move to other sites, etc., and doesn't really even work 100% even with the alias. It's too late to fix 'rm', but '\rm' should work everywhere (under bash). To play a file at 1.5 times normal speed without increasing the pitch small CPU benchmark with PI, bc and time.$ # 4 cores with 2500 pi digits $CPUBENCH 4 2500$. $every core will use 100% cpu and you can see how fast they calculate it.$ if you do 50000 digitits and more it can take hours or days

Save the Top 2500 commands from commandlinefu to a single text file

Use tagged vlans
Great for sysadmins! Don't forget to pass the vlan to your port in a manageable switch. After vconfig, you should use $sudo ifconfig eth0.[VID] up Now the interface is up, you can use dhclient or ifconfig again to get an ip address. Big (four-byte)$RANDOM
Sometimes, in a shell script, you need a random number bigger than the range of \$RANDOM. This will print a random number made of four hex values extracted from /dev/urandom.