All commands (14,187)

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

Take a screenshot of a login screen
when using Gnome or KDE, you will have a hard time getting a screenshot of something like a login screen, or any other screen that occurs before the desktop environment is up and monitoring the printscreen key. (this probably applies for other DEs as well, but I haven't used them) What this command is meant to do is take a screenshot of an X window using a command you can run from your virtual terminals (actual text terminals, not just an emulator) To do this: Press CTRL+ALT+F1 to go to a virtual (text) terminal once your login window comes up Login to the virtual terminal and enter the command (you'll have to type it in) You should now have a file called screenshot.png in your home directory with your screenshot in it. For those of you who are new to the virtual terminal thing, you can use CTRL+ALT+F7 to get back to your regular GUI From http://www.gnome.org

Install Linux Kernel Headers

Dump sqlite database to plain text format
If you want edit your sqlite database in any uft8 supported editor, you can dump whole sqlite database to plain text.

Backup your LDAP
Simple way to backup your LDAP entries: put this line on your crontab. The -n switch identifies the dbnum you want to backup (alternatively you can use -b suffix. Check man slapcat for your personal switches)

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Use result of the last command
\$ which python /usr/bin/python \$ ll `!!` lrwxrwxrwx 1 root root 9 2010-11-08 22:01 /usr/bin/python -> python2.6

shuffle lines via perl
Same, without modules... Probably smarter option: just use the shuf command or even sort -R.

Start a game on the discrete GPU (hybrid graphics)
On laptops featuring hybrid graphics and using the free X drivers, the DRI_PRIME variable indicates which GPU to run on. This alias allows to utilize the faster discrete GPU without installing proprietary drivers.

Check a server is up. If it isn't mail me.
For some reason the 2&>1 does not work for me, but the shorter stdout/stderr redirection >& works perfectly (Ubuntu 10.04).

Paste command output to www.pastehtml.com in txt format.
paste(){ curl -s -S --data-urlencode "txt=$($@)" "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;}


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: