Welcome to bashoneliners.com, a curated collection of practical and well-explained Bash one-liners, snippets, tips and tricks. We aim to make each published one-liner to be of high quality: useful, easy to read, follows best practices, with clear, detailed, accurate explanation. These one-liners should help you automate tasks, troubleshoot problems, whether it be in system administration, file management, networking or programming.
git archive master some/project/subdir | tar t
GITFOLDER="/srv/some/folder" ls-files --others --exclude-standard | tar czf ${GITFOLDER}-archives/uploads-$(date '+%Y%m%d%H%M').tar.gz -T -
(cd /path/to/somewhere; tar c .) > somewhere.tar
GZIP='--rsyncable' tar cvzf bobsbackup.tar.gz /home/bob
git archive master | tar x -C /path/to/dir/to/export
tar cp -C /path/to/dir . | ssh server2 'tar x -C /path/to/target'
for FILE in *; do tar -jxf $FILE; done
tar c paths_to_files_and_dirs | gzip -c | openssl des3 > encrypted.tar.gz