Comandos Linux/Ubuntu

Versão
lsb_release -a
Kernel
uname -r
Hardware
lscpu
free -h
lsblk
Uptime
uptime
CPU / Memória
htop
--- Status de interfaces
ip address show
Interface detalhada
ip addr show ens33
ethtool ens33
DDM / Transceiver
ethtool -m ens33
--- Status geral de rede
ss -tulnp
Status da interface
ip link show ens33
Estatísticas da interface
ip -s link show ens33
Gateway padrão
ip route
DNS configurado
cat /etc/resolv.conf
--- Usuários logados
who
Usuário atual
whoami
Informações completas do sistema
hostnamectl
RX/TX da interface
ifconfig ens33
Estado das interfaces
ip link
Estatísticas em tempo real
sar -n DEV 1
--- Entrar como root
sudo -i
Ativar interface
sudo ip link set ens33 up
Desativar interface
sudo ip link set ens33 down
Reiniciar rede
sudo systemctl restart NetworkManager
--- Atualizar pacotes
sudo apt update && sudo apt upgrade -y
Instalar pacote
sudo apt install nginx
Remover pacote
sudo apt remove nginx
Buscar pacote
apt search nginx
--- Adicionar usuário
sudo adduser gustavo
Alterar senha
sudo passwd gustavo
Deletar usuário
sudo deluser gustavo
Alterar permissões
chmod 755 arquivo.sh
Alterar proprietário
chown usuario:grupo arquivo.txt
--- Criar diretório
mkdir backup
Mover arquivo
mv arquivo.txt /backup/
Copiar arquivo
cp arquivo.txt /backup/
Remover arquivo
rm arquivo.txt
Compactar ZIP
zip backup.zip arquivo.txt
Descompactar ZIP
unzip backup.zip
--- Tabela ARP / MAC
arp -a
Conexões abertas
ss -tunap
Portas em escuta
netstat -lntp
--- Logs do sistema
journalctl -xe
Logs em tempo real
tail -f /var/log/syslog
Alarmes / erros
dmesg | less
--- Ping
ping 8.8.8.8
Traceroute
traceroute 1.1.1.1
DNS lookup
nslookup google.com
Teste HTTP
curl ifconfig.me
--- Serviços ativos
systemctl list-units --type=service
Reiniciar serviço
sudo systemctl restart apache2
Parar serviço
sudo systemctl stop apache2
Iniciar serviço
sudo systemctl start apache2
Habilitar serviço no boot
sudo systemctl enable apache2
--- Salvar configuração Netplan
sudo netplan apply
Reiniciar sistema
reboot
Desligar sistema
shutdown now

Leave A Comment