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

Lists all listening ports together with the PID of the associated process
The PID will only be printed if you're holding a root equivalent ID.

Find default gateway (proper at ppp connections too)

Download Englishword pronounciation as mp3 file

aptbackup restore
Use when aptbackup will not start or you just want to see what's going on.

Use Linux coding style in C program
put "-linux" option into $HOME/.indent.pro to make it default

When was your OS installed?
shows also time if its the same year or shows year if installed before actual year and also works if /etc is a link (mac os)

files and directories in the last 1 hour
added alias in ~/.bashrc alias lf='find ./* -ctime -1 | xargs ls -ltr --color'

List programs with open ports and connections
I prefer to use this and not the -n variety, so I get DNS-resolved hostnames. Nice when I'm trying to figure out who's got that port open.

Calculate days on which Friday the 13th occurs (inspired from the work of the user justsomeguy)
Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale.

Search through all installed packages names (on RPM systems)
You can use wildcard with rpm search but you have to do 2 things: 1. use "-a" switch (means "all") with query ("-q") switch - argument is a pattern to use while searching for package names of all installed packages 2. protect wildcards, so that shell could not eat them - escape it with backslash ("\") or enclose all pattern between apostrophes ("'"): $ rpm -qa 'co*de' As you can see above it is possible to insert wildcards into middle of the pattern. If you want, you can add "-i" or another rpm query options, "-i" will print package information for all installed packages matching pattern.


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: