This is a shortcut to tar up all files matching a wildcard. Tar doesn't have the --include (apparently).
If you want to decompress the files from an archive to current directory by stripping all directory paths, use --transform option to strip path information. Unfortunately, --strip-components option is good if the target files have same and constant depth of folders. The idea was taken from http://www.unix.com/solaris/145941-how-extract-files-tar-file-without-creating-directories.html Show Sample Output
A quick find command to identify all TAR files in a given path, extract a list of files contained within the tar, then search for a given string in the filelist. Returns to the user as a list of TAR files found (enclosed in []) followed by any matching files that exist in that archive. TAR can easily be swapped for JAR if required. Show Sample Output
Part of the "atool" package.
Really useful when out of space in your current machine.
You can ran this also with cat for example:
tar zcvf - /folder/ | ssh root@192.168.0.1 "cat > /dest/folder/file.tar.gz"
Or even run other command's:
tcpdump | ssh root@10.0.0.1 "cat > /tmp/tcpdump.log"
With -a you don't care about file type (bz2, gzip, etc.)
Compress files or a directory to xz format. XZ has superior and faster compression than bzip2 in most cases. XZ is superior to 7zip format because it can save file permissions and other metadata data.
compress directory archive with xz compression, if tar doesn't have the -J option (OSX tar doesn't have -J)
-x, --extract, --get extract files from an archive -p, --preserve-permissions, --same-permissions extract information about file permissions (default for superuser) -f, --file=ARCHIVE use archive file or device ARCHIVE -v, --verbose verbosely list files processed
Don't have GNU tar installed that supports the redirect option (-C)? Use this. Show Sample Output
If you want certain files out of a directory hierarchy, this will copy just the listed files, but will create the directory hierarchy in the new location ($DIR/)
This command creates tar zip of a directory and its sub-directories. Show Sample Output
The command as given would create the file "/result_path/result.tar.gz" with the contents of the target folder including permissions and sub- folder structure. Show Sample Output
The following command finds all the files not modified in the last 5 days under /protocollo/paflow directory and creates an archive files under /var/dump-protocollo in the format of ddmmyyyy_archive.tar
This may be listed already but this command is useful to untar a specific directory to a different server.
The result of this command is a tar with all files that have been modified/added since revision 1792 until HEAD. This command is super useful for incremental releases.
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 :)
Part of the "atool" package
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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: