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

Convert .flv to .3gp
Download YouTube videos as .flv and convert them to .3gp for your mobile phone.

check open ports without netstat or lsof

uncomment the lines where the word DEBUG is found

Remotely sniff traffic and pass to snort
I have a small embedded linux device that I wanted to use for sniffing my external network, but I didn't want to recompile/cross-compile snort for the embedded platform. So I used tcpdump over ssh to pass all the traffic as pcap data to a "normal" Linux system that then takes the pcap data and passes it to snort for processing.

Converts multiple youtube links to mp3 files
Usage: ytmp3 "YTurl" "YTurl2" "YTurl3" "YTurlN" Uses the shift command to let you extract the .mp3 from as many youtube urls as you like (or wherever else youtube-dl is supported) *Requires youtube-dl Orginal chunk of code: youtube-dl -q -t --extract-audio --audio-format mp3 URL taken from here http://www.commandlinefu.com/commands/view/9701/convert-youtube-videos-to-mp3

Get the size of all the directories in current directory

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Find where a kind of file is stored
In this case searches for where .desktop files are stored. The resulted is a sorted list of the top directories containing such files.

Displays user-defined ps output and pidstat output about the top CPU or MEMory users.
It grabs the PID's top resource users with $(ps -eo pid,pmem,pcpu| sort -k 3 -r|grep -v PID|head -10) The sort -k is sorting by the third field which would be CPU. Change this to 2 and it will sort accordingly. The rest of the command is just using diff to display the output of 2 commands side-by-side (-y flag) I chose some good ones for ps. pidstat comes with the sysstat package(sar, mpstat, iostat, pidstat) so if you don't have it, you should. I might should take off the timestamp... :|

Get a BOFH excuse
Almost same output with fewer typing... OP had a great idea : BOFH !!!


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: