Command Line Essentials
Package Management Commands
1. Updating Package Lists
Before installing any software, always update your package lists:
sudo apt update
2. Searching for Packages
Find packages using the search command:
apt search <package-name>
3. Installing Packages
Basic Installation
sudo apt install <package-name>
Installing Multiple Packages
sudo apt install package1 package2 package3
Package Management Operations
graph TD
A[Package Management Commands] --> B[Update]
A --> C[Search]
A --> D[Install]
A --> E[Remove]
A --> F[Upgrade]
Key Command Reference
| Command |
Purpose |
Example |
apt update |
Refresh package lists |
sudo apt update |
apt search |
Find packages |
apt search nginx |
apt install |
Install packages |
sudo apt install git |
apt remove |
Remove packages |
sudo apt remove firefox |
apt upgrade |
Upgrade system packages |
sudo apt upgrade |
Advanced Package Management
Removing Packages
## Remove package
## Remove package with configuration
Cleaning Up
## Remove unnecessary packages
sudo apt autoremove
## Clear package cache
sudo apt clean
Best Practices in LabEx Environment
- Always run commands with
sudo for system-level operations
- Update package lists before installation
- Use
apt search to find exact package names
- Verify package requirements before installation
Troubleshooting Common Issues
Handling Dependency Conflicts
## Force install with dependencies
sudo apt -f install
Handling Repository Issues
## Fix broken repositories
sudo apt-get update --fix-missing