70+ Essential Linux Commands
File and Directory Commands
ls (Windows: dir) Lists files/directories.
# Basic: List files with details
ls -la
# Advanced: List recursively with file sizes
ls -lR --human-readable2. cd (Windows: cd)
Changes directory
# Basic: Navigate to a folder
cd /home/user
# Advanced: Switch to path with spaces
cd "/usr/local/share"mkdir (Windows: mkdir/md) Creates a directory.
# Basic: Create a single folder
mkdir data
# Advanced: Create nested folders
mkdir -p parent/child/grandchildrmdir (Windows: rmdir/rd) Deletes an empty directory.
# Basic: Remove empty folder
rmdir data
# Advanced: Remove non-empty folder
rm -r datarm (Windows: del) Deletes files.
cp (Windows: copy) Copies files.
cp -r (Windows: xcopy) Copies directories recursively.
mv (Windows: move) Moves/renames files.
chmod (Windows: attrib) Changes file permissions.
mv (Windows: ren) Renames files/directories.
System Information Commands
uname -a (Windows: systeminfo) Shows system information.
hostname (Windows: hostname) Shows the system hostname.
cat /etc/os-release (Windows: ver) Shows Debian version.
env (Windows: set) Manages environment variables.
lscpu/lspci (Windows: wmic) Queries hardware details.
whoami (Windows: whoami) Shows the current user.
ps aux (Windows: tasklist) Lists running processes.
Network Commands
ip addr (Windows: ipconfig) Shows network configuration.
ping (Windows: ping) Test network connectivity.
traceroute (Windows: tracert) Traces the route to a host.
ss (Windows: netstat) Shows network connections/ports.
dig (Windows: nslookup) Queries DNS (install via
sudo apt install dnsutils).
ip neigh (Windows: arp) Manages ARP cache.
ip route (Windows: route) Manages the routing table.
mount (Windows: net use) Mounts network filesystems.
ss -tuln (Windows: netstat -an) Shows connections numerically.
nmcli (Windows: netsh) Configures network (install via
sudo apt install network-manager).
Disk and Drive Commands
fsck (Windows: chkdsk) Checks/repairs filesystem errors.
parted (Windows: diskpart) Manages disks/partitions (install via
sudo apt install parted).
mkfs (Windows: format) Formats a filesystem.
e2label (Windows: label) Sets volume label.
blkid (Windows: vol) Shows volume information.
tune2fs (Windows: fsutil) Manages ext filesystem properties.
Task and Process Management Commands
kill/pkill (Windows: taskkill) Terminates processes.
Investigation Context: Monitor process termination with
auditd(install viasudo apt install auditd). Example rule to logkillactions:
Check logs with: sudo ausearch -k process_kill.
crontab (Windows: schtasks) Manages scheduled tasks.
systemctl (Windows: sc) Controls systemd services.
shutdown (Windows: shutdown) Performs shutdown/restart.
xdg-open (Windows: start) Opens files/programs.
read (Windows: pause) Pauses script for input.
sleep (Windows: timeout) Adds delay in scripts.
User and Security Commands
useradd/usermod (Windows: net user) Manages user accounts.
groupadd/usermod (Windows: net localgroup) Manages group memberships.
sudo -u (Windows: runas) Runs command as another user.
chmod (Windows: cacls) Modifies file permissions.
chown (Windows: icacls) Changes file ownership.
loginctl lock-session (Windows: lock) Locks user session.
update-rc.d (Windows: gpupdate) Manages system services (Debian-specific).
apparmor (Windows: secedit) Applies security profiles (install via
sudo apt install apparmor).
Power and Shutdown Commands
upower (Windows: powercfg) Manages power settings (install via
sudo apt install upower).
shutdown -h now (Windows: shutdown /s /t 0) Immediate shutdown.
reboot (Windows: shutdown /r /t 0) Immediate restart.
loginctl terminate-session (Windows: shutdown /l) Logs off user.
Troubleshooting Commands
fsck (Windows: sfc /scannow) Repairs filesystem.
dpkg --configure (Windows: DISM) Repairs package configurations.
df/du (Windows: cleanmgr) Manages disk space.
journalctl (Windows: eventvwr) Views system logs.
lscpu/lsmem (Windows: msinfo32) Shows system info.
Advanced and Miscellaneous Commands
tree (Windows: tree) Displays folder structure (install via
sudo apt install tree).
echo (Windows: echo) Displays messages or writes to files.
clear (Windows: cls) Clears terminal screen.
title (Windows: title) Sets terminal title (bash-specific).
tput (Windows: color) Changes terminal colors.
exit (Windows: exit) Closes terminal.
PS1 (Windows: prompt) Changes shell prompt.
man (Windows: help) Shows command help.
Scripting and Shell Commands
if (Windows: if) Conditional logic in scripts.
for (Windows: for) Loops through values.
function (Windows: goto) Defines functions for script flow.
source/. (Windows: call) Calls another script/function.
local (Windows: setlocal/endlocal) Manages variable scope.
Bonus Useful Commands
tee (Windows: clip) Redirects to file and stdout.
grep (Windows: find) Searches text in files.
file (Windows: assoc) Shows file type.
lsmod (Windows: driverquery) Lists kernel modules.
wmctrl (Windows: taskview) Manages windows/desktops (install via
sudo apt install wmctrl).
Last updated