List Detailed Files
Lists all files including hidden ones with permission, size, and date details
ls -lahWhen to useWhen you need to view all files with detailed information, including hidden files (starting with .)
DevOps
Lose the fear of the black screen. Navigate folders, manage files and control the server without touching the mouse. Survival basics.
Fundamental commands for navigating and manipulating files and directories on Linux.
Lists all files including hidden ones with permission, size, and date details
ls -lahWhen to useWhen you need to view all files with detailed information, including hidden files (starting with .)
Copies directories and their content recursively, preserving attributes
cp -r /origem /destinoWhen to useFor backing up entire directories or duplicating folder structures
Moves files/directories or renames if destination is in the same directory
mv arquivo.txt /novo/caminho/
mv arquivo_antigo.txt arquivo_novo.txtWhen to useTo organize files or rename them directly via the terminal
Locates files in the system recursively using glob patterns
find /caminho -name "*.log"
find . -type f -name "config*"When to useWhen you need to locate specific files in large directory structures
Creates multiple levels of directories at once
mkdir -p /projeto/src/components/uiWhen to useTo quickly create complex folder structures without needing to create each level manually
File and directory access control using chmod, chown, and umask.
Sets permissions using octal notation (rwx = 7, rw- = 6, r-x = 5)
chmod 755 script.sh
chmod 644 arquivo.txtWhen to use755 for executables (rwxr-xr-x), 644 for data files (rw-r--r--)
Modifies permissions using symbolic notation (u=user, g=group, o=others)
chmod u+x script.sh
chmod go-w arquivo.txtWhen to useWhen you want to modify specific permissions without changing others
Changes the owner and group of files/directories recursively
chown -R usuario:grupo /var/www/htmlWhen to useTo correct permissions after deployment or web server configuration
Displays file permissions in numeric format
stat -c '%a %n' arquivo.txtWhen to useTo quickly check the numeric value of current permissions
Monitoring, controlling, and manipulating running processes on the system.
Displays all processes of the current user with CPU and memory details
ps aux | grep usuario
ps -ef | grep nginxWhen to useTo identify PIDs of specific processes or diagnose resource usage
Interactive interface with real-time process updates
top
htopWhen to useFor continuous monitoring of CPU, memory, and identifying problematic processes
Terminates process using different signal levels
kill 1234
kill -9 1234
kill -SIGTERM 1234When to usekill for graceful termination, kill -9 to force immediate termination
Terminates all processes matching the name
pkill nginx
killall nodeWhen to useWhen you know the process name but not the PID
Starts process in the background, freeing up the terminal
npm run dev &
nohup python3 script.py &When to useTo run long scripts without blocking the terminal (nohup keeps it running after logout)
Tools for network diagnostics, file transfer, and connectivity testing.
Sends ICMP packets to check if the host is reachable
ping -c 4 google.com
ping 192.168.1.1When to useTo check network connectivity and latency (-c limits the number of packets)
Downloads files from the web via HTTP/HTTPS
wget https://example.com/file.zip
curl -O https://example.com/file.tar.gzWhen to usewget for simple downloads, curl for APIs and more complex requests
Lists all open TCP/UDP ports and associated processes
netstat -tulpn
ss -tulpnWhen to useTo identify port conflicts or check if a service is listening
Copies files between machines via SSH
scp arquivo.txt user@servidor:/path/
scp -r /pasta user@servidor:/destinoWhen to useTo securely transfer files between servers (use -r for directories)
Discovers the machine's public IP address
curl ifconfig.me
wget -qO- ifconfig.meWhen to useTo know your public IP when working remotely or configuring firewalls
Installing, updating, and removing software using package managers (APT/YUM).
Synchronizes the list of available packages with repositories
sudo apt updateWhen to useAlways before installing new packages to ensure updated versions
Downloads and installs package with all dependencies
sudo apt install nginx -yWhen to useTo install software via official repositories (-y automatically confirms)
Updates all installed packages to newer versions
sudo apt update && sudo apt upgrade -yWhen to useRegular system maintenance for security patches and improvements
Uninstalls package, keeping configuration files
sudo apt remove pacote
sudo apt purge pacoteWhen to useremove keeps configs, purge removes everything (useful for clean reinstallation)
Searches for available packages in repositories
apt search python3
apt-cache search nodejsWhen to useTo find the exact package name before installing
Commands for getting hardware, OS, and resource usage information.
Displays used and available space on all mounted partitions
df -hWhen to useTo check for sufficient disk space (-h displays in human-readable format)
Calculates total size of directories and files
du -sh /var/log
du -h --max-depth=1 /homeWhen to useTo identify which directories are consuming the most space
Shows RAM and swap usage in human-readable format
free -hWhen to useTo diagnose memory issues or check if swap is being used
Displays processor details (model, cores, frequency)
lscpu
cat /proc/cpuinfoWhen to useTo check hardware specifications before optimizations
Shows how long the system has been running and average load
uptimeWhen to useTo check server stability and load average
Identifies Linux distribution and kernel version
uname -a
cat /etc/os-releaseWhen to useTo document environment or check software compatibility