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:
-L RATE, --rate-limit RATE
Limit the transfer to a maximum of RATE bytes per second. A suffix of "k", "m", "g", or "t" can be added to denote kilobytes (*1024), megabytes, and so on. It must be an integer.
NOTE that pax goes always recursively, for that reason -d option should be added when you don't want to go recursively into directories.
This example will close the pipe after transferring 100MB at a speed of 3MB per second.
The option -print0 for find and -0 for grep help prevent issue with weird characters or spaces in filenames. Furthermore with xargs there is no limited number of arguments that find can throw.
You can upload via ftp the script.sh in unix text format, and then upload a file called run.txt to execute once the script. Such script can be multiline. If the script fails a failed.txt will be generated that you can see via ftp.
Note: the tar archive must not exist in order to create it. If exists it will only be updated and no already existent files in present search will still remain in the tar archive. The update option has to be used instead of create because the command tar may be executed more than once depending on the number of arguments that find throws. You can see maximum number of arguments with 'getconf ARG_MAX'
Then just nc servername 2600 and ./script.sh
kill the client with ctrl+c. You can reconnect several times.
kill the server with exit
If there are spaces won't work.
Why remember? Generate!
Up to 48 chars, works on any unix-like system (NB: BSD use md5 instead of md5sum)
I think, this is a shorter one :)
Type out the command and simply press to see the list of options for that command without having to type --help.
The first grep rejects capitalised words since the dict has proper nouns in it that you mightn't want to use. The second grep rejects words with ending in apostrophe s, and the third forces the words to be at least 15 characters long.
Backups $DIR_TO_BACKUP into tape, creating on the fly a MD5SUM file of the backup.
Then rewinds one record on tape and checks if it's well written.
Once you've made the snapshot you can resume any stopped services and then back up the file system (using the snapshot) without having to worry about changed files.
When finished, the snapshot can be removed :
mdconfig -d -u 1
rm /var/.snap/snap_var_`date "+%Y-%m-%d"`
Once you know the available frequencies for your CPU, they can be used to do things like set minimum CPU frequency for powerd so that it doesn't ramp down too slow on a server :
/etc/sysctl.conf or /boot/loader.conf:
debug.cpufreq.lowest=DESIRED FREQ HERE
or at terminal
sysctl debug.cpufreq.lowest=DESIRED FREQ HERE
also search with aptitude search '~c'