Essential Linux Commands & System Administration Toolkit
Classified in Computers
Written on in
English with a size of 7.26 KB
File Operations
ls— List files and directories (-a for hidden, -l for detailed)cd [directory]— Change directorymkdir [directory]— Create directorycp [source] [destination]— Copy files/directories (-r for recursive)mv [source] [destination]— Move or rename files/directoriesrm [file]— Remove files (-r for recursive)chmod [permissions] [file]— Change file permissionschown [user]:[group] [file]— Change file ownership
System Monitoring
top/htop— Monitor system processesps— List running processesdf -h— Display disk space usagefree -m— Show memory usage
Networking Commands
ifconfig/ip a— Display network interfacesping [host]— Test network connectivitynetstat -tuln— List network connectionsnmap [IP]— Scan networks and ports
Package Management
- Debian-based:
apt-get,apt - Red Hat-based:
yum,dnf - Arch Linux:
pacman - SUSE Linux:
zypper - General:
snap,flatpak
User Management
useradd [user]— Add a new userusermod [user]— Modify user accountpasswd [user]— Change user passwordsu [user]— Switch usersudo [command]— Execute command as superuser
Nano Editor Commands
- Ctrl + O — Save file
- Ctrl + X — Exit Nano
- Ctrl + W — Search within the file
- Ctrl + K — Cut line
- Ctrl + U — Paste line
- Ctrl + G — Display help
Vim Editor Commands
- Modes: i (Insert), Esc (Command)
- Saving & Quitting: :w (Save), :q (Quit), :wq (Save & Quit), :q! (Quit without saving)
Vim Navigation
- h j k l — Move cursor
- /pattern — Search for a pattern
- :set nu — Show line numbers
Shell Scripting: Variables
var_name="value"— Assign a value to a variable
Shell Scripting: Loops
for i in {1..5}; do echo $i; done— Loop from 1 to 5while [ condition ]; do echo "looping"; done— Execute a while loopfor file in *.txt; do echo $file; done— Loop through.txtfiles
Shell Scripting: Conditionals
if [ condition ]; then echo "True"; elif [ condition ]; then echo "Else if"; else echo "False"; fi— If-elif-else statementif [[ $var -eq 10 ]]; then echo "Equal to 10"; fi— Conditional check for equality
Wireless Network Commands
iwconfig— Display wireless configurationairmon-ng— Enable monitor mode for Wi-Fi adapter
Port Scanning Tools
nmap -sS -A— Perform SYN scan with OS detection
Packet Capture
tcpdump— Capture network traffic
Basic SSH Commands
ssh user@host— Connect to a remote hostscp source user@host:destination— Securely copy files to/from a remote host
SSH Key Management
ssh-keygen— Generate SSH keysssh-copy-id user@host— Copy public key to a remote host
Git Basic Commands
git init— Initialize a new Git repositorygit clone URL— Clone a repository from a URLgit add [file]— Stage changes for commitgit commit -m "message"— Commit staged changes with a messagegit push/git pull— Push/pull changes to/from a remote repository
Git Branching
git branch— List all branchesgit checkout branch_name— Switch to a different branchgit merge branch_name— Merge a branch into the current branch
Important Configuration Files
/etc/hosts— Static hostname-IP mapping/etc/fstab— Disk and partition mount settings/etc/network/interfaces— Network configuration (Debian-based systems)~/.bashrc,~/.zshrc— User-specific shell startup scripts/etc/systemd/system/— Systemd service unit files
System Log Files
/var/log/syslog— General system log/var/log/auth.log— Authentication log
Nmap Scan Options
-sS— TCP SYN scan-A— Enable OS detection and version detection-Pn— Disable ping before scanning
Wireshark Display Filters
ip.addr == 192.168.1.1— Filter by IP addresstcp.port == 80— Filter by TCP port
Wireless Attack Tools: Scanning
scan— Scan for all access pointsscan -ch 6— Scan on a specific channelscan stations -ch 6— Scan connected devices (stations)
Wireless Attack Tools: Selecting Targets
select ap 0— Select an Access Point by IDselect station 2— Select a station by IDshow selected aps/show selected stations— Show currently selected APs/Stations
Wireless Attack Tools: Attack Commands
attack deauth -ap 0 -st 2— Perform a deauthentication attack on a specific stationattack beacon -b— Initiate a beacon flood attackattack probe -ap 0— Launch a probe flood attackenable random 5— Enable random SSID attack (5-second interval)stop attack— Stop all active attacks
Wireless Attack Tools: Utility Commands
clear— Clear the consolesysinfo— Display system informationreboot— Reboot the deviceformat— Format the SPIFFS filesystem
Regular Expressions (Regex) Commands
grep "pattern" file.txt— Search for a pattern within a filesed 's/old/new/g' file.txt— Replace text using sed
Docker Commands
docker run image— Run a Docker container from an imagedocker ps— List running Docker containersdocker stop container_id— Stop a running Docker container