🌐 Detecting your location…
📢 Advertisement — Configure AdSense in Appearance → Customize → AdSense Settings

Guia completo de comandos do Linux 2026: comandos essenciais para desenvolvedores

⏱️6 min read  ·  1,171 words

Os comandos do Linux são a base da administração de servidores, DevOps e fluxos de trabalho de desenvolvimento. Quer você seja um desenvolvedor iniciante ou experiente, este guia abrangente de comandos do Linux para 2026 cobre tudo que você precisa para a produtividade diária.

Navegação e gerenciamento de arquivos

# Navigation
pwd                    # print working directory
cd /var/log            # change directory
cd ~                   # go to home
cd -                   # go to previous directory
ls -la                 # list with permissions and hidden files
ls -lh                 # human-readable file sizes
tree -L 2              # directory tree (2 levels deep)

# File operations
cp file.txt backup.txt          # copy
cp -r dir/ backup_dir/          # copy directory recursively
mv old_name.txt new_name.txt    # rename/move
rm file.txt                     # delete file
rm -rf directory/               # delete directory (careful!)
mkdir -p projects/myapp/src     # create nested dirs
touch newfile.txt               # create empty file
ln -s /path/to/target link_name # create symbolic link

Conteúdo do arquivo

cat file.txt               # display file content
less file.txt              # paginated view (q to quit)
head -n 20 file.txt        # first 20 lines
tail -n 50 file.txt        # last 50 lines
tail -f /var/log/app.log   # follow log file in real-time
wc -l file.txt             # count lines
wc -w file.txt             # count words

# File stats
file image.png             # determine file type
stat file.txt              # detailed file info (size, timestamps)
du -sh *                   # disk usage of each item
df -h                      # disk free space on all mounts

Ferramentas elétricas de processamento de texto

# grep — search file content
grep "error" /var/log/app.log        # find lines with "error"
grep -i "Error" file.txt             # case-insensitive
grep -r "TODO" ./src/                # recursive search
grep -n "pattern" file.txt           # show line numbers
grep -v "debug" app.log              # exclude matching lines
grep -E "error|warning" app.log      # extended regex

# sed — stream editor
sed 's/old/new/g' file.txt           # replace all occurrences
sed -i 's/foo/bar/g' file.txt        # edit file in-place
sed -n '10,20p' file.txt             # print lines 10-20
sed '/^#/d' config.txt               # delete comment lines

# awk — text processing
awk '{print $1}' data.txt            # print first column
awk -F: '{print $1}' /etc/passwd     # use : as delimiter
awk '$3 > 100 {print}' data.txt      # filter rows by column value
awk '{sum += $2} END {print sum}' data.txt  # sum a column

# sort and uniq
sort file.txt                         # alphabetical sort
sort -n numbers.txt                   # numeric sort
sort -rn numbers.txt                  # reverse numeric sort
sort -k2 data.txt                     # sort by second column
sort data.txt | uniq                  # remove duplicate lines
sort data.txt | uniq -c               # count occurrences

Gestão de Processos

# View processes
ps aux                     # all processes with details
ps aux | grep nginx        # find specific process
top                        # interactive process viewer
htop                       # better interactive viewer
pgrep -f "python"          # find process by name

# Control processes
kill 1234                  # send SIGTERM to PID 1234
kill -9 1234               # force kill (SIGKILL)
killall nginx              # kill all nginx processes
pkill -f "gunicorn"        # kill by process name pattern

# Background jobs
command &                  # run in background
jobs                       # list background jobs
fg %1                      # bring job 1 to foreground
bg %1                      # resume job 1 in background
nohup command &            # persist after terminal close
disown %1                  # detach job from terminal

# Process priority
nice -n 10 command         # run with lower priority (nice 10)
renice -n 5 -p 1234       # change priority of running process

Permissões e propriedade

# View permissions
ls -la                     # -rw-r--r-- format
stat file.txt              # octal permissions

# chmod — change permissions
chmod 755 script.sh        # rwxr-xr-x
chmod 644 file.txt         # rw-r--r--
chmod +x script.sh         # make executable
chmod -R 755 directory/    # recursive
chmod u+w,g-x file.txt    # symbolic mode

# chown — change ownership
chown user:group file.txt
chown -R www-data:www-data /var/www/

