Commands by aluminiumgeek (1)

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

Set gnome wallpaper to a random jpg from the specified directory
Every time this is run it will change your background picture. For added fun Add some DBUS magic: . $HOME/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0 export DBUS_SESSION_BUS_ADDRESS and a crontab entry: */5 * * * * above_command_in_script.sh >/dev/null 2>/dev/null now wallpaper changes every 5 mins

After typing lots of commands in windows, save them to a batch file quickly
After typing the command below, you will be greeted with nothing. press the up arrow to find the previous command you typed, press enter. repeat this as many times as you need, then hit CTRL-Z and press enter to save to the 'batchfilename.bat' file.

Use a var with more text only if it exists
See "Parameter Expansion" in the bash manpage. They refer to this as "Use Alternate Value", but we're including the var in the at alternative.

Create a bunch of dummy text files
Avoiding a for loop brought this time down to less than 3 seconds on my old machine. And just to be clear, 33554432 = 8192 * 4086.

Batch Convert SVG to PNG (in parallel)
Use GNU Parallel: short, easy to read, and will run one job per core.

Burn CD/DVD from an iso, eject disc when finished.
cdrecord -scanbus will tell you the (x,y,z) value of your cdr (for example, mine is 3,0,0)

check open ports without netstat or lsof

Install Linux Kernel Headers

Create a tar file with the current date in the name.

Recursive Line Count


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: