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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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:
-secgrp no for distribution
-scope u for distribution
This one is for OS X users: sort -R and shuf aren't available in Lion (10.7.5)
Sets the exec bit on a file.
I doubt this works with other than bash, but then again, I havent tried.
The 'yes' utility is very simple, it outputs a hell of a lot of 'y's to standard input.
The '!!' command means 'the last command'. So this one-lines inputs a lot of y's into the last command, aggressively agreeing to everything. For instance, when doing apt-get.
This command deletes all but the first occurrence of a duplicate file in one or more folders.
this command will beep like an alarm for one minute from 18:57. you can change "1857" to your desired time.
you should have alsa-oss package installed, and you should also be root or part of "audio" group.
Just replace 15m with desired time. no suffix or 's' for seconds; 'h' for hours
You need to be root or in audio group to write to /dev/dsp.
You may use yes | head -n 2000 for about 1 second beep.
Wrote this as echo -e '\a' not always works as desired (ex. visual bell)
For each cpu set mask and then monitor your cpu infos. Temp,load avg. etc.
For example for 2nd cpu or 2nd core
taskset 0x00000002 yes > /dev/null &
For example for 3rd cpu or 3rd core
taskset 0x00000004 yes > /dev/null &
For example for 4th cpu or 4th core
taskset 0x00000008 yes > /dev/null &
Monitor your cpu temp with this command if you want
watch -n1 "acpi -t"
Load avg. from top command
simple bash one liner to pass multiple arguments to command one by one. optional yes/no pipe at beginning of command
connects to host via ssh and displays the live transfer speed, directing all transferred data to /dev/null
needs pv installed
Debian: 'apt-get install pv'
Fedora: 'yum install pv' (may need the 'extras' repository enabled)
Rainbow, instead of greys
Maybe you know shorter ?
That will capture 200 seconds of video at fullscreen 1680x1050 resolution, but scaled down 25 percent, with 15 frames per second.
This command uses the debugger to attach to a running process, and reassign a filehandle to a file.
The two commands executed in gdb are
p close(1) which closes STDOUT
which creates a file and opens it for output. Since file handles are assigned
sequentially, this command opens the file in place of STDOUT and once the process continues, new output to STDOUT will instead be written to our capture file.