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

Gives you what's between first string and second string included.
If the file content is : - Blah blah blah ABC hello blah blah blah bloh bloh bloh DEF Bah bah bah - You'll get: - ABC hello blah blah blah bloh bloh bloh DEF

command to change the exif date time of a image

Create user add lines from partial passwd file
Handy if you are installing a new server or recovering an old one and you have a passwd file with the accounts you want to add to the server. If you edit the file so that only the accounts that you want to add are left this line will spit out the correct useradd lines. The uid, gecos and shell will be preserved.

for all who don't have the watch command
#Usage: watch timeinsecond "command"

Copy your SSH public key on a remote machine for passwordless login.
Should run on any system with ssh installed.

Recursively grep thorugh directory for string in file.
-R, -r, --recursive Read all files under each directory, recursively; this is equivalent to the -d recurse option.

make sure you don't add large file to your repository

easily strace all your apache *child* processes
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.

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 HTTP status code with curl AND print response on new line


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: