Commands tagged Linux (266)

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

List only hidden files
You can omit the -d to see what's inside directories. In that case, you may want -a to see dotfiles inside those directories. (Otherwise you don't need -a since you're explicitly looking at them.)

search google on os x
Searches Google, but requires no "", and will also search all terms input in the CL, eg: > google foo bar returns search URL "http://www.google.com/search?q=foo%20bar" You could also use awk to replace all spaces with a +, which is how the Google search handles spaces, but that makes it more than one line.

Get first Git commit hash
git log --format=%H | tail -1 doesn't work anymore

Trick find -exec option to execute alias
An alias cannot be executed as command in a find -exec line. This form will trick the command line and let you do the job.

Default value or argument
I used it for this function, which prints hashes: function liner { num_lines=${1:-42} echo printf %${num_lines}s|tr " " "#" echo } Note the colon-dash, instead of the usual colon-equals.

Ease your directory exploration
Usage : tt [OCCURRENCE] tt will display a tree from your actual path tt .svn will display only line containing .svn

Shows how many percents of all avaliable packages are installed in your gentoo system

Show me a histogram of the busiest minutes in a log file:
Busiest seconds: $ cat /var/log/secure.log | awk '{print substr($0,0,15)}' | uniq -c | sort -nr | awk '{printf("\n%s ",$0) ; for (i = 0; i

analyze traffic remotely over ssh w/ wireshark
Please check out my blog article on this for more detail. http://jdubb.net/blog/2009/08/07/monitor-wireshark-capture-real-time-on-remote-host-via-ssh/

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)


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: