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

Single use vnc-over-ssh connection
This command 1. SSH into a machine 2. Tunnels VNC port to your local computer ("-L 5900:localhost:5900") 3. Runs a single use vnc server ("x11vnc -safer -localhost -nopw -once -display :0") 4. Goes into the background ("-f") 5. Runs VNC viewer on the local computer connecting to the remote machine via the newly created SSH tunnel ("vinagre localhost:5900")

cleanup /tmp directory
Cleans all files in /tmp that have been accessed at least 2 days ago.

Search shoutcast web radio by keyword
Searches for web radio by submitted keyword and returns the station name and the link for listing . May be enhanced to read user's selection and submit it to mplayer.

Display connections histogram
Displays a connection histogram of active tcp connections. Works even better under an alias. Thanks @Areis1 for sharing this one.

Ultra fast public IP address lookup using Cloudflare's 1.1.1.1

Replace the content of an XML element
Replaces "650" with "999" in simple.xml. xml used - http://www.w3schools.com/xml/simple.xml

Kill all processes that listen to ports begin with 50 (50, 50x, 50xxx,...)
Run netstat as root (via sudo) to get the ID of the process listening on the desired socket. Use awk to 1) match the entry that is the listening socket, 2) matching the exact port (bounded by leading colon and end of column), 3) remove the trailing slash and process name from the last column, and finally 4) use the system(…) command to call kill to terminate the process. Two direct commands, netstat & awk, and one forked call to kill. This does kill the specific port instead of any port that starts with 50. I consider this to be safer.

Unbelievable Shell Colors, Shading, Backgrounds, Effects for Non-X
I've been using linux for almost a decade and only recently discovered that most terminals like putty, xterm, xfree86, vt100, etc., support hundreds of shades of colors, backgrounds and text/terminal effects. This simply prints out a ton of them, the output is pretty amazing. If you use non-x terminals all the time like I do, it can really be helpful to know how to tweak colors and terminal capabilities. Like: $ echo $'\33[H\33[2J'

Get absolut path to your bash-script
Another way of doing it that's a bit clearer. I'm a fan of readable code.

urldecoding
My version uses printf and command substitution ($()) instead of echo -e and xargs, this is a few less chars, but not real substantive difference. Also supports lowercase hex letters and a backslash (\) will make it through unescaped


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: