Print the absolute path of the current directory
pwdA quick reference for everyday file, permission, process, network and archive commands on mainstream Linux distributions.
Print the absolute path of the current directory
pwdList all files including hidden ones, with human-readable sizes
ls -alhChange into a directory; cd - returns to the previous one
cd /var/logCopy a directory recursively
cp -r /opt/app /backup/appMove or rename a file
mv /data/app.log /data/app.log.bakForce-delete a directory recursively; double-check the path first
rm -rf /data/cacheCreate nested directories, creating parents as needed
mkdir -p /data/app/logsCreate a symbolic link, commonly used for version switching
ln -s /opt/app/v2 /opt/app/currentFind log files modified more than 7 days ago
find /var/log -name "*.log" -mtime +7Show directory sizes sorted by size
du -sh /data/* | sort -hShow OS release information
cat /etc/os-releasePage through a large file; press / to search and q to quit
less /etc/nginx/nginx.confFollow the last 200 lines of a log in real time
tail -f -n 200 /var/log/nginx/error.logShow the first 50 lines of a file
head -n 50 /etc/passwdSearch a directory recursively with line numbers
grep -rn "server_name" /etc/nginxLocate a command and show its version
which nginx && nginx -vSet mode 755: owner read/write/execute, others read/execute
chmod 755 /opt/app/start.shApply permissions recursively to a directory
chmod -R 775 /var/www/htmlChange owner and group recursively
chown -R www-data:www-data /var/wwwCreate a user with a home directory and bash shell
useradd -m -s /bin/bash deployChange the password of a user
passwd deployShow current UID, GID and group memberships
idShow running processes matching a keyword
ps aux | grep nginxPrint a one-shot snapshot of top CPU/memory processes
top -b -n 1 | head -n 20Gracefully terminate a process; -9 forces a kill and may lose data
kill -15 12345Check service status and recent log lines
systemctl status nginxEnable at boot and start the service now
systemctl enable --now nginxFollow the last hour of logs for a service
journalctl -u nginx -f --since "1 hour ago"Show memory and swap usage
free -hShow disk usage and filesystem types
df -hTShow uptime and load average
uptimeShow network interfaces and IP addresses
ip addrList listening TCP/UDP ports with processes
ss -tunlpSend 4 ICMP packets to test connectivity
ping -c 4 8.8.8.8Fetch response headers only to check availability
curl -I https://example.comCopy a directory over SSH recursively
scp -r /data/dist deploy@10.0.0.12:/opt/appLog in to a remote host on a specific port
ssh -p 22 deploy@10.0.0.12Create a gzip-compressed tarball
tar -czf app.tar.gz /opt/appExtract into a target directory
tar -xzf app.tar.gz -C /optList archive contents without extracting
tar -tzf app.tar.gz | headCreate a zip archive for Windows compatibility
zip -r app.zip /opt/appThis website uses cookies to ensure you get the best experience on our website. Privacy Policy.