Linux Server Commands
Search Results
Linux Server Commands
System Info
htop
Interactive process and system monitor.
htop
df -h
Show disk space usage in human-readable format.
df -h
free -h
Display memory usage in human-readable format.
free -h
uptime
Show system uptime and load average.
uptime
lscpu
Display CPU architecture information.
lscpu
Services
systemctl status <service>
Check status of a systemd service.
systemctl status nginx
systemctl start <service>
Start a systemd service.
systemctl start nginx
systemctl stop <service>
Stop a systemd service.
systemctl stop nginx
systemctl restart <service>
Restart a systemd service.
systemctl restart nginx
systemctl enable <service>
Enable service to start at boot.
systemctl enable nginx
Network
netstat -tulpn
Show listening ports and associated processes.
netstat -tulpn | grep :80
ss -tulpn
Modern replacement for netstat to show sockets.
ss -tulpn | grep :443
iptables -L
List all iptables firewall rules.
iptables -L -n
ufw status
Show UFW firewall status and rules.
ufw status verbose
ping -c 4 <host>
Test network connectivity to a host.
ping -c 4 google.com
curl -I <url>
Check HTTP headers and response status.
curl -I https://example.com
Security & Users
sudo -i
Switch to root user with environment.
sudo -i
sudo su - <username>
Switch to another user account.
sudo su - www-data
passwd <username>
Change password for a user.
passwd john
useradd -m -s /bin/bash <username>
Create new user with home directory.
useradd -m -s /bin/bash developer
usermod -aG sudo <username>
Add user to sudo group.
usermod -aG sudo developer
chmod 755 <file/directory>
Set file/directory permissions.
chmod 755 /var/www/html
chown -R <user>:<group> <directory>
Change ownership of files/directories.
chown -R www-data:www-data /var/www
Process Management
ps aux
List all running processes.
ps aux | grep nginx
kill -9 <pid>
Force kill a process by PID.
kill -9 1234
killall <process_name>
Kill all processes by name.
killall nginx
nohup <command> &
Run command in background, immune to hangups.
nohup python3 app.py &
screen -S <session_name>
Create a new screen session.
screen -S myapp
tmux new-session -s <session_name>
Create a new tmux session.
tmux new-session -s development
Logs & Monitoring
journalctl -u <service> -f
Follow systemd service logs in real-time.
journalctl -u nginx -f
tail -f /var/log/syslog
Follow system log in real-time.
tail -f /var/log/syslog
dmesg | tail
Show recent kernel messages.
dmesg | tail -20
who
Show who is currently logged in.
who
last
Show last logged in users.
last -10