pack a folder without some files
Make a tar archive of a folder, leaving out folders like node_modules and files like logs.
archivesfiles
steps
-
tar -czf project.tar.gz --exclude='node_modules' --exclude='*.log' project/pack project without node_modules and the logs
-
tar -czf project.tar.gz --exclude-vcs project/without .git and the like (GNU tar)
-
tar -tzf project.tar.gz | lesscheck what went in
-
git archive -o project.tar.gz HEADin a git repository: only the files git tracks
notes
- Put the --exclude options before the folder: some tar versions ignore them after it.
commands used
targit
Each has a page in lore: lore tar opens it.
compress a folder
Pack a folder into one compressed file, look inside it, and unpack it again.
unpack an archive
Open any common archive: tar, zip, gz, xz, 7z, rar.
add to the end of a file
Add lines to a file without replacing it, also to a file only root can write.
argument list too long
"Argument list too long" from rm, cp or mv: too many files for one command line. Hand them over in batches.