Everyday Linux Commands
· 6 min read
I use these Linux commands over and over in daily work, so rather than searching for them every time, I've organized them into a quick-reference note. They're grouped by CPU, memory, files, and system, with a list of frequently used commands at the end.
CPU Commands
# Number of physical CPUs
grep 'physical id' /proc/cpuinfo | sort -u | wc -l
# Number of CPU cores
grep 'core id' /proc/cpuinfo | sort -u | wc -l
# Number of CPU threads
grep 'processor' /proc/cpuinfo | sort -u | wc -l
# CPU model
dmidecode -s processor-version
# Detailed CPU information
cat /proc/cpuinfo
Memory Commands
# Current memory usage
free -h
# Top 10 processes by memory usage
ps aux | head -1;ps aux |grep -v PID |sort -rn -k +4| head -10
File Commands
ls # show files or directories
ls -l # list files with details (list)
ls -a # list all files and directories in the current directory, including hidden ones (all)
mkdir # create a directory
mkdir -p # create a directory, creating parent directories as needed (parent)
cd # change directory
touch # create an empty file
echo # create a file with content
cat # view file contents
cp # copy
mv # move or rename
rm # delete a file
rm -r # delete recursively, including subdirectories and files
rm -f # force delete
find # search the filesystem for a file
wc # count lines, words, and characters in text
grep # search for a string in a text file
rmdir # delete an empty directory
tree # show a directory as a tree; requires the tree package
pwd # show the current directory
System Commands
# Show system information
lsb_release -a
# Query the kernel version
uname -r
Frequently Used Commands
- cd: change the current working directory
- ls: list files and subdirectories in the current working directory
- mkdir: create a new directory
- rm: delete files or directories
- cp: copy files or directories
- mv: move files or directories
- touch: create a new file or update an existing file's access and modification times
- cat: view file contents
- grep: search for a specific string in files
- find: locate files in the filesystem
- chmod: change file or directory permissions
- chown: change file or directory ownership
- top: show the processes currently running on the system
- ps: list currently running processes
- ssh: connect to a remote host over a secure shell
- scp: copy files between hosts over a secure shell
- tar: create or extract tar archives
- gzip: compress files
- unzip: decompress files
- ping: test network connectivity to another host
- ifconfig: show and manage network interfaces
- route: show and manage the network routing table
- netstat: show network status information
- iptables: manage firewall rules
- systemctl: manage system services
- service: manage system services
- du: show disk usage of directories and files
- df: show filesystem disk usage
- uname: show system information
- date: show or change the system date and time
- history: show the history of previously executed commands
- man: view a command's manual page
- which: find the path of a given command
- whereis: find the path and manual page of a given command
- whoami: show the current user's username
- su: switch to another user or the superuser
- sudo: run a command with superuser privileges
- ssh-keygen: generate an SSH key pair
- ssh-copy-id: copy an SSH public key to a remote host
- scp: securely copy files over SSH
- curl: send requests to a server and fetch the response
- wget: download files from the web
- vim: a powerful text editor
- nano: an easy-to-use text editor
- tar: create or extract tar archives
- gzip: compress files
- bzip2: compress files
- unzip: decompress files
- zip: create or extract zip archives
- sshfs: mount a remote filesystem over SSH
- rsync: sync files and directories remotely
- awk: process and analyze text
- sed: process and transform text
- sort: sort lines of text
- uniq: remove duplicate lines from text
- cut: extract columns from text
- paste: merge text columns into a single file
- tee: copy standard output to a file and the terminal
- diff: compare the differences between two files
- patch: apply a patch from a diff file
- head: show the first lines of a file
- tail: show the last lines of a file
- tar: create or extract tar archives
- gzip: compress files
- bzip2: compress files
- unzip: decompress files
- zip: create or extract zip archives
- rpm: install, remove, and query RPM packages
- dpkg: install, remove, and query Debian packages
- ps: list running processes
- kill: stop a running process
- top: show the processes currently running on the system
- uptime: show system uptime and load
- free: show system memory usage
- df: show filesystem disk usage
- du: show disk usage of directories and files
- mount: mount a filesystem
- umount: unmount a filesystem
- chroot: change the root directory
- ln: create symbolic or hard links
- echo: print text or variables
- export: set environment variables
- source: execute a script and import it into the current shell
- alias: create an alias
- unalias: remove an alias
- jobs: list currently running jobs
- bg: send a job to run in the background
- fg: bring a job back to the foreground
- nohup: run a job in the background so it survives closing the terminal
- crontab: set up scheduled tasks
- at: run a command at a specified time
- screen: create multiple terminal sessions
- tmux: create multiple terminal sessions
- curlftpfs: mount a remote filesystem over FTP
- dig: query DNS servers
- nslookup: query DNS servers
- ping: test network connectivity to another host
- traceroute: show the path packets take through the network
- tcpdump: capture network packets
- iftop: show network traffic information
Wrapping Up
Nobody remembers every command — what matters is knowing where to look them up. This note collects the commands I use most, grouped by CPU, memory, files, and system, and together with the man pages it covers most troubleshooting scenarios. As new commands worth recording come up, I'll keep adding them here.
COMMENTS