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

Get ElasticSearch configuration and version details
Replace localhost:9200 with your server location and port. This is the ElasticSearch's default setup for local instances.

A signal trap that logs when your script was killed and what other processes were running at that time
trap is the bash builtin that allows you to execute commands when the current script receives a particular signal. Uses $0 for the script name, $$ for the script PID, tee to output to STDOUT as well as a log file and ps to log other running processes.

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"

run shell with your commandlinefu.com's favourites as bash_history
This makes your commandlinefu.com's favorites appear as most recent commands in your history.

Make changes in any profile available immediately/Change to default group
Changes your group to the default group, has the same effect as sourcing your profile/rc file (in any shell) or logging out and back in again.

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"

Replace multiple spaces with semicolon

Time Synchronisation with NTP

Show drive names next to their full serial number (and disk info)
As of this writing, this requires a fairly recent version of util-linux, but is much simpler than the previous alternatives. Basically, lsblk gives a nice, human readable interface to all the blkid stuff. (Of course, I wouldn't recommend this if you're going to be parsing the output.) This command takes all the fun out of the previous nifty pipelines, but I felt I ought to at least mention it as an alternative since it is the most practical.

Run netcat to server files of current folder


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: