Linux
Package Management
Install, update, and search packages on Debian and RHEL.
By EZ4Code Team
packageaptdnf
Code
# Debian/Ubuntu (APT)
sudo apt update
sudo apt install -y nginx
sudo apt upgrade
sudo apt remove --purge nginx
apt search redis
apt show nginx
# RHEL/Fedora (DNF/YUM)
sudo dnf install -y nginx
sudo dnf update
sudo dnf remove nginx
dnf search redis
# Find which package provides a file
dpkg -S /usr/bin/curl # Debian
rpm -qf /usr/bin/curl # RHEL
# List installed files
dpkg -L nginx
rpm -ql nginx
# Hold a package from upgrades
sudo apt-mark hold nginx
sudo apt-mark unhold nginxExplanation
APT (Debian/Ubuntu) and DNF (RHEL/Fedora) install, update, and remove packages from repositories. apt update refreshes indexes before apt upgrade applies updates. dpkg -S and rpm -qf identify which package owns a file, while apt-mark hold pins a version to prevent unintended upgrades.
More Linux Snippets
File Operations
Copy, move, link, and search files efficiently.
Permissions & Ownership
Manage read/write/execute bits with chmod and chown.
Process Management
List, signal, and monitor running processes.
Networking
Inspect interfaces, ports, connections, and DNS.
Text Processing
Filter, transform, and summarize text streams.
Disk Usage
Inspect filesystems, large directories, and inodes.