Linux Server Commands

Try searching for: "list", "docker run", "git branch", "remove directory"
Search Results

Linux Server Commands

System Info

htop

Interactive process and system monitor.

Example: htop
monitor processes system
df -h

Show disk space usage in human-readable format.

Example: df -h
disk space usage
free -h

Display memory usage in human-readable format.

Example: free -h
memory ram usage
uptime

Show system uptime and load average.

Example: uptime
uptime load system
lscpu

Display CPU architecture information.

Example: lscpu
cpu architecture info

Services

systemctl status <service>

Check status of a systemd service.

Example: systemctl status nginx
status service systemd
systemctl start <service>

Start a systemd service.

Example: systemctl start nginx
start service
systemctl stop <service>

Stop a systemd service.

Example: systemctl stop nginx
stop service
systemctl restart <service>

Restart a systemd service.

Example: systemctl restart nginx
restart service
systemctl enable <service>

Enable service to start at boot.

Example: systemctl enable nginx
enable boot service

Network

netstat -tulpn

Show listening ports and associated processes.

Example: netstat -tulpn | grep :80
network ports listening
ss -tulpn

Modern replacement for netstat to show sockets.

Example: ss -tulpn | grep :443
network sockets ports
iptables -L

List all iptables firewall rules.

Example: iptables -L -n
firewall iptables rules
ufw status

Show UFW firewall status and rules.

Example: ufw status verbose
firewall ufw status
ping -c 4 <host>

Test network connectivity to a host.

Example: ping -c 4 google.com
network connectivity ping
curl -I <url>

Check HTTP headers and response status.

Example: curl -I https://example.com
http test headers

Security & Users

sudo -i

Switch to root user with environment.

Example: sudo -i
sudo root privilege
sudo su - <username>

Switch to another user account.

Example: sudo su - www-data
sudo user switch
passwd <username>

Change password for a user.

Example: passwd john
password user security
useradd -m -s /bin/bash <username>

Create new user with home directory.

Example: useradd -m -s /bin/bash developer
user create account
usermod -aG sudo <username>

Add user to sudo group.

Example: usermod -aG sudo developer
user sudo permissions
chmod 755 <file/directory>

Set file/directory permissions.

Example: chmod 755 /var/www/html
permissions chmod security
chown -R <user>:<group> <directory>

Change ownership of files/directories.

Example: chown -R www-data:www-data /var/www
ownership chown permissions

Process Management

ps aux

List all running processes.

Example: ps aux | grep nginx
processes monitoring system
kill -9 <pid>

Force kill a process by PID.

Example: kill -9 1234
kill process force
killall <process_name>

Kill all processes by name.

Example: killall nginx
kill process name
nohup <command> &

Run command in background, immune to hangups.

Example: nohup python3 app.py &
background nohup process
screen -S <session_name>

Create a new screen session.

Example: screen -S myapp
screen session terminal
tmux new-session -s <session_name>

Create a new tmux session.

Example: tmux new-session -s development
tmux session terminal

Logs & Monitoring

journalctl -u <service> -f

Follow systemd service logs in real-time.

Example: journalctl -u nginx -f
logs systemd monitoring
tail -f /var/log/syslog

Follow system log in real-time.

Example: tail -f /var/log/syslog
logs syslog monitoring
dmesg | tail

Show recent kernel messages.

Example: dmesg | tail -20
kernel messages hardware
who

Show who is currently logged in.

Example: who
users logged security
last

Show last logged in users.

Example: last -10
users history security