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

Mirror the NASA Astronomy Picture of the Day Archive
Mirror the entire NASA Astronomy Picture of the Day archive, all the way from 1995. The archive is close to 2.5 GB, with lots of files, so give it some time. The logs can be redirected to a file using '-o somefile'. You might also want to try '-nH' and the '--cut-dirs' options

Calculate days on which Friday the 13th occurs (inspired from the work of the user justsomeguy)
Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale.

open path with your default GNOME program
Another step to bring cli and gui closer together: gnome-open It opens a path with the default (gui) application for its mime type. I would recommend a shorter alias like alias o=gnome-open More examples: $ gnome-open . [opens the current folder in nautilus / your default file browser] $ gnome-open some.pdf [opens some.pdf in evince / your default pdf viewer] $ gnome-open trash:// [opens the trash with nautilus] $ gnome-open http://www.commandlinefu.com [opens commandlinefu in your default webbrowser]

list folders containing less than 2 MB of data
This command will search all subfolders of the current directory and list the names of the folders which contain less than 2 MB of data. I use it to clean up my mp3 archive and to delete the found folders pipe the output to a textfile & run: $ while read -r line; do rm -Rv "$line"; done < textfile

list all opened ports on host

Backup with SSH in a archive
$PRIVATEKEY - Of course the full path to the private key \n $HOST - The host where to get the backup \n $SOURCE - The directory you wish to backup \n $DESTINATION - The destination for the backup on your local machine

Scans for open ports using telnet

!* Tells that you want all of the *arguments* from the previous command to be repeated in the current command
Example: touch file{1,2,3}; chmod 777 !*

Rips CDs (Playstation, etc.) and names the files the same as the volume name

kill all process that belongs to you
This will probably kill any user sessions and/or ssh connections to other servers you might have active.


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: