tools:bash:files-archives
Table of Contents
This article is Part 5 in a series of cheat-sheets on the command line shell, bash. (Previous Page | Next Page)
bash: Managing Files & Archives
Modifying Files
Append whatever to the end of filename:
$ echo 'whatever' >> filename
File Archives
Tar
Creates .tar archive of specified directory(s):
$ tar -cvf filename.tar folder1/ folder2/
Show contents of archive:
$ tar -tf filename.tar
Extract contents of archive to pwd:
$ tar -xvf filename.tar
Extract contents of archive to specific folder:
$ tar -xvf filename.tar -C /destination/directory/
Other Tar Flags
-z
For working with tar.gz files-j
For working with tar.bz2 files
Zip
Puts all files from pwd into data.zip:
$ zip data *
Zips up entire directory and subdirectories:
$ zip -r data *
Unzip archive into pwd:
$ unzip data.zip
Unzip archive into specific folder:
$ unzip data.zip -d /destination/directory
Test archive for validity:
$ unzip -tq data.zip
Batch Operations
Batch Rename
Search & Replace Rename in PWD
rename 's/OLDSTRING/NEWSTRING/g' *
File Transfer
lftp and ftp
CLI FTP clients.
- Previous Page: ← Users & Permissions
- Next Page: Customization →
This article is part of a series on Command Line | |
Linux, MacOS & BSD | |
---|---|
Shells: | Bash (Getting Started - Shortcuts & Piping - Managing Processes - Users & Permissions - Files & Archives - Customization) - zsh |
Emulators/Multiplexers: | tmux |
Windows | |
PowerShell |
tools/bash/files-archives.txt · Last modified: 2025/01/04 03:39 by Humphrey Boa-Gart
Find this page online at: https://bestpoint.institute/tools/bash/files-archives
Find this page online at: https://bestpoint.institute/tools/bash/files-archives