This cheat sheet consolidates the most frequently used commands in Ubuntu, one of the most popular Linux distributions. Designed for new and experienced users, this guide offers quick references and examples to help you navigate Ubuntu’s command-line interface efficiently.
Table of Contents
Installation Commands
Ubuntu’s package management is primarily handled through apt
(Advanced Package Tool). The essential commands for installing, updating, and managing software packages are here.
Task | Command |
---|---|
Update package lists | sudo apt update |
Upgrade all packages | sudo apt upgrade |
Install a package | sudo apt install [package_name] |
Remove a package | sudo apt remove [package_name] |
Search for a package | apt search [keyword] |
Display package details | apt show [package_name] |
System Monitoring Commands
Monitoring system performance and resource usage is critical for maintaining an optimal operating environment. Use these commands to check system health and activity.
Task | Command |
---|---|
View active processes | top or htop |
Check disk space usage | df -h |
Display memory usage | free -m |
Monitor all system activity | vmstat 1 |
Network Management Commands
Managing network settings and troubleshooting connectivity issues are common tasks for Ubuntu users. These commands simplify network operations.
Task | Command |
---|---|
Display all network interfaces | ifconfig or ip a |
Scan network for devices | sudo nmap -sn [network/CIDR] |
Display routing table | route -n |
Test connectivity to a host | ping [hostname_or_IP] |
File Management Commands
File management is often performed through the command line when using Ubuntu. Here are some commands to handle files effectively.
Task | Command |
---|---|
List directory contents | ls -al |
Change directory | cd [directory_path] |
Copy a file or directory | cp [source] [destination] |
Move or rename a file | mv [source] [destination] |
Delete a file | rm [file_name] |
Delete a directory | rm -r [directory_name] |
User Management Commands
Creating and managing user accounts is a key aspect of system administration. These commands allow you to control user access and privileges.
Task | Command |
---|---|
Add a new user | sudo adduser [new_username] |
Delete a user | sudo deluser [username] |
Add user to a group | sudo usermod -aG [group] [username] |
Change user password | sudo passwd [username] |
List user information | id [username] |
Wrapping Up
This Ubuntu cheat sheet covers a range of fundamental commands necessary for daily operations, system monitoring, and administrative tasks. Mastery of these commands can significantly enhance your productivity and system management capabilities. Keep practising these commands, explore more advanced options, and share your experiences to deepen your understanding and contribute to the community’s collective knowledge.
You May Also Be Interested In
References
Refer to the official Ubuntu documentation for a comprehensive view and updates on Ubuntu commands.