Create a tar archive of backup_dir named backup.tar. (Verify using ls and tar -tf)

1 min read
Step 1: Create a Tar Archive of backup_dir
bashCopyEdittar -cvf backup.tar backup_dir
c
→ Create a new archivev
→ Verbose mode (shows files being archived)f
→ Specifies the filename (backup.tar
)
Step 2: Verify the Archive Using ls
bashCopyEditls -l
This lists all files in the current directory.
Expected output should include
backup.tar
.
Step 3: Verify the Contents of the Archive
bashCopyEdittar -tf backup.tar
t
→ List the contents of the archivef
→ Specifies the archive filename
Step 4: Extract the Archive (Optional)
If you want to extract the archive, use:
bashCopyEdittar -xvf backup.tar
x
→ Extract filesv
→ Verbose modef
→ Specifies the archive filename
Now, you have all the necessary syntax for creating, verifying, and even extracting the tar
archive.
0
Subscribe to my newsletter
Read articles from Ravi Vishwakarma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
