Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands by cammarin from sorted by
Terminal - Commands by cammarin - 12 results
VBoxManage startvm "name"
gconftool-2 -t string -s /desktop/gnome/background/picture_filename <path_to_image>
2009-04-29 11:19:29
User: cammarin
2

You can use this in a script which rotates wallpapers from a directory at each login.

cuebreakpoints <cue file> | shnsplit -o <lossless audio type> <audio file>
2009-04-29 10:42:57
User: cammarin
4

Do you have an entire album in a unique file and want to split it in individual tracks? If you also have the cue file you can do it!

Packages for Debian-based systems users:

* cuetools shntool

* FLAC (.flac): flac

* WavPack (.wv): wavpack

* Monkey's Audio (.ape): libmac2 monkeys-audio (deb http://www.debian-multimedia.org sid main)

NOTE: "sid" packages are unstable, but I didn't have problems with them. If you prefer, use the "stable" version repository.

To transfer the tags, you can use this (works with .flac, .ogg and .mp3):

cuetag sample.cue split-track*.flac
notify-send ["<title>"] "<body>"
2009-04-29 10:05:20
User: cammarin
45

The title is optional.

Options:

-t: expire time in milliseconds.

-u: urgency (low, normal, critical).

-i: icon path.

On Debian-based systems you may need to install the 'libnotify-bin' package.

Useful to advise when a wget download or a simulation ends. Example:

wget URL ; notify-send "Done"
screen -d -m [<command>]
2009-04-28 12:35:25
User: cammarin
Functions: screen
Tags: screen
16

Start screen in detached mode, i.e., already running on background. The command is optional, but what is the purpose on start a blank screen process that way?

It's useful when invoking from a script (I manage to run many wget downloads in parallel, for example).

rm ~/.mozilla/firefox/<profile_dir>/.parentlock
2009-04-28 12:15:58
User: cammarin
Functions: rm
Tags: firefox rm
7

Sometimes Firefox crashes or is bad finished and the message the process is still running appear while it's not. This also works when you sharing account from a NIS server and try to open the browser on multiple computers.

dpkg --get-selections > LIST_FILE
2009-03-28 17:45:29
User: cammarin
11

This command is useful when you want to install the same packages on another fresh OS install for example. To do that, use:

sudo dpkg --set-selections < LIST_FILE
mount.gmailfs none /mount/path/ [-o username=USERNAME[,password=PASSWORD][,fsname=VOLUME]] [-p]
2009-03-28 13:00:47
User: cammarin
Functions: mount
Tags: gmailfs fuse
5

Packages: gmailfs fuse-utils libfuse2 gvfs-fuse

Config files: /etc/gmailfs/gmailfs.conf; ~/.gmailfs.conf (make a copy from the another one)

Unmount:

fusermount -u /mount/path/

/etc/fstab (Optional):

none /mount/path/ gmailfs

noauto,user[,username=USERNAME,password=PASSWORD,fsname=VOLUME] 0 0

NOTES:

- The options between [] are optional since they already setuped on the config files.

- The '-p' flag shows a prompt for the password entry.

- It's necessary to add the user to the 'fuse' group. You can do that with:

sudo chgrp fuse /dev/fuse

and

sudo usermod -a -G fuse USER

- The volume name is not needed but highly recommended to avoid file corruption. Also choose a non-trivial name.

- Google doesn't approve the use of Gmail account other than e-mail purposes. So, I recommend the creation of a new account for this.

sudo firefox -install-global-extension /path/to/add-on
2009-03-28 11:11:12
User: cammarin
Functions: sudo
Tags: firefox
17

To install a theme use:

sudo firefox -install-global-theme /path/to/theme

You can get the .xpi or .jar file from the versions history on the add-on/theme page.

NOTE: may not work in your system (Debian-based is an example).

mplayer -vo aa <video file>
wget -c -t 1 --load-cookies ~/.cookies/rapidshare <URL>
2009-03-28 09:13:35
User: cammarin
Functions: wget
6

The download content part.

NOTE: the '-c' seems to not work very well and the download stuck at 99% sometimes. Just finish wget with no problem. Also, the download may restart after complete. You can also cancel. I don't know if it is a wget or Rapidshare glitch since I don't have problems with Megaupload, for example.

UPDATE: as pointed by roebek the restart glitch can be solved by the "-t 1" option. Thanks a lot.

wget --save-cookies ~/.cookies/rapidshare --post-data "login=USERNAME&password=PASSWORD" -O - https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi > /dev/null
2009-03-28 09:12:02
User: cammarin
Functions: wget
4

In order to do that, first you need to save a cookie file with your account info. These commands do it (maybe you need to create the '.cookies' dir before). Also, you need to check the "Direct downloads" option on the Premium Zone >> Settings tab.

You need to do this once (as long you maintain the file or your Rapidshare Premium account).