cat -n file : number all line cat -b file : number only non empty line see man cat
You're behind on your TV catch-up, but how far behind? This command tries to open mplayer against all files in the current dir. If it's a video file it will contain ID_LENGTH, which is summed and output in hours, minutes and seconds. Someone better at awk could probably reduce this down a lot. Show Sample Output
I use this to replicate my blocked images hosts list between work and home to keep my browsing ad-free.
works well in crontab.
the command show can be run in vim, here is the same thing on the command line
cat script.pl | perl -MO=Deparse | perltidy
This will change the ownership of /../../somedirectory as well as all its subdirectories so they will be be owned by user2 - typically used when a directory is owned by root:root
expr will give you a quick way to do basic math from the CLI. Make sure you escape things like * and leave a space between operators and digits. Show Sample Output
Output is from Debian Lenny Show Sample Output
This helps to keep track of what is going on when you have several tabs open in your terminal. The title automatically changes when you change directories.
Quick shortcut if you know the hostname and want to save yourself one step for looking up the IP address separately.
'top' has fancy layout modes where you can have several windows with different things displayed. You can configure a layout and then save it with 'W'. It will then be restored every time you run top.
E.g. to have two colored windows, one sorted by CPU usage, the other by memory usage, run top
top
then press the keys
<A> <z> <a> <-> <a> <z> <a> <-> <a>
and then as you don?t want to repeat this the next time:
<W>
I never can remember the syntax of awk. You can give a different -d option to cut to separate by e.g. commas. Also this allows to do more things with the generated SQL, e.g. to redirect it into different files. Show Sample Output
In this example the command "somecommand" will be executed and sent a SIGALARM signal if it runs for more than 10 seconds. It uses the perl alarm function. It's not 100% accurate on timing, but close enough. I found this really useful when executing scripts and commands that I knew might hang E.g. ones that connect to services that might not be running. Importantly this can be used within a sequential script. The command will not release control until either the command completes or the timeout is hit. Show Sample Output
draw `vmstat ` data using gnuplot
xwinwrap allows you to run any program in the root desktop pane. I like to run atlantis, it goes well against Fedora 10's blue sun background. At one time this also served a useful purpose for me as a workaround for a problem that would happen when the video card went into sleep mode.
It can transfer files through the http, gopher, finger, and ftp protocols without user interaction. It is small and fast. Show Sample Output
Useful in while and if statements
if not grep string filename; then echo string not found; exit 1; fi
This will show where your Perl installation is looking for modules.
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.
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
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: