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.
» 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:
The download content part.
NOTE: the '-c' seems to not work very well and the download stuck at 99% sometimes. Just finish wget with no problem. Also, the download may restart after complete. You can also cancel. I don't know if it is a wget or Rapidshare glitch since I don't have problems with Megaupload, for example.
UPDATE: as pointed by roebek the restart glitch can be solved by the "-t 1" option. Thanks a lot.
In order to do that, first you need to save a cookie file with your account info. These commands do it (maybe you need to create the '.cookies' dir before). Also, you need to check the "Direct downloads" option on the Premium Zone >> Settings tab.
You need to do this once (as long you maintain the file or your Rapidshare Premium account).
A great password generation tool. http://www.adel.nursat.kz/apg/
The vi key sequence !}command will send the file contents from the cursor
to the next blank line as STDOUT to the command specified
and replace that sequence of file lines with the output of the command.
For example: sorting a block of data - !}sort
The sequence !{command will do the same but "upwards" (from the current position towards the start of the file.
head by default displays first ten lines of its output. Use 'head -nXX' to display the XX largest files
apart from not being generalisable to all shells, `Y <<< X` seems nicer to me than `echo X | Y`, e.g.
<<< lol cat;
it reads easier, you type less, and it also looks cool
this exits bash without saving the history. unlike explicitly disabling the history in some way, this works anywhere, and it works if you decide *after* issuing the command you don't want logged, that you don't want it logged
... $$ ( or ${$} ) is the pid of the current bash instance
this also works perfectly in shells that don't have $$ if you do something like
kill -9 `readlink /proc/self`
Some commands (such as netcat) have a port option but how can you know which ports are unused?
Python comments begin with a #. Modify to suit other languages.
Other uses: Instead of m0 use m$ for end of file or d for deleting all comments.
This command will replace all instances of 'foo' with 'bar' in all files in the current working directory and any sub-directories.
This command will replace all instances of 'foo' with 'bar' in all files in the current working directory.
This turns your iptables packet filter to a "Allow any from any to any" filter, so you can rule out any filtering issues when you have a problem to enable a connection from or to your host.
To re-enable it, run /etc/init.d/iptables restart
You can watch channels of your freebox, everywhere. With " vlc http://your-ip:12345 " on the client and ncurses vlc interface on the host. et voila
Change files case, without modify directories, recursively.
... fucking vfat
Extensible to other ugly extensions like *.JPG, *.Jpg etc..
Leave out the last pipe to sh to perform a dry run.
To resize photos without changing exif datas, pretty cool for gps tagging.
(Require ImageMagick)
This is useful for sending data between 2 computers that you have shell access to. Uses tar compression during transfer. Files are compressed & uncompressed automatically. Note the trailing dash on the listening side that makes netcat listen to stdin for data.
on the listening side:
sudo nc -lp 2022 | sudo tar -xvf -
explanation: open netcat to -l listen on -p port 2022, take the data stream and pipe to tar -x extract, -v verbose, -f using file filename - means "stdin"
on the sending side:
tar -cvzf - ./*| nc -w 3 name_of_listening_host 2022
explanation: compress all files in current dir using tar -c create, -v verbose, -f using file, - filename - here means "stdout" because we're tar -c instead of tar -x, -w3 wait 3 seconds on stream termination and then end the connection to the listening host name_of_listening_host, on port 2022