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:
If you want to exclude only one file or directory you should use as --exclude=file_or_directory
Really useful when out of space in your current machine.
You can ran this also with cat for example:
tar zcvf - /folder/ | ssh [email protected] "cat > /dest/folder/file.tar.gz"
Or even run other command's:
tcpdump | ssh [email protected] "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
Simple tar pipe to be used to copy directories while including hidden files and maintaining file permissions
This command will :
-Archive all *.dmp files individually (one file per archive) from current directory .
-Delete original file after has been compressed.
This works more reliable for me ("cut -c 8-" had one more space, so it did not work)
The original suggestion did not work for me, when operating on folders located on an external mount (ie other than the root device) in Ubuntu. A variation using xargs does the trick.
the -a flag causes tar to automatically pick the right compressor to filter the archive through, based on the file extension. e.g.
"tar -xaf archive.tar.xz" is equivalent to "tar -xJf archive.tar.xz"
"tar -xaf archive.tar.gz" is equivalent to "tar -xzf archive.tar.gz"
No need to remember -z is gzip, -j is bzip2, -Z is .Z, -J is xz, and so on :)