commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
You'll run into trouble if you have files w/ missing newlines at the end. I tried to use
PAGER='sed \$q' git blame
PAGER='sed \$q' git -p blame
to force a newline at the end, but as soon as the output is redirected, git seems to ignore the pager.
That's what the sed command should've been, sorry.
Figures out total line contribution per author for an entire GIT repo. Includes binary files, which kind of mess up the true count.
If crashes or takes too long, mess with the ls-file option at the start:
git ls-files -x "*pdf" -x "*psd" -x "*tif" to remove really random binary files
git ls-files "*.py" "*.html" "*.css" to only include specific file types
Based off my original SVN version: http://www.commandlinefu.com/commands/view/2787/prints-total-line-count-contribution-per-user-for-an-svn-repository
Forward connections to $HOSTNAME:8080 out to $HOST:80
Nethogs is a useful tool for monitor bandwidth consumption by pid. Tested on Debian an CentOs
Convert Windows/DOS Text Files to Uni
The downside of output redirection is that you need permissions. So something like
won't play nicely w/ sudo. You'd need to do something like
bash -c '> file'
instead, you could go w/
sudo truncate -s0 file
If you wanted to do all in one command, you could go w/ sed instead
You can use -e to pass multiple patterns.
Produces secure passwords that satisfy most rules for secure passwords and can be customized for correct output as needed. See "man pwgen" for details.
make password randomly, default 8 chars, using bash3.X only, no external program.
make password randomly, default 8 char
Use multiple patterns with grep -v. So you can print all lines in a file except those containing the multiple patterns you specify.
Alternative to the ping check if your firewall blocks ping. Uses curl to get the landing page silently, or fail with an error code. You can probably do this with wget as well.
Strip my code to:
wmctrl -o 0,0 # autorotates to the first face. In fact [0-1279],0
wmctrl - 1280,0 # goes to the second face
wmctrl -o 2560,0 # goes to the third face, and so on.
# Use multiples of the horizontal display resolution.
My example work for 1280x800 display, been 1280 the number of interest.
Tweak the number, try a biiiig one and see your cube spinning...
I put a complex example to show how fun things can be, even for my ademco and paradox alarm central network advisor interface xpto etc. It rotates two faces, print the alarm message, and goes back tho where it was.
Tested on BIGLINUX 4.2, equivalent to ubuntu LTS hardy.
Do not forget to activate 3D efects ( compiz cube )
already described on the other two versions, this one uses ascii characters on game style to display elapsed time.
Variation of the theme, this one blinks in low profile on top level of X, ie, it is visible, indeed small.
Try changing fonts and sizes of osd_cat
Works on real time clock, unix time based, decrementing the actual time from initial time saved in an environment variable exported to child process inside watch
Shows elapsed time from start of script in hh:mm:ss format
Non afected by system slow down due to the use of date.
simple function , floating point number is supported.
My firefox overheats my cpu, sometimes above 90 degrees Celsius ( hence the name? )
To keep an eye on temperature, I put this command inside KAlarm ( a kind of cron) to be repeated every minute, for 5 seconds, color red ( default for osd_cat).
Its pretty, ultra small, displays a micro 2 lines text on every desktop and over everything and do not steal focus or interrupt any task. I get the information passively, in the low profile bottom of the screen.
Of course you can use it inside a terminal. Just do it:
watch -n 60 'acpi -t | osd_cat -p bottom'