
In order to create a tar.gz file using Terminal you can make use of the tar command with the following options,
tar -czf tar-gz-file-name.tar.gz [files to tar.gz]
Option | Description |
---|---|
-c | To create a new archive for the secified files, can also use --create |
-z | To compress the files as archive with gzip, can also use gizip --gunzip |
-f | Read the archive from or write the archive to the specified file, can also use --file |
Exampl 1: tar.gz specfied files seperated by space
tar -czf tarfile.tar.gz file1.txt file2.txt
Example 2: tar.gz all files in current directory
tar -czf tarfile.tar.gz .*
Example 3: tar.gz all txt extenstion files in current directory
tar -czf tarfile.tar.gz *.txt
Example 4: tar.gz all files that start with file and has extension txt
tar -czf tarfile.tar.gz file*.txt
- How to Display content of a file in Terminal Screen?
- How to Install CVS Version Control on Linux/Ubuntu
- How to install and Configure sar sysstat tools in Ubuntu Linux
- ls command to list only directories
- [Ubuntu] Search a package and versions using apt command
- zsh hello world example
- Linux Remove or Delete Files and Directories using Terminal Commands
- How to tar.gz a directory or folder Command
- Calculate days between dates using dateutils ddiff command
- How to ls command to output one entry per line [macOS/Linux/Bash]
- 3 Commands to stop Nginx Server
- Create and write file in single Linux/macOS command
- SCP Copy all files from directory to Local Folder
- How to go to the End of File in Nano Editor
- How to remove/delete a directory in Linux/macOs
- How to Copy Entire Directory to another Directory in Linux
- Execute .bin and .run file Ubuntu Linux
- The Date Command and its usage [Linux - Unix - macOS]
- Fix - ssh-copy-id no identities found error
- How to check uptime of Linux/Unix/macOS system/server using console command?
- How to Select All text in vim/vi editor using Keyboard
- Linux: Create a New User and Password and Login Example
- Command to display epoch time Terminal
- How to install curl on Alpine Linux
- How to exit from nano command
- Change the default download location for Mac Safari - MacOS
- Text Case Converter - Convert to Upper/Lower/Proper/Random Case - Tools
- NOTE: This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first. - Android
- Fix - 412 Cookies Are Disabled error in Exchange Admin Center when you click hybrid - Microsoft
- Use your iPhone microphone as a mic on macOS Ventura - MacOS
- [Fix] Microsoft Teams a JavaScript error occurred in the main process Error - Teams
- How to change Android Titlebar theme color from Purple - Android
- Convert SQL to CSV in Notepad++ - NotepadPlusPlus