Skip to content

rrozdoce/utils-linux-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

One of the best linux commands i know

📂 File and Directory Management

man # view command manual ex: man ls
touch # create a file ex: touch file.txt
mkdir -p # create directory ex: mkdir -p folder/subfolder
rm -f # permanently delete file/directory ex: rm -f file.txt
trash # requires "trash" package – moves file/directory to trash ex: trash file.txt
cp -r # copy file to directory ex: cp -r source/ destination/
mv    # move or rename files/directories ex: mv old.txt new.txt
ls -l # list files in detailed format
find  # search for files/directories ex: find /path -name "*.txt"

🔍 Search and View

grep # search for patterns in files ex: grep "text" file.txt
cat  # display file content ex: cat file.txt
less # view files with pagination (better than `cat` for large files) ex: less file.log
head -n # show first lines of file ex: tail -n 10 file.log
tail -n # show last lines of file

⚙️ System and Processes

ps aux # list running processes ex: ps aux | grep "nginx"
kill   # terminate a process ex: kill -9 PID
top    # monitor processes and resource usage ex: htop
htop   # ''''''''
df -h # show disk space ex: df -h
du -sh # display directory size ex: du -sh /folder/

🌐 Network and Internet

ping # test connectivity to a host ex: ping google.com
curl # download files from the internet ex: curl -O URL
wget
ssh  # connect to a remote server ex: ssh user@host
ip a # show network info (replaces ifconfig) ex: ip a

🛠️ Useful Utilities

chmod # change file permissions ex: chmod +x script.sh
chown # change file owner ex: chown user:group file
tar   # compress/extract files ex: tar -xzvf file.tar.gz
alias # create command shortcuts ex: alias ll='ls -la'

🛠️ Install SSH-keys

#  Verificar se já existem chaves SSH
ls -al ~/.ssh # Se você vir arquivos como "id_rsa" e "id_rsa.pub", você já tem chaves SSH.

# Gerar uma nova chave SSH (se necessário)
ssh-keygen -t ed25519 -C "seu_email@exemplo.com"
ssh-keygen -t rsa -b 4096 -C "seu_email@exemplo.com" # Ou, se seu sistema não suportar o algoritmo Ed25519

# Pressione Enter para aceitar o local padrão (~/.ssh/id_ed25519 ou ~/.ssh/id_rsa) e depois digite uma senha segura (opcional, mas recomendado).

#  Adicionar a chave SSH ao ssh-agent
eval "$(ssh-agent -s)" # Primeiro, inicie o ssh-agent em segundo plano
ssh-add ~/.ssh/id_ed25519 # Depois, adicione sua chave privada SSH ao ssh-agent, Para chaves Ed25519
ssh-add ~/.ssh/id_rsa # Para chaves RSA

# 4. Copiar a chave pública SSH
cat ~/.ssh/id_ed25519.pub # Exiba sua chave pública e copie-a, ou
cat ~/.ssh/id_rsa.pub
# Selecione todo o conteúdo do arquivo (deve começar com ssh-ed25519 ou ssh-rsa) e copie.

## Adicionar ao github(exemplo)

# Testar a conexão SSH
ssh -T git@github.com
# Você deve ver uma mensagem como
# Hi username! You've successfully authenticated, but GitHub does not provide shell access.

# Configurar o Git para usar SSH (opcional)
git config --global url."git@github.com:".insteadOf "https://github.com/" # Se você já configurou o Git para usar HTTPS, pode alterar para SSH

📌 Extra Tips

  • Use Ctrl + C to interrupt a command
  • Use Ctrl + R to search command history
  • Always check the manual with man comando before using unfamiliar flags

🔗 Useful References

Extras: Windows 11 commands

Useful Command Prompt (CMD) Commands

