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

remove empty lines in place with backup
Modify file in place to remove empty lines and create a backup of the original with the extension .bak

Press a key automatically
Press a key automatically via xvkbd.

Start another X session in a window
You might have Xnest (older) rather than Xephyr. You can experiment with other desktops eg: startx /usr/bin/start-kde -- /usr/bin/Xephyr :2 You can start X on a remote machine (although I'd recommend vnc for anything slower than a LAN): startx /usr/bin/ssh -X gnome-session -- /usr/bin/Xephyr :2 Or just start another X session locally talking to the remote backend:

Install pip with Proxy
Installs pip packages defining a proxy

Recursively remove all subversion folders

Check syntax of remote ruby file

copy root to new device
Clone a root partition. The reason for double-mounting the root device is to avoid any filesystem overlay issues. This is particularly important for /dev. Also, note the importance of the trailing slashes on the paths when using rsync (search the man page for "slash" for more details). rsync and bash add several subtle nuances to path handling; using trailing slashes will effectively mean "clone this directory", even when run multiple times. For example: run once to get an initial copy, and then run again in single user mode just before rebooting into the new disk. Using file globs (which miss dot-files) or leaving off the trailing slash with rsync (which will create /mnt/target/root) are traps that are easy to fall into.

draw mesh

Show which programs are listening on TCP and UDP ports
-p Tell me the name of the program and it's PID -l that is listening -u on a UDP port. -n Give me numeric IP addresses (don't resolve them) -t oh, also TCP ports

List the binaries installed by a Debian package
GNU grep's perl-compatible regular expression(PCRE).


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: