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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
new way to replace text file with dd,faster than head,sed,awk if you do this with big file
create an iso from your cd/dvd-rom device . You need to umount /dev/cdrom
before using the cli
This will find any regular file starting with the current directory and use /dev/urandom to overwrite that file. It will is the same size of the file (in blocks) as the file. Can't handle files with spaces or odd characters in the name (who does that anyway?)
Have you ever wondered what the hell was dd command doing? well, there you have it... notice the -USR1 signal :)...
Useful when you want to know the mbrid of a device - for the purpose of making it bootable. Certain hybridiso distros, for eg the OpenSUSE live ISO uses the mbrid to find the live media. Use this command to find out the mbrid of your USB drive and then edit the /grub/mbrid file to match it.
Only slightly different than previous commands. The benefit is that your "watch" should die when the dd command has completed. (Of course this would depend on /proc being available)
usage: mem memcache-command [arguments]
where memcache-command might be:
set
add
get[s]
append
prepend
replace
delete
incr
decr
cas
stats
verbosity
version
notes:
exptime argument is set to 0 (no expire)
flags argument is set to 1 (arbitrary)
the speed is about 500MB/s on my machine.
i think it's fast enough to output not too many bytes.
while a C program may output 1GB per sencond on my machine.
if the size is not the power of 512,you may change the bs and count in dd.
Similar to the original, but is much faster since it only needs to write the last byte as zero. A diff on testfile and testfile.seek will return that they are the same.
Will automatically take the size of the file but longer, usefull only if in an function.
Step#2 Create a copy of the bootload and partition table!
Acquires a bit-by-bit data image, gzip-compresses it on multiple cores (pigz) and encrypts the data for multiple recipients (gpg -e -r). It finally sends it off to a remote machine.
Install a basic FreeBSD system on a distant server. I use this to install FreeBSD on servers that can only boot a Linux rescue system. This sytem loads on ram when booted, so it is possible to install freely. You can even install on ZFS root !
Adjust "sleep X" to your needs.
*NOTE: First sleep is required because bash doesn't have a "post-test" syntax (do XXX while).
Sends random sounds to your sound card output (e.g. your speaker). Think... You can also run it remotely on another computer using SSH and scare its user!
Sends random beeps to your PC-speaker. Think... You can also run it remotely on another computer using SSH and scare its user! Don't forget to run it on your dedicated hosting server and watch sysadmin's action from data-center's live remote cameras!