Basic commands for Debian system administration
Debian is a Linux operating system widely used on servers and workstations. As a Debian system administrator, it is essential 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 efficiently administer and maintain a Debian system.
1. System Information Commands
-
uname -a: Displays detailed information about the system, such as kernel name, architecture and hostname. -
lsb_release -a: Displays information about the installed Debian distribution, such as version and description. -
df -h: Displays the used and available disk space on all partitions of the system. -
free -h: Displays the used and available RAM on the system.
2. User and Group Management
-
adduser nombre_usuario: Creates a new user in the system. -
usermod -aG grupo nombre_usuario: Adds a user to a specific group. -
deluser nombre_usuario: Remove a user from the system. -
addgroup nombre_grupo: Creates a new group in the system.
3. Package Management
-
apt update: Updates the list of available packages in the repositories. -
apt upgrade: Upgrades installed packages to the latest versions. -
apt install nombre_paquete: Installs a specific package. -
apt remove nombre_paquete: Uninstall a package from the system. -
apt search nombre_paquete: Searches for packages related to a specific term.
4. Service Management
-
systemctl status nombre_servicio: Shows the status of a service. -
systemctl start nombre_servicio: Starts a service. -
systemctl stop nombre_servicio: Stops a service. -
systemctl restart nombre_servicio: Restart a service. -
systemctl enable nombre_servicio: Enables a service to start automatically on system startup. -
systemctl disable nombre_servicio: Disables a service to start automatically at system startup.
5. Network Configuration
-
ifconfig: Displays information about the configured network interfaces. -
ip addr: Displays more detailed information about the network interfaces and their IP addresses. -
ping dirección_ip: Sends ICMP packets to an IP address to verify network connectivity. -
nslookup nombre_host: 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 to the current directory. -
cd ruta_directorio: Changes to the specified directory. -
mkdir nombre_directorio: Creates a new directory. -
rm nombre_archivo: Deletes a file. -
rm -r nombre_directorio: Removes a directory and its contents recursively.
7. Compress and Decompress Files
-
tar -cvf archivo.tar directorio: Creates a tar archive from a directory. -
tar -xvf archivo.tar: Extracts the contents of a tar archive. -
gzip archivo: Compress a file in gzip format. -
gunzip archivo.gz: Unzip a compressed file in gzip format.
8. Process Management
-
ps: Displays a list of the processes currently running on the system. -
ps aux: Displays a more detailed list of all processes in the system, including those of other users. -
top: Provides a dynamic, real-time view of running processes, with regularly updated information. -
htop: An enhanced version oftopthat displays processes in a more readable format and allows you to interact with them more easily. -
kill PID: Terminates (kills) a specific process using its process identifier (PID). -
killall nombre_proceso: Kill all processes with 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 less system resources. -
renice: Changes the priority of a running process. It is useful to adjust the priority of running processes in real time.