ipconfig # Show network info (IP, gateway, DNS, etc.)
ipconfig /release # release IP
ipconfig /renew   # renew IP
ipconfig /flushdns # Clear DNS cache
ping # Test connection to server or website
tracert # Trace route packets take to destination
netstat # Show active network connections
netstat -ano # List all connections with PIDs
tasklist # list running processes
taskkill /im process_name.exe /if # force close a program
chkdsk # check and repair disk errors ex: chdsk C: /f
sfc /scannow # scan and repair corrupted system files
diskpart # advanced disk management tool (partitioning, formatting)
shutdown /s /t 0 # Shut down PC immediately
shutdown /r /t 0 # Restart PC
shutdown /h      # Hibernate

PowerShell Commands (More powerful than CMD)

Get-Process # List running processes
Stop-Process -Name "process_name" -Force # terminate process
Get-NetAdapter # Show network adapter info
Test-NetConnection # Test connectivity to host (similar to `ping`)
Get-WindowsUpdateLog # Generate Windows update log
Get-Disk             # Show disk info
Get-Partition        # Show partition info
Set-ExecutionPolicy  # Allow script execution in PowerShell (useful for automation)

Windows 11 Keyboard Shortcuts

  • Win + A → Open Action Center.
  • Win + E → Open File Explorer.
  • Win + I → Open Windows Settings.
  • Win + X → Advanced context menu (quick access to tools).
  • Win + V → Clipboard History.
  • Win + Ctrl + D → Create new virtual desktop.
  • Win + . ou Win + ; → Open emoji/symbol menu.
  • Win + Shift + S → Screenshot tool.
  • Win + Ctrl + Shift + B → Restart video driver (useful if screen freezes).

Advanced tools for Windows 11

  • msconfig → System Configuration (startup, services).
  • devmgmt.msc → Device Manager.
  • diskmgmt.msc → Disk Management.
  • services.msc → Windows Services.
  • eventvwr.msc → Event Viewer (system logs).
  • gpedit.msc → Group Policy Editor (Pro/Enterprise only).
  • taskmgr → Task Manager.
  • control → Traditional Control Panel.

Windows Package Manager (Winget)

Winget is the official Windows package manager, introduced by Microsoft to simplify installing, updating, and removing apps via command line (CMD or PowerShell). It comes built into Windows 11 (and is also available for Windows 10 starting with version 1809 with updates).

winget search <package> # ex: chrome
winget install <package_name/app> # ex: Google.Chrome/Mozilla.Firefox/Microsoft.VisualStudioCode
winget install --d=<package_name> # id specifies exact app
# ex:
winget install --id=Notepad++.Notepad++ --version 8.6.2

winget list --name <package_name> # ex: chrome
winget upgrade                   # List apps with available updates
winget upgrade --id <package_name> # Update specific app
winget upgrade --all              # Update all apps
winget uninstall <app_name>    # Uninstall a program
# ex:
winget uninstall Google.Chrome
winget uninstall --id=Adobe.Acrobat.Reader.64-bit

# Export and Import App Lists
winget export -o apps.json
winget import -i apps.json

# Show App Info
winget show <app_name>
# ex:
winget show Microsoft.PowerToys

# Clear Winget Cache
winget cache clean # Remove temporary files from installations.

Advantages of Using Winget

  • ✅ Silent installation (great for scripts and automation).
  • ✅ Batch updates (avoids outdated versions).
  • ✅ Integration with Microsoft's official repository (also supports external sources).
  • ✅ More secure (avoids downloading from untrusted sites).

Common Issues and Solutions

  • ❌ "Winget not recognized" → Update Windows or install App Installer from Microsoft Store.
  • ❌ Installation failure → Run terminal as Admin or use --force.
  • ❌ App not found → Verify exact name with winget search.

Practical Example (Install Useful Tools at Once)

winget install Microsoft.PowerToys
winget install Telegram.TelegramDesktop
winget install VideoLAN.VLC
winget install 7zip.7zip
winget install ObsProject.OBSStudio

About

some of the most utils linux commands and some extra windows commands

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages