A tarball is commonly known as a TAR file, short for tape archive, which is an archive file type commonly used in Linux and Unix operating systems to create and compress archives.
Compressing files and directories is a great way to save a good amount of disk space on a Linux system when the disk space limit is reached. On the other hand, you can delete unused nor old files that are no longer needed.
The tar command comes with various functions which we have already discussed in different aspects. But in this guide, we will discuss a lesser-known feature of tar that displays the contents of a tar.gz file without extracting it.
The below general syntax of the tar command can be used to view the contents of a tar files such as tar, tar.gz, tar.bz2, and tar.xz.
Syntax:
tar -tvf [Archive_File_Name]
Flag/Info | Details |
---|---|
tar | Linux Command |
-t | To list the contents of an archive |
-v | It shows more detailed information about the files/directories in the archive (display all information). |
-f | This specifies the archive file name you want to view. |
Archive_File_Name | Specifies the archived file which user wants to visualize. |
To view the contents of a 'tar.gz'
file without extracting it, run: This will show file and directory name along with other information’s such as file permission, owner & group information, files/directories size, and date & timestamp.
tar -tvf FossTechi.tar.gz
or
tar -tzvf FossTechi.tar.gz
Output:
To view only the name of the files in the tar.gz archive file, simply run:
tar -tf FossTechi.tar.gz or tar -tzf FossTechi.tar.gz home/linuxgeek/shell-scripts/ home/linuxgeek/shell-scripts/asm_disk_mapping_1.sh home/linuxgeek/shell-scripts/asm_disk_mapping.sh home/linuxgeek/shell-scripts/kill-user-sessions.sh home/linuxgeek/shell-scripts/block_device_mapping_with_LUN_FS.sh home/linuxgeek/shell-scripts/block_device_mapping_with_LUN.sh
To view the contents of a '.tar'
file without extracting it, run:
tar -tvf FossTechi.tar
To view the contents of a 'tar.bz2'
file without extracting it, run:
tar -tvf FossTechi.tar.bz2
or
tar -tjvf FossTechi.tar.bz2
To view the contents of a 'tar.xz'
file without extracting it, run:
tar -tvf FossTechi.tar.xz
or
tar -tjvf FossTechi.tar.xz
In this article we have explained the method to visualize the content of tar, tar.gz, tar.bz2, and tar.xz files without extracting them using the ‘-t’ option (list table of contents), along with various examples.
Cron is a command-line job scheduler available on Linux operating systems that allows users to…
In computing, there are two types of IP addresses, IPv4 and IPv6. By default, IPv6…
A tar archive is a file that stores a collection of directories and files, also…
On Linux, you can quickly find out how LUNs are mapped to the underlying OS…
Keeping your Ubuntu system up-to-date is critical to ensuring a system's stability and security. This…
When you boot a Linux system, it boots into legacy BIOS (Basic Input/Output System) mode…
This website uses cookies.