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

Get the total length of all videos in the current dir in H:m:s
You're behind on your TV catch-up, but how far behind? This command tries to open mplayer against all files in the current dir. If it's a video file it will contain ID_LENGTH, which is summed and output in hours, minutes and seconds. Someone better at awk could probably reduce this down a lot.

Delete all aliases for a network interface on a (Free)BSD system
The example command deletes all aliases for network interface 'em0' assuming that the aliases have netmask of 255.255.255.255 and the master IP has some other netmask (such as 255.255.255.0). See here -> http://my.galagzee.com/2009/07/22/deleting-all-network-interface-aliases/ for more on the rationale of this command.

Reconnect to screen without disconnecting other sessions
Have your screen session running in multiple places. (warning, things start to look weird if the terminal windows have different dimensions)

how to find the active X (X11/xorg) username and DISPLAY variable
Requires consolekit (works in e.g. Ubuntu). Here x11-display is DISPLAY

Hiding and Show files on Mac OS X
These commands will mark a file as hidden or visible to Mac OS X Finder. Notice the capitol V vs the lowercase v. This will also work for directories. setfile -a V foo.bar; // This marks the file invisible setfile -a v foo.bar; // This marks the file visible I have also found that adding the following aliases are helpful: alias hide='setfile -a V' alias show='setfile -a v'

Find the package that installed a command

list block devices
Shows all block devices in a tree with descruptions of what they are.

Run a long job and notify me when it's finished
You will need libnotify-bin for this to work: $ sudo aptitude install libnotify-bin

SVN script for automatically adding and deleting files

Replace spaces in filenames with underscores


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: