LINUX ADMINISTRATION SKILLS FOR USER, NETWORK, and SERVICES
1. USER ADMINISTRATION
User Management
|
Command |
Description |
|
sudo useradd -m username |
Create a new user |
|
sudo passwd username |
Set user password |
|
sudo usermod -aG group username |
Add user to group |
|
sudo usermod -L username |
Lock user account |
|
sudo usermod -U username |
Unlock user account |
|
sudo userdel -r username |
Delete user with home |
Group Management
|
Command |
Description |
|
sudo groupadd groupname |
Create a new group |
|
sudo groupdel groupname |
Delete a group |
|
groups username |
Show user's groups |
|
sudo gpasswd -d username group |
Remove user from group |
Permissions
|
Command |
Description |
|
ls -l |
List permissions |
|
chmod 755 file |
Change permissions |
|
chown user:group file |
Change owner and group |
|
chown -R user:group /dir |
Change owner recursively |
Privilege / Sudo
|
Command |
Description |
|
sudo -l |
List sudo privileges |
|
sudo visudo |
Edit sudoers file safely |
|
sudo -u user command |
Run command as another user |
|
sudo -i |
Switch to root user |
Important Files
-
/etc/passwd— User account information -
/etc/shadow— Password hashes -
/etc/group— Group information -
/etc/sudoers— Sudo configuration -
/etc/hosts— Hostname mapping -
/etc/ssh/sshd_config— SSH server configuration
2. NETWORK ADMINISTRATION
IP & Interface Management
|
Command |
Description |
|
ip addr |
Show all IP addresses |
|
ip link |
Show interface status |
|
sudo ip link set eth0 up |
Bring interface up |
|
sudo ip link set eth0 down |
Bring interface down |
|
sudo ip addr add 192.168.1.100/24 dev eth0 |
Add IP address |
|
sudo ip addr del 192.168.1.100/24 dev eth0 |
Remove IP address |
Routing
|
Command |
Description |
|
ip route |
Show routing table |
|
sudo ip route add default via 192.168.1.1 |
Add default gateway |
|
sudo ip route add 10.10.0.0/16 via 192.168.1.1 |
Add route |
|
sudo ip route del 10.10.0.0/16 |
Delete route |
Network Testing
|
Command |
Description |
|
ping 8.8.8.8 |
Test connectivity |
|
nslookup google.com |
DNS lookup |
|
dig google.com |
DNS query (detailed) |
|
curl -I https://example.com |
Test HTTP/HTTPS |
|
traceroute 8.8.8.8 |
Trace network path |
Network Utilities
|
Command |
Description |
|
ss -tuln |
Show listening ports |
|
ss -tulpn |
Show ports with process |
|
nc -zv 192.168.1.10 80 |
Test TCP port |
|
nmcli device status |
Show network devices |
|
nmcli connection show |
Show connections |
Important Files
-
/etc/resolv.conf— DNS configuration -
/etc/hosts— Local hostname mapping -
/etc/hostname— System hostname -
/etc/network/— Network configuration files -
/etc/sysconfig/network-scripts/— Network scripts (RHEL/CentOS)
3. SERVICES ADMINISTRATION
Service Management (systemd)
|
Command |
Description |
|
systemctl status service |
Check service status |
|
sudo systemctl start service |
Start service |
|
sudo systemctl stop service |
Stop service |
|
sudo systemctl restart service |
Restart service |
|
sudo systemctl reload service |
Reload service |
|
sudo systemctl enable service |
Enable at boot |
|
sudo systemctl disable service |
Disable at boot |
|
sudo systemctl enable --now service |
Enable and start |
Service Information
|
Command |
Description |
|
systemctl is-active service |
Check if running |
|
systemctl is-enabled service |
Check if enabled |
|
systemctl --type=service --state=running |
List running services |
|
systemctl --failed |
List failed services |
Logs (journalctl)
|
Command |
Description |
|
journalctl -u service |
Logs of a service |
|
journalctl -u service -f |
Follow logs live |
|
journalctl -b |
Logs since boot |
|
journalctl -b -1 |
Logs from previous boot |
Process Management
|
Command |
Description |
|
ps aux |
Show all processes |
|
top / htop |
Monitor processes |
|
pgrep process |
Find process ID |
|
kill PID |
Kill process |
|
pkill process |
Kill by name |
Package Management
For Debian / Ubuntu (APT)
|
Command |
Description |
|
sudo apt update |
Update repositories |
|
sudo apt upgrade |
Upgrade packages |
|
sudo apt install package |
Install package |
|
sudo apt remove package |
Remove package |
For RHEL / CentOS / Rocky (DNF)
|
Command |
Description |
|
sudo dnf update |
Update repositories |
|
sudo dnf install package |
Install package |
|
sudo dnf remove package |
Remove package |
|
sudo dnf search package |
Search package |
