DevOps · Júnior

Linux e terminal: o mínimo que todo DevOps domina

Quase tudo no mundo DevOps acontece em servidores Linux, e a porta de entrada para esses servidores é o terminal. Dominar a linha de comando não é um detalhe de curiosidade técnica: é a ferramenta com a qual você inspeciona, corrige e automatiza sistemas todos os dias. Quem se sente confortável no terminal trabalha mais rápido e entende melhor o que está acontecendo por baixo das interfaces gráficas.

Por que o terminal é onde o trabalho acontece

Servidores em produção raramente têm interface gráfica: você acessa por SSH e só tem o shell. Scripts, pipelines de CI/CD e containers também executam comandos de terminal. Aprender a se virar ali é o que separa quem depende de tutoriais de quem resolve problemas sozinho.

Hierarquia de arquivos (o essencial)

O Linux organiza tudo a partir da raiz /. Você não precisa decorar tudo, mas alguns diretórios aparecem o tempo todo:

  • /etc — arquivos de configuração do sistema e serviços.
  • /var/log — logs (o primeiro lugar para investigar problemas).
  • /home — diretórios dos usuários.
  • /usr/bin e /bin — executáveis.

Permissões: rwx, dono e grupo

Cada arquivo tem permissões de leitura (r), escrita (w) e execução (x), divididas em três grupos: dono, grupo e outros. É comum em entrevista pedir para explicar o que significa chmod 755 — então vale entender a lógica numérica (r=4, w=2, x=1).

Almost everything in the DevOps world happens on Linux servers, and the way in to those servers is the terminal. Mastering the command line isn't a technical curiosity: it's the tool you use to inspect, fix and automate systems every day. People who are comfortable in the terminal work faster and better understand what's going on beneath graphical interfaces.

Why the terminal is where the work happens

Production servers rarely have a graphical interface: you log in over SSH and all you have is the shell. Scripts, CI/CD pipelines and containers also run terminal commands. Learning to find your way around there is what separates those who depend on tutorials from those who solve problems on their own.

File hierarchy (the essentials)

Linux organizes everything starting from the root /. You don't need to memorize it all, but a few directories show up all the time:

  • /etc — system and service configuration files.
  • /var/log — logs (the first place to look when investigating problems).
  • /home — user directories.
  • /usr/bin and /bin — executables.

Permissions: rwx, owner and group

Every file has read (r), write (w) and execute (x) permissions, split into three groups: owner, group and others. Interviewers often ask you to explain what chmod 755 means — so it's worth understanding the numeric logic (r=4, w=2, x=1).

ls -l script.sh
# -rwxr-xr-x 1 deploy devops 512 jun 25 10:00 script.sh

chmod 750 script.sh        # dono: rwx, grupo: r-x, outros: nada
chown deploy:devops script.sh   # muda dono e grupo

Processos: ver e encerrar

No dia a dia isso aparece quando um serviço trava ou consome CPU demais. Você lista os processos, identifica o PID e, se necessário, encerra.

Processes: viewing and terminating

In day-to-day work this comes up when a service hangs or uses too much CPU. You list the processes, identify the PID and, if needed, terminate it.

ps aux | grep nginx     # encontra o processo
top                     # uso de CPU/memória ao vivo
kill 4821               # pede para o processo terminar (SIGTERM)
kill -9 4821            # força o encerramento (SIGKILL)

Pipes e redirecionamento

Esta é a filosofia do Unix: programas pequenos que fazem uma coisa bem, conectados entre si. O pipe | manda a saída de um comando para a entrada do próximo. O > grava em arquivo (sobrescrevendo) e >> adiciona ao final.

Pipes and redirection

This is the Unix philosophy: small programs that do one thing well, connected to each other. The pipe | sends the output of one command to the input of the next. > writes to a file (overwriting) and >> appends to the end.

cat /var/log/app.log | grep ERROR | wc -l   # conta linhas com ERROR
ls -l > lista.txt                            # salva a saída
echo "deploy ok" >> historico.log           # acrescenta ao arquivo
Pense no terminal como uma linha de montagem: cada comando é uma estação que recebe algo, transforma e passa adiante. O poder não está em um comando gigante, mas na combinação de comandos simples.

Variáveis de ambiente

Variáveis de ambiente configuram o comportamento de programas sem mudar código — usadas o tempo todo para senhas, URLs e flags em containers e pipelines.

Think of the terminal as an assembly line: each command is a station that receives something, transforms it and passes it along. The power isn't in one giant command, but in combining simple ones.

Environment variables

Environment variables configure how programs behave without changing code — used all the time for passwords, URLs and flags in containers and pipelines.

export ENV=producao        # define a variável
echo $ENV                  # lê o valor
printenv | grep PATH       # lista variáveis e filtra

Gerenciador de pacotes

Instalar software no Linux é feito por gerenciadores de pacotes, que cuidam de dependências e atualizações. O comando varia conforme a distribuição:

DistribuiçãoGerenciadorInstalar
Debian/Ubuntuaptapt install git
RHEL/Fedoradnfdnf install git
Alpineapkapk add git

Conclusão

O terminal é a habilidade de base que sustenta todo o resto: Git, CI/CD, containers e a operação de servidores. Não precisa decorar tudo — precisa entender a lógica e saber onde procurar. Com permissões, processos, pipes e variáveis na ponta dos dedos, você já resolve a maior parte do trabalho diário de um DevOps júnior.

Package manager

Software on Linux is installed through package managers, which handle dependencies and updates. The command varies by distribution:

DistributionManagerInstall
Debian/Ubuntuaptapt install git
RHEL/Fedoradnfdnf install git
Alpineapkapk add git

Conclusion

The terminal is the foundational skill that supports everything else: Git, CI/CD, containers and server operations. You don't need to memorize everything — you need to understand the logic and know where to look. With permissions, processes, pipes and variables at your fingertips, you can already handle most of a junior DevOps engineer's daily work.

Leia também

Voltar à trilha