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:
Uses the data in the /proc system, provided by the acpid, to find out the CPU temperature. Can be run on systems without lm-sensors installed as well.
This command changes all filename and directories within a directory tree to unaccented ones. I had to do this to 'sanitize' some samba-exported trees. The reason it works might seem a little difficult to see at first - it first reverses-sort by pathname length, then it renames only the basename of the path. This way it'll always go in the right order to rename everything.
1. You'll have to have the 'unaccent' command. On Ubuntu, just aptitude install unaccent.
2. In this case, the encoding of the tree was UTF-8 - but you might be using another one, just adjust the command to your encoding.
3. The program might spit a few harmless errors saying the files are the same - not to fear.
Useful to move many files (thousands or millions files) over ssh. Faster than scp because this way you save a lot of tcp connection establishments (syn/ack packets).
If using a fast lan (I have just tested gigabyte ethernet) it is faster to not compress the data so the command would be:
tar -cf - /home/user/test | ssh user@sshServer 'cd /tmp; tar xf -'
to download latest version of "util", maybe insert a sort if they wont be shown in right order.
curl lists all files on mirror, grep your util, tail -1 will gets the one lists on the bottom and get it with wget
and you quickly know the files you changed
I have a small embedded linux device that I wanted to use for sniffing my external network, but I didn't want to recompile/cross-compile snort for the embedded platform. So I used tcpdump over ssh to pass all the traffic as pcap data to a "normal" Linux system that then takes the pcap data and passes it to snort for processing.
Don't need to pipe the output into rs if you just tell jot to use a null separator character.
Type the command in the terminal and press enter to create the tweet() function. Then run as follows:
tweet MyTwitterAccount "My message goes here"
It will prompt you for password. Make sure that you use escape "\" character in message for showing varialbles or markup.
This create an array 'a' with wole lines. only one occurrence of each line - Not Get lines ++ !
First look into /etc/modules if you have unionfs (or squashfs) support. If not, add the modules. UnionFS combines two filesystems. If there is a need to write a file, /tmp/unioncache will be used to write files (first create that directory). Reads will be done where the file is found first.
use the locate command to find files on the system and verify they exist (-e) then display each one in full details.
show file withou duplicated lines
Copies a dir structure without the files in it.
Replace 60 with the number of minutes until you want the machine to shut down.
Alternatively give an absolute time in the format hh:mm (shutdown -h 9:30)
Or shutdown right away (shutdown -h now)
man nautilus (1) - the GNOME File Manager
ps But if it hang up, you should kill it with -9 of couse
-p will preserve the file mode, ownership, and timestamps
-r will copy files recursively
also, if you want to keep symlinks in addition to the above: use the -a/--archive option
This will download a Youtube playlist and mostly anything http://code.google.com/apis/youtube/2.0/reference.html#Video_Feeds
The files will be saved by $id.flv
It's the same like 'cp -p' if available. It's faster over networks than scp. If you have to copy gigs of data you could also use netcat and the tar -z option in conjunction -- on the receiving end do:
# nc -l 7000 | tar -xzvpf -
...and on the sending end do:
# tar -czf - * | nc otherhost 7000