This is an extract from a larger script which makes up slideshow videos from images. $seconds is the number of seconds the video will last, and $num is a loop counter which numbers the videos for concat into a longer video later, so they will be in order. The dev/null bit on the end cuts ffmpeg's verbosity.

tired of switching to the console to check if some command has finished yet? if notify-send does not work on your box try this one... e.g. rsync -av -e /usr/bin/lsh $HOME slowconnection.bar:/mnt/backup ; z (now fire up X, do something useful, get notified if this stuff has finished).

This command starts screen with 'htop', 'nethogs' and 'iotop' in split-screen. You have to have these three commands (of course) and specify the interface for nethogs - mine is wlan0, I could have acquired the interface from the default route extending the command but this way is simpler.
htop is a wonderful top replacement with many interactive commands and configuration options. nethogs is a program which tells which processes are using the most bandwidth. iotop tells which processes are using the most I/O.
The command creates a temporary "screenrc" file which it uses for doing the triple-monitoring. You can see several examples of screenrc files here: http://www.softpanorama.org/Utilities/Screen/screenrc_examples.shtml

Get the name of the parent command. This might be helpful, if you need to react on that information. E. g. a script called directly via ssh has got sshd as parent, manually invoked the parent process will probably be bash

If you are doing some tests which require reboots (e. g. startup skripts, kernel module parameters, ...), this is very time intensive, if you have got a hardware with a long pre-boot phase due to hardware checks.
At this time, kexec can help, which only restarts the kernel with all related stuff.
First the kernel to be started is loaded, then kexec -e jumps up to start it.
Is as hard as a reboot -f, but several times faster (e. g. 1 Minute instead of 12 on some servers here).
Show Sample Output

If you know the benefits of screen, then this might come in handy for you. Instead of ssh'ing into a machine and then running a screen command, this can all be done on one line instead. Just have the person on the machine your ssh'ing into run something like
screen -S debug
Then you would run
ssh -t user@host screen -x debug
and be attached to the same screen session.

Useful if you f.i. want to block/allow all connections from a certain provider which uses successive netnames for his ip blocks. In this example I used the german Deutsche Telekom which has DTAG-DIAL followed by a number as netname for the dial in pools.
There are - as always ;) - different ways to do this. If you have seq available you can use
net=DTAG-DIAL ; for i in `seq 1 30`; do whois -h whois.ripe.net $net$i | grep '^inetnum:' | sed "s;^.*:;$net$i;" ; done
or without seq you can use bash brace expansion
net=DTAG-DIAL ; for i in {1..30}; do whois -h whois.ripe.net $net$i | grep '^inetnum:' | sed "s;^.*:;$net$i;" ; done
or if you like while better than for use something like
net=DTAG-DIAL ; i=1 ; while true ; do whois -h whois.ripe.net $net$i | grep '^inetnum:' | sed "s;^.*:;$net$i;" ; test $i = 30 && break ; i=$(expr $i + 1) ; done
and so on.
Show Sample Output

Only tested on Linux Ubunty Hardy. Works when file names have spaces. The "-maxdepth 2" limits the find search to the current directory and the next one deeper in this example. This was faster on my system because find was searching every directory before the current directory without the -maxdepth option. Almost as fast as locate when used as above. Must use double quotes around pattern to handle spaces in file names. -print0 is used in combination with xargs -0. Those are zeros not "O"s. For xargs, -I is used to replace the following "{}" with the incoming file-list items from find. Echo just prints to the command line what is happening with mv. mv needs "{}" again so it knows what you are moving from. Then end with the move destination. Some other versions may only require one "{}" in the move command and not after the -I, however this is what worked for me on Ubuntu 8.04. Some like to use -type f in the find command to limit the type.
Show Sample Output

Strangely enough, there is no option --lines=[negative] with tail, like the head's one, so we have to use sed, which is very short and clear, you see.
Strangely more enough, skipping lines at the bottom with sed is not short nor clear. From Sed one liner :
# delete the last 10 lines of a file
$ sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1
$ sed -n -e :a -e '1,10!{P;N;D;};N;ba' # method 2
Show Sample Output

This starts a very basic X session, with just a simple xterm. You can use this xterm to launch your preferred distant session.
ssh -X john@otherbox gnome-session
Try also startkde or fluxbox or xfce4-session.
To switch between your two X servers, use CTRL+ALT+F7 and CTRL+ALT+F8.

When you've got a list of numbers each on its row, the ECHO command puts them on a simple line, separated by space. You can then substitute the spaces with an operator. Finally, pipe it to the BC program.
Show Sample Output

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.

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.