# Special permissions
chmod 4755 file            # setuid bit
chmod 1777 /tmp            # sticky bit

Comandos de rede

# Connectivity
ping google.com            # test connectivity
curl https://api.example.com/health  # HTTP request
curl -X POST -H "Content-Type: application/json"   -d '{"key":"value"}' https://api.example.com/data
wget https://example.com/file.zip    # download file

# Network info
ip addr show               # IP addresses (modern)
ifconfig                   # legacy IP info
ss -tulnp                  # open ports and services
netstat -tulnp             # same (older systems)
traceroute google.com      # trace network path
nslookup google.com        # DNS lookup
dig google.com             # detailed DNS query

# SSH
ssh user@server.com        # connect to server
ssh -i ~/.ssh/key.pem user@server.com  # with key file
scp file.txt user@server:/path/to/dest  # copy file to server
rsync -avz ./src/ user@server:/app/src/ # sync directory

Gerenciamento de Pacotes

# Ubuntu/Debian (apt)
sudo apt update                     # update package list
sudo apt upgrade                    # upgrade installed packages
sudo apt install nginx              # install package
sudo apt remove nginx               # remove package
sudo apt autoremove                 # remove unused dependencies
apt search nodejs                   # search packages
apt show package-name               # package details

# CentOS/RHEL (dnf)
sudo dnf update
sudo dnf install nginx
sudo dnf remove nginx

# Snap packages
snap install code --classic         # install VS Code

# Flatpak
flatpak install flathub org.gimp.GIMP

Disco e armazenamento

df -h                      # disk space overview
du -sh /var/log/           # size of directory
du -sh * | sort -rh        # sorted by size
lsblk                      # list block devices
fdisk -l                   # partition tables (as root)
mount                      # show mounted filesystems
findmnt                    # find mount points

# Find large files
find / -type f -size +100M 2>/dev/null | sort

# Monitor I/O
iostat -x 1                # I/O stats every second
iotop                      # per-process I/O

Informações e monitoramento do sistema

uname -a                   # kernel and OS info
lsb_release -a             # distribution info
hostname                   # system hostname
uptime                     # system uptime and load
free -h                    # RAM usage
vmstat 1                   # virtual memory stats
cat /proc/cpuinfo          # CPU details
lscpu                      # CPU architecture
lspci                      # PCI devices
dmesg | tail -50           # kernel messages

# System logs
journalctl -n 100          # last 100 log entries
journalctl -u nginx        # nginx service logs
journalctl -f              # follow system logs
journalctl --since "1 hour ago"  # recent logs

Atalhos e truques úteis

# History
history                    # show command history
!!                         # repeat last command
!nginx                     # repeat last command starting with nginx
Ctrl+R                     # reverse search history

# Redirection
command > file.txt         # redirect stdout (overwrite)
command >> file.txt        # redirect stdout (append)
command 2> errors.txt      # redirect stderr
command > out.txt 2>&1     # redirect both to file
command &> out.txt         # same (modern bash)

# Pipes and xargs
ls -la | grep ".log"       # pipe to grep
cat urls.txt | xargs curl  # curl each URL from file
find . -name "*.py" | xargs wc -l  # count lines in all .py files

# Screen/tmux — persist sessions
tmux new -s work           # new session named "work"
tmux attach -t work        # reconnect to session
Ctrl+B, D                  # detach from tmux
screen -S myapp            # start screen session

Aliases essenciais para adicionar ao .bashrc

# Add to ~/.bashrc
alias ll='ls -la --color=auto'
alias la='ls -A'
alias ..='cd ..'
alias ...='cd ../..'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias dk='docker'
alias dc='docker compose'
alias py='python3'

# Reload .bashrc
source ~/.bashrc

Os comandos do Linux dominados ao longo do tempo aumentam dramaticamente. Comece com navegação e operações de arquivo, avance para processamento de texto e rede e mantenha uma folha de dicas pessoal. O terminal é sua ferramenta de desenvolvimento mais poderosa.

✍️ Leave a Comment

Your email address will not be published. Required fields are marked *

🌐 Read in:🇬🇧 English🇩🇪 Deutsch🇧🇷 Português🇸🇦 العربية🇮🇳 हिन्दी🇧🇩 বাংলা