- Update package lists:
sudo apt update
- Upgrade installed packages:
sudo apt upgrade -y
- Full distribution upgrade:
sudo apt full-upgrade -y
- Install a package:
sudo apt install <package-name>
- Remove a package:
sudo apt remove <package-name>
- Search for a package:
apt search <keyword>
- Show OS release info:
lsb_release -a
- Kernel version:
uname -r
- CPU info:
lscpu
- Memory usage:
free -h
- List block devices:
lsblk
- Check disk usage:
df -h
- Partition tool (cfdisk):
sudo cfdisk /dev/sda
- List running services:
systemctl list-units --type=service --state=running
- Start a service:
sudo systemctl start <service>
- Enable service at boot:
sudo systemctl enable <service>
- Check service status:
systemctl status <service>
- Show IP addresses:
ip addr show
- Test connectivity:
ping -c 4 8.8.8.8
- Modify
/etc/hosts:sudo nano /etc/hosts
- Add a new user:
sudo adduser <username>
- Add user to sudo group:
sudo usermod -aG sudo <username>
- Delete a user:
sudo deluser <username>
- Search file contents:
grep -r "search_term" /path/to/search - Find files by name:
find / -name "*.conf" 2>/dev/null
- Archive/Extract tarballs:
tar -czvf archive.tar.gz /path/to/dir # create tar -xzvf archive.tar.gz # extract
Tip: Use
apt-getandaptinterchangeably, butaptprovides a more user‑friendly output.