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

Stream YouTube URL directly to MPlayer
A function for streaming youtube to mplayer. The option "-g" for youtube-dl tells it to output the direct video URL, instead of downloading the video. "-fs" tells MPlayer to go FullScreen, and "-quit" makes it less verbose. Requires: youdube-dl ( http://bitbucket.org/rg3/youtube-dl/ ) (Tested in zsh)

restart apache only if config works
making lots of configurations to apache and restarting the server only to find it broken just plain sucks.

Rapidly invoke an editor to write a long, complex, or tricky command
Next time you are using your shell, try typing ctrl-x e (that is holding control key press x and then e). The shell will take what you've written on the command line thus far and paste it into the editor specified by $EDITOR. Then you can edit at leisure using all the powerful macros and commands of vi, emacs, nano, or whatever.

raw MySQL output to use in pipes
-N removes header -s removes separator chars -r raw output After using these options, the MySQL ouptut can be used with pipes very easily

Display the top ten running processes - sorted by memory usage
ps returns all running processes which are then sorted by the 4th field in numerical order and the top 10 are sent to STDOUT.

find read write traffic on disk since startup
The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. in ubuntu to get the iostat program do this: sudo apt-get install sysstat i found this command here: http://www.ocztechnologyforum.com/forum/showthread.php?t=54379

Compute the average number of KB per file for each dir
Shorter version using --tag

easily strace all your apache processes
Will open strace on all apache process, on systems using sbin/apache (debian) or sbin/httpd (redhat), and will follow threads newly created.

Show the PATH, one directory per line (part 2)
Here is another way to show the path, one directory per line. The command `tr` translates the colon into the new line, taking input from the $PATH variable

Extract a IRC like chat log out of an Adium xml logfile


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: