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:
is preserving creation time, modification time, permission, the directory structure, etc.
gpg -o- foo.tgz.gpg | tar zxvf -
Very similar as doing "wget http://example.com/mytarball|tar xzv", this one involves the "tee" command between both, which will simultaneously write the tarball and copy it to stdout. So this command will locally save the tarball and extract it - both at the same time while it downloads.
Create an AES256 encrypted and compressed tar archive.
User is prompted to enter the password.
openssl enc -d -aes256 -in <file> | tar --extract --file - --gzip
Tar's up $DIR locally (w/bzip2) and sends remotely to $HOST:$PORT where netcat listens (using openbsd netcat). Start up receiving side command first, then execute this.
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'
If you want to exclude only one file or directory you should use as --exclude=file_or_directory
You can ran this also with cat for example:
tar zcvf - /folder/ | ssh firstname.lastname@example.org "cat > /dest/folder/file.tar.gz"
Or even run other command's:
tcpdump | ssh email@example.com "cat > /tmp/tcpdump.log"
This will make a backup of all hidden files and folders in the home folder.
Finally, we can make the file "unchangeable"
sudo chattr +i
If archive has leading directory level same as archive name and you want to strip it, this command is for you.
The command extracting the tar contents into particular directory ...
At client side:
tar c myfile | nc localhost 7000 ##Send file myfile to server
tar c mydir | nc localhost 7000 ## Send directory mydir to server
This is how I've done it in the past