How to check if an archive tool is installed in Linux

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn how to check if common archive tools like tar and zip are installed on a Linux system. You will use the --version option with each command to verify their presence and see their version information.

Additionally, you will explore how to inspect the /usr/bin directory to see a list of executable binaries, providing another way to confirm the existence of these and other commands.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("Linux")) -.-> linux/BasicFileOperationsGroup(["Basic File Operations"]) linux(("Linux")) -.-> linux/CompressionandArchivingGroup(["Compression and Archiving"]) linux/BasicFileOperationsGroup -.-> linux/ls("Content Listing") linux/CompressionandArchivingGroup -.-> linux/tar("Archiving") linux/CompressionandArchivingGroup -.-> linux/zip("Compressing") subgraph Lab Skills linux/ls -.-> lab-558779{{"How to check if an archive tool is installed in Linux"}} linux/tar -.-> lab-558779{{"How to check if an archive tool is installed in Linux"}} linux/zip -.-> lab-558779{{"How to check if an archive tool is installed in Linux"}} end

Check for tar with tar --version

In this step, we'll start exploring some common Linux commands used for managing files. One very useful command is tar, which is often used to archive and compress files. Before we use it, let's check if it's installed and see its version.

To do this, we'll use the --version option with the tar command. This is a common way to check the version of many command-line tools in Linux.

Open your terminal if it's not already open. Remember, you can find the Xfce Terminal icon on the left side of your desktop.

Type the following command and press Enter:

tar --version

You should see output similar to this, showing the version of the tar command installed on the system:

tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

The exact version number might be slightly different, but the output confirms that tar is installed and ready to use.

Checking the version of a command is a good practice to ensure you have the expected tools available and to understand their capabilities, as different versions might have different features or options.

Click Continue to proceed to the next step.

Verify zip with zip --version

In the previous step, we checked the version of the tar command. Now, let's do the same for another common archiving and compression tool: zip. The zip command is widely used, especially when interacting with files created on Windows or macOS systems.

Just like with tar, we can use the --version option to check if zip is installed and to see its version information.

Open your terminal again if it's not already open.

Type the following command and press Enter:

zip --version

You should see output similar to this:

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.

... (additional information) ...

Again, the exact version and output might vary slightly, but this confirms that the zip command is available on your system.

Checking the version of commands like tar and zip is a simple yet important skill. It helps you confirm that the necessary tools are present before you try to use them, which can save you time and frustration.

Click Continue to move on to the next step.

Inspect binaries with ls /usr/bin

In the previous steps, we checked the versions of tar and zip. These commands are executable programs, also known as binaries, that are stored in specific directories on your Linux system. A common location for many user-executable commands is the /usr/bin directory.

Let's use the ls command to list the contents of the /usr/bin directory. The ls command is used to list files and directories.

Open your terminal. Make sure you are in your home directory or the ~/project directory. You can use the pwd command to check your current directory if needed.

Now, type the following command and press Enter:

ls /usr/bin

This command tells ls to list the contents of the /usr/bin directory.

You will see a long list of names scroll by in your terminal. Each name in this list represents an executable program or a link to one, located in the /usr/bin directory. This directory contains a vast number of the commands you use regularly in the terminal.

[... many lines of output ...]
tar
tee
telnet
test
tftp
time
timeout
top
touch
tput
tr
true
truncate
tset
tsort
tty
type
tzselect
ubuntu-advantage-tools
ubuntu-bug
ubuntu-report
ucf
udevadm
ufw
ul
umount
unexpand
uniq
unlink
unlzma
unmkswap
unshare
unzip
update-alternatives
update-ca-certificates
update-catalog
update-dictcommon-main
update-dictcommon-wordlist
update-grub
update-icon-caches
update-info-dir
update-initramfs
update-locale
update-mime-database
update-passwd
update-pciids
update-rc.d
update-usbids
uptime
usb-devices
users
utmpdump
uuencode
uudecode
uuidgen
vdir
vlock
vmstat
volname
w
wait
wall
watch
wc
wdctl
wget
whatis
whereis
which
who
whoami
write
x86_64-linux-gnu-addr2line
x86_64-linux-gnu-ar
x86_64-linux-gnu-as
x86_64-linux-gnu-c++filt
x86_64-linux-gnu-cpp
x86_64-linux-gnu-dwp
x86_64-linux-gnu-elfedit
x86_64-linux-gnu-g++
x86_64-linux-gnu-gcc
x86_64-linux-gnu-gcc-11
x86_64-linux-gnu-gcc-ar-11
x86_64-linux-gnu-gcc-nm-11
x86_64-linux-gnu-gcc-ranlib-11
x86_64-linux-gnu-gcov
x86_64-linux-gnu-gcov-dump
x86_64-linux-gnu-gcov-tool
x86_64-linux-gnu-gprof
x86_64-linux-gnu-ld
x86_64-linux-gnu-ld.bfd
x86_64-linux-gnu-ld.gold
x86_64-linux-gnu-nm
x86_64-linux-gnu-objcopy
x86_64-linux-gnu-objdump
x86_64-linux-gnu-ranlib
x86_64-linux-gnu-readelf
x86_64-linux-gnu-size
x86_64-linux-gnu-strings
x86_64-linux-gnu-strip
xargs
xauth
xdg-desktop-icon
xdg-desktop-menu
xdg-email
xdg-icon-resource
xdg-mime
xdg-open
xdg-settings
xhost
xmodmap
xrandr
xset
xsetroot
xtables-multi
xz
xzcat
xzcmp
xzdiff
xzegrep
xzfgrep
xzgrep
xzless
xzmore
yes
zcat
zcmp
zdiff
zegrep
zfgrep
zforce
zgrep
zip
zipcloak
zipnote
zipsplit
zjsdecode
zless
zmore
znew
zsh
zsh5

You can scroll up and down in your terminal to see the full list. Notice that tar and zip are listed here, confirming their location.

This step gives you a glimpse into where many of the fundamental Linux commands reside. Understanding the file system structure is key to becoming proficient in Linux.

Click Continue to complete this step.

Summary

In this lab, we learned how to check if common archive tools are installed in Linux. We used the --version option with the tar command to verify its presence and see its version information. This method is a standard way to check the version of many command-line tools.

Following that, we applied the same technique to the zip command, another widely used archiving tool, by executing zip --version. This confirmed that zip was also installed and provided its version details. Checking the version of commands is a good practice to ensure the necessary tools are available and to understand their capabilities.