Commands by Jennifer1 (0)

  • bash: commands not found

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

Edit file(s) that has been just listed
That will open vi with the four README files in different viewports. Specially handy when you find there is only one file matching your pattern and you don't want to specify the full path.

SAR - List the average memory usage for all days recorded under '/var/log/sa/*' using sar -r.

Randomize lines in a file
Works in sort (GNU coreutils) 7.4, don't know when it was implemented but sometime the last 6 years.

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"

Show recent earthquakes in Bay Area
To see only earthquakes for today, add another pipe to egrep "`date '+%Y/%m/%d'`"

Validate all XML files in the current directory and below
If everything validates, there's no output. Can be handy to run on a cron job set up to email output.

Search for an active process without catching the search-process
This does the same thing as many of the 'grep' based alternatives but allows a more finite control over the output. For example if you only wanted the process ID you could change the command: $ ps -ef | awk '/mingetty/ && !/awk/ {print $2}' If you wanted to kill the returned PID's: $ ps -ef | awk '/mingetty/ && !/awk/ {print $2}' | xargs -i kill {}

Get HTTP status code with curl

Replicate a directory structure dropping the files
Here is how to replicate the directory structure in the current directory to a destination directory (given by the variable DESTDIR), without copying the files.


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: