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

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"

Generate a random left-hand password
Generates a random 8-character password that can be typed using only the left hand on a QWERTY keyboard. Useful to avoid taking your hand off of the mouse, especially if your username is left-handed. Change the 8 to your length of choice, add or remove characters from the list based on your preferences or kezboard layout, etc.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Tells which group you DON'T belong to (opposite of command "groups") --- uses sed
special thanks to XwZ :)

Want to known what time is it in another part of the world ?
available timezone can be found in /usr/share/zoneinfo. Other examples: $ TZ=Europe/Paris date; TZ=Australia/Sydney date; TZ=America/New_York date this is based on zoneinfo files on macosx. Your mileage my vary on other unix dialects

Rolling upgrades via aptitude
This has been my "sysupgrade" alias since ca. 2006, first used on Debian Sid, then Sabayon, and it still does its duty on Mint nowadays without breaking stuff.

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"

Get fully qualified domain names (FQDNs) for IP address with failure and multiple detection

Sets shell timeout
Useful in root's .profile - will auto-logout after TMOUT seconds of inactivity. Close after `seconds` inactive. export TMOUT=seconds (unefunge)

Find removed files still in use via /proc
Oracle DBA remove some logfiles which are still open by the database and he is complaining the space has not been reclaimed? Use the above command to find out what PID needs to be stopped. Or alternatively recover the file via: $ cp /proc/pid/fd/filehandle /new/file.txt


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: