Documentation on Linux is a great way to learn about installed utilities and commands. Linux provides many ways to access documentation:
/usr/share/doc/directory contains README files and other documents for installed commands.
mancommand to access reference manual pages for all installed commands. Usage:
infocommand to access full detailed informational pages for all installed commands. Usage
Compression a file reduces its size. Linux Bash provides many utilities to compress and decompress files including
xz. Files compressed with these commands have the extensions
To compress, run
To decompress, include the
<compression_utility> -d <compressed_file_name>.
gzip also supports the
-r option to compress all files in a directory.
Compress all `.mp4` files in current directory using `gzip`.```gzip *.mp4```Compress all files in the `videos` directory using `gzip`.```gzip -r videos/```Decompress a compressed file using `bzip2````bzip2 -d background.png.bz2```
Archiving consolidates multiple files together into one file for easier storage and portability. Linux Bash has two commands for archiving and extracting files:
|Archive||zip <archive_name>.zip <file1> <file2>..||tar -cf <archive_name>.tar <files or directory>|
|Extract||unzip <archive_name>.zip||tar -xf <archive_name>.tar|
In Linux environments,
tar is preferred as a file extension because a tarball can retain important metadata like file permissions.
Archiving the directory `riddles` using `zip````zip riddles.zip -r riddles/```Archiving files using `tar````tar -cf languages.tar english.txt french.txt```
zip bash command automatically compresses archived files while
tar can be combined with compression utilities like
xz. There are specific options for
tar that must be used to match the compression command.
Here are the list of
-c: Creates an archive
-x: Extracts an archive
-f: Creates an archive with given filename
-z: Compress using
gzip. Resulting file extension:
-j: Compress using
bzip2. Resulting file extension:
-J: Compress using
xz. Resulting file extension:
Archiving the media directory with tar using the xz compression:$ tar -cf media.tar media/$ xz media.tarOR$ tar -cJf media.tar.xz media/
The Linux shell has many commands to manage and communicate with networks:
ping <target domain or IP>: Checks connectivity between two devices on the same network by sending packets.
host <domain or IP>: Performs DNS resolution, the process of converting a domain name to an IP address or vice versa.
ifconfig: Shows network interface information.
Two Linux terminal commands,
wget, can access, download a file from the internet, and even upload a file. Either of the following commands establishes a connection with a server and downloads either the HTML of a webpage or a file stored at the URL to the current working directory.
$ curl -O <URL>$ wget <URL>