knowledge/technology/applications/cli/compression/tar.md

33 lines
843 B
Markdown
Raw Permalink Normal View History

2023-12-04 10:02:23 +00:00
---
obj: application
2024-03-06 12:15:41 +00:00
mime: "application/tar"
extension: "tar"
2023-12-04 10:02:23 +00:00
website: https://savannah.gnu.org/projects/tar
repo: https://git.savannah.gnu.org/cgit/tar.git
---
2024-03-06 12:15:41 +00:00
2023-12-04 10:02:23 +00:00
# Tar
2024-01-17 08:44:04 +00:00
Tar is the most widely used command in Unix and Linux like operating system for creating archive of multiple files and folders into a single archive file and that archive file can be further compressed using other compression techniques
2023-12-04 10:02:23 +00:00
Creating Archives:
```shell
tar -cvf myarchive.tar /etc /root
```
List contents:
```shell
tar -tvf myarchive.tar # List contents
tar -tvf myarchive.tar path # List contents of path
```
Append or add files:
```shell
tar -rvf data.tar /etc/fstab
```
Extract files:
```shell
tar -xvf myarchive.tar # Extract
tar -xvf myarchive.tar -C /tmp # Extract to /temp
tar -xvf myarchive.tar /etc/fstab -C /etc # Only extract /etc/fstab to /etc
```