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"

Update a tarball
This will update the tarball, adding files that have changed since the last update. This assumes that the tarball is in the same directory as the files being archived. N.B. This command can't be used on compressed tarballs. N.B. This will add the updated files to the tarball, so that the tarball will have two versions of each file. This will make the tarball larger, but doesn't have any other significant effect.

Gets WAN ip address directly from DGN2200 router.

check open ports (both ipv4 and ipv6)
Check open TCP and UDP ports

Uptime in minute
Want to run scripts/programs in the system after starting X minute [ For letting the system to free ]? This will give uptime in minute.

Quickly batch resize images
-geometry (preserves values of height and width given, and aspect ratio). WARNING: While 'resize' creates resized copies of original files, 'mogrify' works on the original files, replacing them. It will overwrite the source files, use with caution, and backup regularly.

cd up a number of levels
Instead of typing "cd ../../.." you can type ".. 3". For extremely lazy typists, you can add this alias: alias ...=".. 2" ....=".. 3" - so now you can write just .... !!! NB the .. function needs to be "source"d or included in your startup scripts, perhaps .bashrc.

Rename all files which contain the sub-string 'foo', replacing it with 'bar'
Would this command line achieve the desired function? My CLI knowledge is not great so this could certainly be wrong. It is merely a suggestion for more experienced uses to critique. Best wishes roly :-)

Dump a configuration file without comments or whitespace...
A short, *easy-er* to remember command for stripping whitespace and comments from a config file, (or any file for that matter). Remember regex as: slash, space, star. pound, slash, bar. pointy-hat, dollar. (or "caret, dollar" if you must) :-P

Debug redirects between production reloads
Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.


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: