Basic commands for Debian system administration
Debian is a Linux operating system widely used in servers and workstations. As a systems administrator on Debian, it is fundamental to be familiar with the basic commands to perform maintenance, configuration, and monitoring tasks. This manual will provide you with a practical guide to the essential commands that will allow you to manage and maintain a Debian system efficiently.
1. System Information Commands
-
uname -a: Displays detailed information about the system, such as the kernel name, architecture, and hostname. -
lsb_release -a: Displays information about the installed Debian distribution, such as the version and description. -
df -h: Displays used and available disk space on all system partitions. -
free -h: Displays used and available RAM memory in the system.
2. User and Group Management
-
adduser username: Creates a new user on the system. -
usermod -aG group username: Adds a user to a specific group. -
deluser username: Deletes a user from the system. -
addgroup group_name: Creates a new group on the system.
3. Package Management
-
apt update: Updates the list of available packages in the repositories. -
apt upgrade: Updates installed packages to the most recent versions. -
apt install package_name: Installs a specific package. -
apt remove package_name: Uninstalls a package from the system. -
apt search package_name: Searches for packages related to a specific term.
4. Service Management
-
systemctl status service_name: Displays the status of a service. -
systemctl start service_name: Starts a service. -
systemctl stop service_name: Stops a service. -
systemctl restart service_name: Restarts a service. -
systemctl enable service_name: Enables a service to start automatically at system boot. -
systemctl disable service_name: Disables a service from starting automatically at system boot.
5. Network Configuration
-
ifconfig: Displays information about the configured network interfaces. -
ip addr: Displays more detailed information about network interfaces and their IP addresses. -
ping ip_address: Sends ICMP packets to an IP address to verify network connectivity. -
nslookup hostname: Performs a DNS query to obtain the IP address associated with a hostname.
6. File and Directory Management
-
ls: Lists the contents of the current directory. -
pwd: Displays the path of the current directory. -
cd directory_path: Changes to the specified directory. -
mkdir directory_name: Creates a new directory. -
rm file_name: Deletes a file. -
rm -r directory_name: Deletes a directory and its contents recursively.
7. Compressing and Decompressing Files
-
tar -cvf file.tar directory: Creates a tar archive from a directory. -
tar -xvf file.tar: Extracts the contents of a tar archive. -
gzip file: Compresses a file in gzip format. -
gunzip file.gz: Decompresses a file compressed in gzip format.
8. Process Management
-
ps: Displays a list of processes currently running on the system. -
ps aux: Displays a more detailed list of all processes on the system, including those of other users. -
top: Provides a dynamic, real-time view of running processes, with periodically updated information. -
htop: An improved version oftopthat displays processes in a more readable format and allows interacting with them more easily. -
kill PID: Terminates (kills) a specific process using its process identifier (PID). -
killall process_name: Terminates all processes that have the same name. Be careful when using it, as it can stop important processes. -
nice: Adjusts the priority of a process. You can use it to change the priority of a process and give it more or fewer system resources. -
renice: Changes the priority of a running process. It is useful for adjusting the priority of processes running in real time.