Command Reference
0 commands
7
Linux Categories
1
MySQL Category
Total Commands
1
Example Each

System Info

Inspect the OS, hardware, uptime and kernel

uname
Print system / kernel information.
$uname -a
hostnamectl
Show or set the system hostname and OS details.
$hostnamectl
uptime
How long the system has been running and load averages.
$uptime -p
lscpu
Display CPU architecture and core info.
$lscpu
free
Show memory and swap usage.
$free -h
lsb_release
Print distribution-specific information.
$lsb_release -a

Files & Directories

Navigate, create, move, find and inspect files

ls
List directory contents with details and hidden files.
$ls -lah /var/www
find
Search for files by name, type, size or modification time.
$find /etc -name "*.conf" -type f
cp
Copy files or directories recursively.
$cp -r /var/www/site /backup/site
mv
Move or rename files and directories.
$mv old_name.conf new_name.conf
tar
Archive and compress files.
$tar -czf backup.tar.gz /var/www/html
grep
Search text patterns inside files recursively.
$grep -r "ServerName" /etc/apache2/
tail
Monitor end of a file in real time.
$tail -f /var/log/apache2/error.log
ln
Create symbolic links between files.
$ln -s /etc/apache2/sites-available/site.conf /etc/apache2/sites-enabled/

Users & Permissions

Manage accounts, groups, and file ownership

useradd
Create a new user account with home directory.
#useradd -m -s /bin/bash jsmith
passwd
Set or change a user's password.
#passwd jsmith
usermod
Add a user to a supplementary group.
#usermod -aG www-data jsmith
chmod
Change file or directory permissions.
#chmod -R 775 /var/www/public_html
chown
Change file owner and group recursively.
#chown -R www-data:www-data /var/www/html
id
Show user ID, group ID and group memberships.
$id miked007
visudo
Safely edit the sudoers file to grant sudo access.
#visudo

Processes

Monitor, manage and kill running processes

top
Real-time view of CPU and memory usage by process.
$top
htop
Interactive process viewer with color and mouse support.
$htop
ps
Snapshot of all running processes.
$ps aux | grep apache2
kill
Terminate a process by its PID.
#kill -9 12345
nice / renice
Launch or change process scheduling priority.
#renice -n 10 -p 12345
journalctl
View systemd logs for a specific service.
#journalctl -xeu apache2.service

Networking

Inspect interfaces, connections, DNS and firewall

ip
Show IP addresses and network interfaces.
$ip a
ss
Show open ports and listening sockets.
$ss -tlnp
dig
DNS lookup for a domain.
$dig +short linuxadmin.streettechnyc.com
curl
Transfer data or test HTTP response headers.
$curl -sI https://streettechnyc.com
ufw
Manage the Uncomplicated Firewall rules.
#ufw allow 443/tcp
ping
Test network reachability to a host.
$ping -c 4 8.8.8.8

Services (systemd)

Start, stop, enable and inspect system services

systemctl status
Check if a service is running and see recent log lines.
#systemctl status apache2 --no-pager
systemctl restart
Fully restart a service (stop + start).
#systemctl restart mysql
systemctl reload
Reload config without dropping connections.
#systemctl reload apache2
systemctl enable
Enable a service to start automatically at boot.
#systemctl enable apache2
systemctl disable
Prevent a service from starting at boot.
#systemctl disable bluetooth
apache2ctl
Test Apache configuration for syntax errors.
#apache2ctl configtest

Disk & Storage

Check usage, partitions, mounts and I/O

df
Show disk space usage on all mounted filesystems.
$df -h
du
Find the size of a directory and its contents.
$du -sh /var/www/*
lsblk
List all block devices and partitions in a tree view.
$lsblk
mount
Mount a filesystem to a directory.
#mount /dev/sdb1 /mnt/data
iostat
Report CPU and disk I/O statistics.
$iostat -xz 1
rsync
Efficiently sync files locally or to a remote server.
$rsync -avz /var/www/ user@backup:/var/www/

MySQL Admin

Manage databases, users, backups and performance

mysql -u root -p
Log into the MySQL shell as root.
#mysql -u root -p
SHOW DATABASES
List all databases on the server.
>SHOW DATABASES;
CREATE DATABASE
Create a new database.
>CREATE DATABASE myapp CHARACTER SET utf8mb4;
CREATE USER
Create a new MySQL user with a password.
>CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'P@ssw0rd';
GRANT
Give a user full privileges on a specific database.
>GRANT ALL PRIVILEGES ON myapp.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES
Reload grant tables after permission changes.
>FLUSH PRIVILEGES;
SHOW TABLES
List all tables in the selected database.
>USE myapp; SHOW TABLES;
SHOW PROCESSLIST
View all active queries and connections.
>SHOW FULL PROCESSLIST;
mysqldump
Backup a database to a SQL file.
#mysqldump -u root -p myapp > myapp_backup.sql
mysql (restore)
Restore a database from a SQL dump file.
#mysql -u root -p myapp < myapp_backup.sql
DROP DATABASE
Permanently delete a database — use with caution.
>DROP DATABASE old_site;
SHOW VARIABLES
Inspect MySQL server configuration variables.
>SHOW VARIABLES LIKE 'max_connections';