Commands by patko (7)

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

Preserve user variables when running commands with sudo.
In this case the current user has proxy variable set which allows access to the rpm on the internet but needs root privs to install it. Running sudo -E preserves the current user proxy var and allows the rpm install to be executed with sudo.

Determine next available UID
Typical usage would be in a script that would want the next open UID in a range (in this case 500-600)

Temporarily ignore known SSH hosts
you may create an alias also, which I did ;-) alias sshu="ssh -o UserKnownHostsFile=/dev/null "

Download song from youtube for import into itunes (m4a format)
Last argument is the youtube link. Requires ffmpeg

limit the cdrom driver to a specified speed
this command limit the speed to 8 until next eject of your cdrom disc , can be usefulll when you don't want to listen the sound of your cdrom driver .

Synchronize date and time with a server over ssh
Set Remote Server Date using Local Server Time (push)

Compute the average number of KB per file for each dir
Shorter version using --tag

Inverted cowsay
It's quite fun to invert text using "flip.pl" (ref: http://ubuntuforums.org/showthread.php?t=2078323 ). Slightly more challenging is to flip a whole "cowsay". :-)

for all flv files in a dir, grab the first frame and make a jpg.
This is handy for making screenshots of all your videos for referring to in your flv player.

Avoiding history file to be overwritten
If histappend options is set in bash, the file .bash_history will not be overwrite and history list is append to it.


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: