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

check open ports without netstat or lsof

Edit all files found having a specific string found by grep
The grep switches eliminate the need for awk and sed. Modifying vim with -p will show all files in separate tabs, -o in separate vim windows. Just wish it didn't hose my terminal once I exit vim!!

Stop Flash from tracking everything you do.
Brute force way to block all LSO cookies on a Linux system with the non-free Flash browser plugin. Works just fine for my needs. Enjoy.

Blacklist usb storage
Some times you may ban usb to protect thefting of your personal data. Blacklist the usb_storage module by adding blacklist usb_storage to /etc/modprobe.d/blacklist.conf. To load the module manually, $sudo modprobe usb_storage.

Make all GUI stuff show up on the display connected to the computer (when you're logged in via SSH)
If you have multiple displays or monitors the DISPLAY environment variable will tell X where to send the output. This is very handy for setting up a mediacenter at home. You can plugin the computer to the TV and then ssh to the computer and set the DISPLAY as above, then run your program and it will show up on the TV.

Protect directory from an overzealous rm -rf *
-R Recursively change attributes of directories and their contents. +i to set the immutable bit to prevent even root from erasing or changing the contents of a file.

umount --rbind mount with submounts
Original: https://bugzilla.redhat.com/show_bug.cgi?id=194342

Floating point power p of x
One pipe less.

Search command history on bash
Very handy and time-saving. Do a 'ctrl+ r' on command prompt. You will see a "(reverse-i-search)`':" mark. Just type any sub-string of the command you want to search(provided you have used it sometime in the same session). Keep on searching by repeatedly pressing ctrl+r. Press enter once you get the desired command string.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"


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: