- Published on
Basic Terminal Commands: man, wget, and apt
- Authors
- Name
- Hieu Cao
Introduction
When working on a Linux system, common tasks include looking up information, downloading files, and managing software packages. Three essential commands—man
, wget
, and apt
—help you perform these tasks efficiently. This article introduces each command with examples to get you started.
man
Command: Viewing Manuals
The The man
command displays the manual page for a command or program.
Syntax
man [command]
Common Use Cases
Look up command information
man ls
- Displays detailed documentation for the
ls
command.
- Displays detailed documentation for the
Search for keywords in a manual While in a
man
page, press/
to search for a keyword.Navigate the manual
- Press
Space
to go to the next page. - Press
q
to quit the manual.
- Press
wget
Command: Downloading Files
The The wget
command is used to download files from the internet via HTTP, HTTPS, or FTP.
Syntax
wget [options] URL
Common Use Cases
Download a single file
wget https://example.com/file.zip
- Downloads the file
file.zip
from the specified URL.
- Downloads the file
Download a file with a specific name
wget -O myfile.zip https://example.com/file.zip
- Saves the file as
myfile.zip
.
- Saves the file as
Resume an interrupted download
wget -c https://example.com/file.zip
- Continues downloading a partially downloaded file.
apt
Command: Managing Software Packages
The The apt
command is a package management tool commonly used on Debian-based systems like Ubuntu.
Syntax
sudo apt [options] command
Common Use Cases
Update the package list
sudo apt update
- Updates the list of available packages from the repositories.
Upgrade installed packages
sudo apt upgrade
- Updates all installed packages to their latest versions.
Install a package
sudo apt install package-name
- Installs the package named
package-name
.
- Installs the package named
Remove a package
sudo apt remove package-name
- Removes the package
package-name
from the system.
- Removes the package
Completely remove a package and its configuration
sudo apt purge package-name
- Deletes both the package and its related configuration files.
Practical Example
Combine the above commands in a basic workflow:
Look up information about the
wget
commandman wget
Download a file from the internet
wget https://example.com/sample.pdf
Install a new software package
sudo apt install curl
Conclusion
The man
, wget
, and apt
commands are powerful tools for Linux users. Understanding and using them effectively can make your workflow more efficient. Practice regularly to master these commands!