script |
Record a terminal session to a file |
- -a append to file instead of overwriting
- -f flush output after each write
- -q quiet, no start/done messages
- -t FILE output timing data to file
- -c COMMAND run a single command instead of shell
|
script session.logscript -a session.logscript -q /tmp/output.txtscript -t 2> timing.log session.logscript -c "yum update" update.log
|
history |
Show command history |
- -c clear history
- -d OFFSET delete entry
- -a append session history to file
- -r read history file into current session
- -w write history to file
- -n read new lines not yet read
- N show last N lines
|
history 20history -chistory -d 45!123 (re-run command 123)history | grep yum
|
!! |
Repeat the last command (bash history expansion) |
- (bash history expansion, not a command) — !! repeats last command
- !N repeats command number N
- !STRING repeats last command starting with STRING
- ^OLD^NEW^ quick substitution in last command
|
sudo !!!!!42!yum^error^warning^
|
alias |
Create a shorthand for a command |
- NAME=VALUE define an alias
- -p print all defined aliases (no args also works)
|
alias ll="ls -la"alias grep="grep --color=auto"alias -palias rm="rm -i"alias ..="cd .."
|
unalias |
Remove a defined alias |
- -a remove all aliases
- NAME remove specific alias
|
unalias llunalias -aunalias grepunalias ..unalias rm
|
env |
Run a command in a modified environment / show environment |
- -i start with empty environment
- VAR=VALUE set variable for the invoked command
- -u NAME remove a variable
- -0 output NUL-terminated
|
envenv VAR=1 commandenv -i bashenv -u PATH envenv -0
|
printenv |
Print environment variables |
- VARNAME show single variable
- -0 output NUL-terminated (no trailing newline separators)
|
printenvprintenv PATHprintenv HOMEprintenv -0printenv | sort
|
export |
Mark a variable for export to child processes |
- -p list all exported variables
- -n unexport a variable
- NAME=VALUE set and export
|
export PATH=$PATH:/opt/binexport -pexport -n MYVARexport JAVA_HOME=/usr/lib/jvm/java-11export EDITOR=vim
|
unset |
Remove a variable or function |
- -v unset a variable (default)
- -f unset a function
|
unset MYVARunset -f myfunctionunset HISTFILEunset -v PATH_BACKUPunset TMPDIR
|
source |
Execute commands from a file in the current shell |
- FILE [args] — read and execute commands from file in current shell (alias: .)
|
source ~/.bashrcsource /etc/profilesource venv/bin/activatesource script.sh arg1. ./config.sh
|
bash -c |
Run bash with a command string |
- -c STRING — execute commands from STRING
- -x trace execution (xtrace)
- -i interactive shell
- --norc do not read startup files
|
bash -c "echo hello"bash -x script.shbash -c "ls | wc -l"bash --norc -c "env"bash -c "for i in 1 2 3; do echo \$i; done"
|
which |
Show full path of executable |
- -a print all matching executables in PATH
- --skip-alias ignore alias definitions
- --skip-functions ignore shell functions
- --skip-dot skip PATH dirs starting with .
- --skip-tilde skip PATH dirs starting with ~
- --show-dot / --show-tilde formatting of dir output
- --tty-only stop after first non-tty option
|
which sshwhich -a python3which sshd sshd_configwhich -a vimwhich nonexistentcmd; echo $?
|
timeout |
Run a command with a time limit |
- -s SIGNAL signal to send on timeout (default TERM)
- -k DURATION also send SIGKILL after DURATION
- --preserve-status exit with command's status
- --foreground allow job control
|
timeout 10 ping hosttimeout -s KILL 5 sleep 100timeout -k 5 30 long_running_cmdtimeout --preserve-status 5 cmdtimeout 1m backup.sh
|
flock |
Manage file locks from shell scripts |
- -x exclusive lock (default)
- -s shared lock
- -n non-blocking (fail if locked)
- -w SECONDS timeout waiting for lock
- -u unlock
|
flock /tmp/lockfile -c "backup.sh"flock -n /tmp/lock.lockfile echo ok || echo busyflock -x /var/lock/mylock.lock -c "critical_section.sh"flock -w 10 /tmp/lock cmdflock -s /tmp/sharedlock cat file
|
nice |
Run a command with modified scheduling priority |
- -n ADJUSTMENT set niceness (-20 highest to 19 lowest priority)
- --help
- --version
|
nice -n 10 commandnice -n -5 sudo makenice --adjustment=15 backup.shnice tar czf a.tgz /datanice -19 find / -name "*.tmp"
|
ionice |
Set/get I/O scheduling class and priority |
- -c CLASS 1=realtime 2=best-effort 3=idle
- -n LEVEL priority 0-7 (with class 1/2)
- -p PID apply to existing process
- -t ignore failure to set priority
|
ionice -c2 -n7 dd if=/dev/zero of=/tmp/test bs=1M count=100ionice -c3 rsync -a /src /dstionice -p 4321 -c1 -n0ionice -c2 -n0 backup.shionice -t -c3 updatedb
|
watch |
Repeatedly run a command, showing live output |
- -n SECONDS interval between runs (default 2)
- -d highlight differences between updates
- -g exit when output changes
- -t no title/header
|
watch -n 1 df -hwatch -d "netstat -tn"watch -g "ls /tmp/lockfile"watch -t uptimewatch -n 5 "tail -5 /var/log/messages"
|
parallel |
Run commands in parallel |
- -j N number of jobs to run simultaneously
- --dry-run show commands without running
- -a FILE read arguments from file
- --eta show estimated time to completion
- ::: supply argument list inline
|
parallel -j4 gzip ::: *.logls *.txt | parallel gzipparallel --dry-run echo ::: 1 2 3parallel -a hosts.txt ping -c1parallel --eta -j8 process.sh ::: input*.csv
|
xargs |
Build and execute commands from standard input |
- -n NUM max arguments per command line
- -I REPL replace string for each item
- -P N run N processes in parallel
- -0 input items NUL-terminated
- -t print command before executing (verbose)
- -r do not run if input empty
|
find . -name "*.tmp" | xargs rmecho "a b c" | xargs -n1 echofind . -print0 | xargs -0 -I{} mv {} /backup/ls *.jpg | xargs -P4 -I{} convert {} {}.pngxargs -a args.txt echo
|
exec |
Replace shell / redirect descriptors |
- COMMAND — replace shell process with COMMAND
- -a NAME set argv[0] name
- N<&M / N>&M — redirect file descriptors (no new process)
|
exec bashexec 3< file.txtexec > output.log 2>&1exec -a myproc ./binaryexec ssh host
|
disown |
Remove a job from the shell job table |
- -h keep job in job list but not sent SIGHUP
- -a apply to all jobs
- -r apply to running jobs only
- %N specify job by number
|
disown %1disown -h %2disown -adisown -rcommand & disown
|
bg |
Resume a job in the background |
- %N resume specific stopped job in background (no other options)
|
bgbg %1bg %2CTRL-Z then bgbg %vim
|
jobs |
List active jobs |
- -l list PIDs too
- -p list only PIDs
- -r running jobs only
- -s stopped jobs only
|
jobsjobs -ljobs -pjobs -rjobs -s
|
screen |
Terminal multiplexer / session manager |
- -S NAME name the session
- -r reattach to a session
- -ls list sessions
- -d detach a session
- -X CMD send command to a session
|
screen -S buildscreen -r buildscreen -lsscreen -d -r buildscreen -X -S build quit
|
tmux |
Terminal multiplexer / session manager |
- new -s NAME create named session
- attach -t NAME attach to session
- ls list sessions
- kill-session -t NAME
- detach (from inside session, prefix+d)
|
tmux new -s worktmux attach -t worktmux lstmux kill-session -t worktmux new -s deploy -d
|
scriptreplay |
Replay a terminal session recorded with script |
- -t TIMINGFILE timing file from script -t
- -s TYPESCRIPT the recorded output file
- -d SPEED speed multiplier
|
scriptreplay -t timing.log session.logscriptreplay --timing timing.log session.logscriptreplay -t timing.log -s session.log -d 2scriptreplay timing.log typescriptscriptreplay -t timing.log session.log -d 0.5
|
strace |
Trace system calls made by a process |
- -p PID attach to running process
- -f follow forked children
- -e TRACE=SET filter syscalls (e.g. trace=network)
- -o FILE write output to file
- -c summarize counts/times instead of full trace
- -T show time spent in each syscall
|
strace -f -e trace=network curl example.comstrace -p 1234strace -c lsstrace -o trace.log myprogstrace -T -f make
|
ltrace |
Trace library calls made by a process |
- -p PID attach to running process
- -e FUNC filter to specific library calls
- -c summary of call counts/times
- -o FILE write output to file
- -S also show syscalls
|
ltrace ./myprogltrace -p 1234ltrace -c lsltrace -o trace.log myprogltrace -S -e malloc ./myprog
|
lsof |
List open files and the processes using them |
- -i list network files/sockets
- -p PID files opened by PID
- -u USER files opened by user
- -c NAME files opened by command name
- +D DIR files open under directory
|
lsof -i :80lsof -p 1234lsof -u nginxlsof -c sshdlsof +D /var/log
|
fuser |
Identify processes using files or sockets |
- -k kill processes using resource
- -m show processes using a mounted filesystem
- -v verbose output
- -u show user owning process
|
fuser -v /var/log/messagesfuser -k /mnt/usbfuser -m /mnt/datafuser -u 8080/tcpfuser -k 8080/tcp
|
nl |
Number lines of a file |
- -b STYLE numbering style (a=all, t=non-empty, n=none)
- -n FORMAT number format (ln, rn, rz)
- -w WIDTH number field width
- -s SEP separator after number
- -i INCREMENT numbering increment
|
nl file.txtnl -b a file.txtnl -w 5 -s ": " file.txtnl -i 2 file.txtnl -n rz file.txt
|
paste |
Merge lines of files side by side |
- -d DELIM use DELIM instead of tab
- -s serial mode, paste one file at a time
|
paste file1.txt file2.txtpaste -d, file1.txt file2.txtpaste -s file.txtpaste -d: names.txt ids.txtpaste -s -d, list.txt
|
join |
Join lines of two files on a common field |
- -1 FIELD join field of file1
- -2 FIELD join field of file2
- -t CHAR field separator
- -a FILENUM output unpairable lines from file
- -o FORMAT specify output format
|
join file1.txt file2.txtjoin -1 2 -2 1 a.txt b.txtjoin -t: /etc/passwd ids.txtjoin -a1 file1.txt file2.txtjoin -o 1.1,2.2 a.txt b.txt
|
split |
Split a file into pieces |
- -b SIZE split by byte size
- -l LINES split by number of lines
- -d use numeric suffixes
- -a LENGTH suffix length
- --additional-suffix=SUFFIX
|
split -b 100M bigfile.tar part_split -l 1000 data.csv chunk_split -d -a 3 file.log partsplit -b 10M --additional-suffix=.bin firmware.bin fw_split -n 4 archive.tar section_
|
wc |
Count lines, words, and bytes |
- -l count lines
- -w count words
- -c count bytes
- -m count characters
- -L length of longest line
|
wc -l file.txtwc -w document.txtwc -c file.binfind . -name "*.py" | xargs wc -lwc -L file.txt
|
sort |
Sort lines of text |
- -n numeric sort
- -r reverse order
- -k FIELD sort by field
- -u unique (remove duplicate lines)
- -t CHAR field delimiter
- -h human-numeric sort (K,M,G suffixes)
- -f case-insensitive
|
sort file.txtsort -n numbers.txtsort -k2 -t: /etc/passwdsort -ru names.txtsort -h sizes.txt
|
uniq |
Report or omit repeated lines |
- -c prefix lines with count
- -d only show duplicated lines
- -u only show unique lines
- -i case-insensitive comparison
- -f N skip first N fields
|
sort file.txt | uniquniq -c access.log | sort -rnuniq -d names.txtuniq -u names.txtsort ids.txt | uniq -i
|
tr |
Translate or delete characters |
- -d delete characters
- -s squeeze repeated characters
- -c complement the SET1
- SET1 SET2 translate characters
|
tr "a-z" "A-Z" < file.txttr -d "\n" < file.txttr -s " " < file.txtecho "hello" | tr -c "a-z" "_"cat file.txt | tr -d "\r"
|
cut |
Extract sections from each line |
- -d DELIM field delimiter
- -f FIELDS select fields
- -c CHARS select character positions
- --complement invert selection
- -s suppress lines without delimiter
|
cut -d: -f1 /etc/passwdcut -c1-10 file.txtcut -d, -f2,4 data.csvcut -f1 --complement data.tsvcut -d: -f1,3 -s /etc/passwd
|
awk |
Pattern scanning and text-processing language |
- -F SEP field separator
- -v VAR=VALUE set variable
- -f SCRIPTFILE read program from file
- '{ pattern { action } }' inline program syntax
|
awk -F: '{print $1}' /etc/passwdawk '{sum+=$1} END{print sum}' numbers.txtawk -v x=5 '{print $1*x}' file.txtawk -f script.awk data.txtawk '/error/{print NR, $0}' log.txt
|
sed |
Stream editor for filtering/transforming text |
- -i edit files in place
- -e SCRIPT add script to commands to run
- -n suppress automatic printing
- -r / -E extended regex
- s/OLD/NEW/g substitute globally
|
sed -i "s/foo/bar/g" file.txtsed -n "2,5p" file.txtsed -e "s/^#//" config.confsed -r "s/[0-9]+/N/g" file.txtsed "/^$/d" file.txt (remove blank lines)
|
grep |
Search text using patterns |
- -i ignore case
- -v invert match
- -r/-R recursive
- -n line numbers
- -c count matches
- -l files with matches
- -w whole word
- -E extended regex
- -A/-B/-C NUM context lines
- --include=GLOB / --exclude=GLOB
|
grep -i "error" /var/log/*grep -rn "TODO" /opt/app/srcgrep -v "^#" /etc/fstabgrep -E "fail|error" /var/log/securegrep -c "GET" access.log
|
diff |
Compare files line by line |
- -u unified format
- -c context format
- -r recursive (compare directories)
- -q report only whether files differ
- -y side-by-side format
- -i ignore case
|
diff -u old.txt new.txtdiff -r dir1/ dir2/diff -q file1 file2diff -y a.txt b.txtdiff -i a.txt b.txt
|
patch |
Apply a diff file to an original |
- -p NUM strip NUM leading path components
- -i FILE read patch from file
- -R reverse a previously applied patch
- --dry-run test without modifying files
- -b make backup of original files
|
patch -p1 < changes.patchpatch -i fix.patch file.cpatch -R -p1 < changes.patchpatch --dry-run -p1 < changes.patchpatch -b file.c < fix.patch
|
cmp |
Compare two files byte by byte |
- -s silent, only exit status
- -l list all differing byte positions
- -b print differing bytes
- -n LIMIT compare only first N bytes
|
cmp file1 file2cmp -s file1 file2 && echo samecmp -l file1 file2cmp -b a.bin b.bincmp -n 100 a.bin b.bin
|
base64 |
Encode/decode base64 data |
- -d decode instead of encode
- -w COLS wrap lines at COLS (0 = no wrap)
- -i ignore garbage in decode input
|
base64 file.txt > file.b64base64 -d file.b64 > file.txtbase64 -w0 file.binecho "hello" | base64base64 -d -i input.b64
|
md5sum |
Compute/check MD5 checksums |
- -c check sums against a list file
- --quiet only show failures with -c
- -b binary mode read
|
md5sum file.isomd5sum -c checksums.md5md5sum *.txt > sums.md5md5sum -c sums.md5 --quietmd5sum file.bin
|
gzip |
Compress/decompress files (.gz) |
- -d decompress (same as gunzip)
- -k keep original file
- -r recursive
- -N level (1 fastest .. 9 best compression)
- -c write to stdout
- -l list compressed file info
|
gzip file.txtgzip -d file.txt.gzgzip -9 -k bigfile.loggzip -c file.txt > file.txt.gzgzip -l archive.gz
|
bzip2 |
Compress/decompress files (.bz2) |
- -d decompress
- -k keep original file
- -N level (1-9)
- -c write to stdout
- -t test integrity
|
bzip2 file.txtbzip2 -d file.txt.bz2bzip2 -9 -k data.logbzip2 -c file.txt > file.txt.bz2bzip2 -t archive.bz2
|
xz |
Compress/decompress files (.xz) |
- -d decompress
- -k keep original file
- -N level (0-9)
- -c write to stdout
- -T N number of threads
- -t test integrity
|
xz file.tarxz -d file.tar.xzxz -9 -k bigfile.logxz -T4 largefile.tarxz -t archive.tar.xz
|
tar |
Archive files (tape archive) |
- -c create archive
- -x extract archive
- -t list contents
- -z gzip compression
- -j bzip2 compression
- -J xz compression
- -v verbose
- -f FILE archive filename
- -C DIR change to directory before operation
- --exclude=PATTERN
|
tar czf backup.tar.gz /etctar xzf backup.tar.gz -C /restoretar tvf archive.tartar cjf backup.tar.bz2 /datatar --exclude="*.log" -czf app.tar.gz /opt/app
|
zip |
Create/update zip archives |
- -r recursive (zip a directory)
- -e encrypt with password prompt
- -x exclude files matching pattern
- -9 best compression
- -u update existing zip
- -d delete entries from zip
|
zip -r backup.zip /var/wwwzip -e secure.zip secrets.txtzip -r site.zip . -x "*.git*"zip -u archive.zip newfile.txtzip -d archive.zip oldfile.txt
|
rsync |
Efficient file sync/copy tool |
- -a archive mode (recursive+preserve)
- -v verbose
- -z compress
- -r recursive
- --delete remove extraneous files at destination
- -e SSH_CMD specify remote shell
- --dry-run show what would happen
- -P show progress + partial transfer
|
rsync -avz /src/ user@host:/dst/rsync -a --delete /data/ /backup/rsync -avzP file.tgz host:/tmp/rsync -e "ssh -p 2222" -a /src/ host:/dst/rsync -a --dry-run /src/ /dst/
|
scp |
Secure copy over SSH |
- -r recursive
- -P PORT remote port
- -i IDENTITY_FILE private key
- -p preserve times/modes
- -C compress during transfer
|
scp file.txt jdoe@host:/tmp/scp -r ./project jdoe@host:/opt/scp -P 2222 backup.tgz jdoe@host:~/scp -i key.pem file.txt user@host:/tmp/scp jdoe@host:/etc/hosts ./hosts.bak
|
sftp |
Secure FTP over SSH |
- -P PORT remote port
- -i IDENTITY_FILE private key
- -b BATCHFILE batch mode script
- -r (with put/get) recursive
|
sftp jdoe@host.example.comsftp -P 2222 jdoe@hostsftp -i key.pem jdoe@hostsftp -b script.txt jdoe@hostsftp> get -r /remote/dir
|
ftp |
Legacy plaintext file transfer client |
- -p passive mode (default in most clients)
- -n disable auto-login
- -i turn off interactive prompting
- -v verbose
|
ftp ftp.example.comftp -n ftp.example.comftp -i ftp.example.comftp -v ftp.example.comftp> get filename.txt
|
lftp |
Advanced file transfer client (FTP/SFTP/HTTP) |
- -u USER,PASS specify credentials
- -e COMMAND execute command then continue
- -p PORT specify port
- -f FILE run script from file
|
lftp ftp://ftp.example.comlftp -u jdoe,secret ftp.example.comlftp -e "mirror /remote /local; quit" ftp.example.comlftp -p 2121 sftp://hostlftp -f script.lftp
|
wget |
Non-interactive file downloader |
- -O FILE output filename
- -c continue partial download
- -r recursive download
- -b background
- -q quiet
- --limit-rate=RATE throttle bandwidth
|
wget https://example.com/file.tar.gzwget -O out.html https://example.comwget -c https://example.com/bigfile.isowget -r -np https://example.com/docs/wget --limit-rate=200k https://example.com/file
|
curl |
Transfer data with URLs, many protocols |
- -O save with remote filename
- -o FILE save as filename
- -I headers only
- -L follow redirects
- -X METHOD HTTP method
- -d DATA POST data
- -H HEADER custom header
- -u USER:PASS basic auth
- -k insecure (skip TLS verify)
- -s silent
|
curl -I https://example.comcurl -O https://example.com/file.zipcurl -X POST -d "a=1" https://api.example.comcurl -H "Authorization: Bearer TOKEN" https://api.example.comcurl -Lk https://self-signed.example.com
|
lynx |
Text-mode web browser |
- -dump dump rendered page to stdout
- -source dump raw HTML source
- -accept_all_cookies
- -nolist omit link list in dump
|
lynx https://example.comlynx -dump https://example.comlynx -source https://example.com > page.htmllynx -accept_all_cookies https://example.comlynx -dump -nolist https://example.com
|
mailx |
Send/read mail from the command line |
- -s SUBJECT set subject line
- -a FILE attach a file
- -c ADDR CC address
- -r ADDR from address
|
echo "body" | mailx -s "Subject" user@example.commailx -s "Report" -a report.pdf user@example.comecho hi | mailx -s test -c cc@example.com to@example.commailx -s "Alert" -r noreply@example.com admin@example.commailx -s "Test" user@example.com < message.txt
|
mutt |
Text-based email client |
- -s SUBJECT set subject
- -a FILE attach a file
- -F FILE alternate config file
- -f MAILBOX open specific mailbox
|
echo "body" | mutt -s "Subject" user@example.commutt -s "Report" -a report.pdf -- user@example.com < body.txtmutt -f /var/mail/jdoemutt -F ~/.muttrc-workmutt -s "test" user@example.com < /dev/null
|
ssh-agent |
Cache SSH private keys for a session |
- -s output Bourne-shell commands
- -c output C-shell commands
- -k kill currently running agent
- -t LIFETIME set default key lifetime
|
eval $(ssh-agent -s)ssh-agent bashssh-agent -kssh-add -l (list loaded keys)ssh-agent -t 3600 -s
|
autossh |
Automatically restart SSH tunnels |
- -M PORT monitor port for connection health
- -f run in background
- -t force pseudo-tty allocation
- (other args passed through to ssh)
|
autossh -M 20000 -f jdoe@hostautossh -M 0 -o "ServerAliveInterval 30" jdoe@hostautossh -M 20000 -L 8080:localhost:80 jdoe@hostautossh -f -M 20001 -N jdoe@hostautossh -M 20000 -t jdoe@host "tmux attach"
|
ncdu |
NCurses disk usage analyzer |
- -x stay on one filesystem
- -e export scan to file (some versions)
- -r read-only mode (no delete)
- -o FILE export scan output
|
ncdu /varncdu -x /ncdu -o scan.json /homencdu -r /etcncdu -e /var/log
|
btop |
Resource monitor (modern TUI) |
- (mostly interactive TUI; few CLI flags) --utf-force force UTF8
- --low-color 256-color mode
- -p PRESET load a preset config
|
btopbtop --utf-forcebtop --low-colorbtop -p 1btop --help
|
glances |
Cross-platform system monitoring tool |
- -t SECONDS refresh interval
- -1 percpu mode
- -w start web server mode
- -s start as a server for remote clients
- -4/-6 restrict to IPv4/IPv6 in web mode
|
glancesglances -t 2glances -wglances -sglances -1
|
htop |
Interactive process viewer |
- -d DELAY update delay (tenths of sec)
- -u USER filter by user
- -p PID monitor specific PIDs
- -s SORTCOL sort column
- -C no-color mode
|
htophtop -u nginxhtop -d 10htop -p 1234htop -C
|
iotop |
Real-time disk I/O usage per process |
- -o only show processes doing I/O
- -b batch mode (non-interactive)
- -n NUM number of iterations
- -d SECONDS delay between updates
- -a accumulated I/O instead of bandwidth
|
iotopiotop -oiotop -b -n 3iotop -aiotop -d 5
|
vnstat |
Network traffic monitor/statistics |
- -i IFACE specify interface
- -d daily statistics
- -m monthly statistics
- -h hourly statistics
- -l live traffic view
- --create create new database for interface
|
vnstat -i eth0vnstat -dvnstat -mvnstat -lvnstat --create -i eth1
|
speedtest-cli |
Test internet bandwidth from the command line |
- --simple simple output format
- --list list nearby servers
- --server ID use specific server
- --bytes show results in bytes not bits
- --json output as JSON
|
speedtest-clispeedtest-cli --simplespeedtest-cli --listspeedtest-cli --server 1234speedtest-cli --json
|
iperf3 |
Network throughput benchmarking tool |
- -s run as server
- -c HOST run as client, connect to server
- -p PORT port number
- -t SECONDS test duration
- -P N parallel streams
- -u UDP mode instead of TCP
|
iperf3 -siperf3 -c 10.0.0.5iperf3 -c 10.0.0.5 -t 30 -P 4iperf3 -c 10.0.0.5 -u -b 100Miperf3 -s -p 5202
|
ethtool |
Query/control Ethernet device settings |
- IFACE — show settings
- -i IFACE driver info
- -S IFACE statistics
- -s IFACE speed SPEED duplex full autoneg off — set speed
- -p IFACE identify (blink)
|
ethtool eth0ethtool -i eth0ethtool -S eth0ethtool -s eth0 speed 1000 duplex full autoneg offethtool -p eth0 5
|
mii-tool |
View/manipulate MII status of NIC (legacy) |
- -v verbose
- -w watch for link changes
- -r restart autonegotiation
- IFACE specify interface
|
mii-toolmii-tool eth0mii-tool -v eth0mii-tool -r eth0mii-tool -w eth0
|
arp-scan |
ARP-based network host discovery |
- -l scan local network (--localnet)
- -I IFACE specify interface
- --interface=IFACE
- -x quiet, minimal output
- -g generate host list for later use
|
arp-scan -larp-scan -I eth0 -larp-scan --interface=eth1 192.168.1.0/24arp-scan -x 192.168.1.0/24arp-scan -l -g
|
nmap |
Network exploration and port scanner |
- -sS TCP SYN scan
- -sU UDP scan
- -p PORTS specify ports
- -A aggressive scan (OS/version/scripts)
- -O OS detection
- -sV service version detection
- -Pn skip host discovery
|
nmap 192.168.1.0/24nmap -p 1-1000 host.example.comnmap -sV -sS hostnmap -A host.example.comnmap -Pn -p80,443 host
|
netcat |
Read/write raw TCP/UDP connections |
- -l listen mode
- -p PORT local port
- -v verbose
- -z zero-I/O (port scan)
- -u UDP mode
|
netcat -zv host.example.com 80netcat -l 8080nc -u host 53echo test | netcat host 9000netcat -w 3 host 22
|
socat |
Bidirectional data relay between two channels |
- TCP-LISTEN:PORT listen on TCP port
- TCP:HOST:PORT connect to TCP endpoint
- -d / -dd increase verbosity/debug level
- fork handle multiple connections
|
socat TCP-LISTEN:8080,fork TCP:backend:80socat - TCP:host.example.com:80socat -d -d TCP-LISTEN:9000,reuseaddr,fork EXEC:/bin/bashsocat UNIX-LISTEN:/tmp/sock,fork TCP:localhost:80socat STDIO TCP:host:22
|
stunnel |
Wrap plaintext connections in TLS |
- -fd FD use existing file descriptor
- -p PIDFILE write pid file
- -c foreground/client mode (config-driven mostly)
- CONFIGFILE — path to stunnel config
|
stunnel /etc/stunnel/stunnel.confstunnel -fd 3stunnel -p /var/run/stunnel.pid /etc/stunnel/stunnel.confstunnel -c /etc/stunnel/client.confstunnel -help (list options)
|
openssl s_client |
Test/inspect a TLS server connection |
- -connect HOST:PORT connect to TLS endpoint
- -servername NAME SNI hostname
- -showcerts show full cert chain
- -cipher LIST restrict cipher list
- -tls1_2 force protocol version
|
openssl s_client -connect example.com:443openssl s_client -connect example.com:443 -servername example.comopenssl s_client -connect host:443 -showcertsopenssl s_client -connect host:443 -tls1_2echo | openssl s_client -connect host:443 2>/dev/null | openssl x509 -noout -dates
|
certbot |
Obtain/renew Let's Encrypt TLS certificates |
- certonly obtain cert without installing
- --nginx / --apache plugin for automatic config
- -d DOMAIN specify domain
- --dry-run test without real request
- renew renew all due certificates
|
certbot certonly --nginx -d example.comcertbot --apache -d example.com -d www.example.comcertbot renewcertbot renew --dry-runcertbot certificates (list existing)
|
fail2ban-client |
Control the fail2ban intrusion-prevention daemon |
- status show overall status
- status JAIL show specific jail status
- set JAIL banip IP manually ban an IP
- set JAIL unbanip IP unban an IP
- reload reload configuration
|
fail2ban-client statusfail2ban-client status sshdfail2ban-client set sshd banip 203.0.113.5fail2ban-client set sshd unbanip 203.0.113.5fail2ban-client reload
|
auditd |
Linux audit daemon service control |
- (service; controlled via systemctl) status/start/stop/restart
- config file: /etc/audit/auditd.conf
|
systemctl status auditdsystemctl restart auditdsystemctl enable auditdcat /etc/audit/auditd.confservice auditd status
|
ausearch |
Search audit daemon logs |
- -k KEY search by rule key
- -m TYPE search by message type
- -ts TIME start time
- -ua USER search by user
- -i interpret uid/gid to names
|
ausearch -k passwd_watchausearch -m USER_LOGIN -ts todayausearch -ua jdoeausearch -i -m AVCausearch -ts recent -k rootcmd
|
setfacl |
Set POSIX ACLs |
- -m modify ACL entry
- -x remove ACL entry
- -b remove all ACL entries
- -R recursive
- -d default ACL for directory
- --set replace entire ACL
|
setfacl -m u:jdoe:rwx /sharedsetfacl -x u:jdoe /sharedsetfacl -Rm g:devs:rx /projectssetfacl -b /sharedsetfacl -d -m u:jdoe:rwx /shared
|
chmod |
Change file mode bits |
- u/g/o/a +/-/= rwx symbolic mode
- numeric mode e.g. 750
- -R recursive
- --reference=FILE copy mode from file
- -v verbose
- -c report changes only
- -f suppress errors
|
chmod 750 /var/www/htmlchmod -R g+rwX /sharedchmod u+x deploy.shchmod --reference=orig.conf new.confchmod -c 644 *.txt
|
useradd |
Create new user |
- -m create home directory
- -d DIR home directory path
- -s SHELL login shell
- -g GROUP primary group
- -G GROUPS secondary groups
- -c COMMENT gecos field
- -e DATE account expiry
- -u UID specify uid
- -r create system account
|
useradd -m -s /bin/bash jdoeuseradd -m -G wheel,devs -s /bin/bash admin1useradd -r -s /sbin/nologin svcacctuseradd -e 2026-12-31 tempuseruseradd -u 5001 -d /opt/app appuser
|
groupadd |
Create new group |
- -g GID specify GID
- -r create system group
- -f exit success if group exists
|
groupadd devsgroupadd -g 2001 developersgroupadd -r svcgroupgroupadd -f existinggroupgroupadd -g 3000 finance
|
su |
Switch user |
- - (dash) start login shell
- -c COMMAND run single command
- -s SHELL specify shell
- -l same as -
- -p preserve environment
|
su - rootsu -c "systemctl restart nginx" rootsu -s /bin/bash jdoesu -l postgressu -p www-data
|
visudo |
Safely edit sudoers file |
- -c check sudoers syntax without editing
- -f FILE edit alternate file
- -s strict syntax checking
|
visudovisudo -cvisudo -f /etc/sudoers.d/customvisudo -ssudo visudo -c
|
chsh |
Change login shell |
- -s SHELL set shell
- -l list available shells
|
chsh -s /bin/zsh jdoechsh -lchsh -s /bin/bashchsh jdoe (interactive)chsh -s $(which fish)
|
passwd |
Change/manage user password |
- -l lock account
- -u unlock account
- -d delete password (no password)
- -e expire immediately, force change
- -S show status
- -n MINDAYS minimum age
- -x MAXDAYS maximum age
- -w WARNDAYS warning period
|
passwd jdoepasswd -l jdoepasswd -e jdoepasswd -S jdoepasswd -x 90 -w 7 jdoe
|
chage |
Manage password aging policy |
- -l list expiry info
- -m MIN minimum days between changes
- -M MAX maximum password age
- -W WARN warning days before expiry
- -I INACTIVE days after expiry to disable
- -E EXPIRE account expire date
- -d LASTDAY set last change date
|
chage -l jdoechage -M 90 jdoechage -W 7 -I 14 jdoechage -E 2026-12-31 jdoechage -d 0 jdoe (force change at next login)
|
gpasswd |
Administer /etc/group |
- -a USER add to group
- -d USER delete from group
- -A USER set administrators
- -M USER set members list
- -r remove group password
|
gpasswd -a jdoe wheelgpasswd -d jdoe wheelgpasswd -A admin1,admin2 devteamgpasswd -M user1,user2 devteamgpasswd -r devteam
|
newgrp |
Log in to a new group (changes primary GID) |
- GROUP switch primary group for session
- - (dash) start login shell with new group
|
newgrp developersnewgrp -newgrp wheelnewgrp financenewgrp - devs
|
id |
Show UID/GID/groups |
- -u print effective UID
- -g print effective GID
- -G print all group IDs
- -n print name instead of number
- -nu / -ng / -nG combine name+category
- -Z print SELinux context
|
id jdoeid -uid -Gn jdoeid -Zid -un
|
whoami |
Show current effective user |
- (no options besides --help/--version)
|
whoamiecho "Current user: $(whoami)"whoami --versionsudo whoamissh host whoami
|
groups |
List group membership |
- (no options; optional USER argument)
|
groups jdoegroupsgroups rootgroups $(whoami)groups www-data
|
last |
Show last logins |
- -n NUM limit lines
- -f FILE alternate wtmp file
- -a display hostname last
- -x show shutdown/runlevel
- -t YYYYMMDDHHMMSS show state at time
|
last -n 10last rebootlast -alast jdoelast -x
|
w |
Who is logged in and what they are doing |
- -h no header
- -s short format
- -f show/hide from field
- -u ignore idle time
|
|
uptime |
How long the system has been running |
- -p pretty format
- -s since (boot time)
- -V version
|
uptimeuptime -puptime -swatch uptimeuptime | awk -F"," "{print \$1}"
|
hostname |
Show/set system hostname |
- status show current settings
- set-hostname NAME
- set-icon-name NAME
- set-chassis TYPE
- set-deployment ENV
- set-location LOC
- --static / --transient / --pretty scope
|
hostnamectl statushostnamectl set-hostname web01hostnamectl set-hostname web01 --prettyhostnamectl set-chassis serverhostnamectl set-deployment production
|
timedatectl |
Control system time/date/timezone |
- status show current settings
- set-time TIME
- set-timezone ZONE
- list-timezones
- set-ntp true/false
- show all properties
|
timedatectl statustimedatectl set-timezone Asia/Singaporetimedatectl set-ntp truetimedatectl list-timezonestimedatectl set-time "2026-07-27 09:00:00"
|
clock |
Query/set hardware clock |
- -r read hardware clock
- -w write system time to hardware clock
- -s set system time from hw clock
- -u treat hw clock as UTC
|
clock -rclock -wsudo hwclock --systohchwclock -shwclock -u -w
|
date |
Print/set system date |
- -d STRING display arbitrary date
- -s STRING set system date/time
- -u UTC/GMT time
- +FORMAT custom output format
- -R RFC-2822 format
- -I[=TIMESPEC] ISO 8601 format
- -r FILE last modification of FILE
|
datedate +"%Y-%m-%d %H:%M:%S"date -d "next friday"sudo date -s "2026-07-27 10:00:00"date -u
|
cal |
Display a calendar |
- -y show whole year
- -3 show previous/current/next month
- -m MONTH specify month
- -j julian day numbers
|
calcal -ycal -3cal 7 2026cal -j
|
bc |
Arbitrary-precision calculator language |
- -l load math library (adds sin, cos, sqrt etc.)
- -q quiet, no welcome banner
- scale=N set decimal precision (inside bc)
|
echo "5+3" | bcecho "scale=2; 10/3" | bcbc -l <<< "sqrt(2)"echo "2^10" | bcbc -q
|
units |
Convert between measurement units |
- FROM TO convert between two units
- -t terse output (just the number)
- -v verbose
|
units "5 miles" "km"units -t "1 gallon" "liters"units "100 fahrenheit" "celsius"unitsunits -v "1 TB" "GB"
|
xxd |
Make a hex dump of a file |
- -r reverse (hex to binary)
- -l LEN limit number of bytes shown
- -c COLS bytes per line
- -p plain hex dump (no addresses/ASCII)
|
xxd file.bin | headxxd -r hexdump.txt > file.binxxd -l 64 file.binxxd -c 8 file.binxxd -p file.bin
|
od |
Dump files in octal/hex/other formats |
- -c character display
- -x hex display (2-byte)
- -A RADIX address radix (d,o,x,n)
- -N BYTES limit bytes read
- -t TYPE specify output format
|
od -c file.binod -x file.bin | headod -A x -t x1z file.binod -N 32 file.binod -t d4 file.bin
|
strings |
Print printable character sequences in a file |
- -n MIN minimum string length to show
- -a scan entire file (not just data sections)
- -t FORMAT show offset (o,d,x)
- -e ENCODING character encoding
|
strings /bin/lsstrings -n 8 binaryfilestrings -a -t x binaryfilestrings -e l file.exestrings /usr/bin/python3 | grep -i version
|
file |
Determine file type |
- -b brief, omit filename
- -i show MIME type
- -z look inside compressed files
- -L follow symlinks
|
file /etc/passwdfile -i document.pdffile -z archive.tar.gzfile -L symlinkfile *.bin
|
stat |
Show detailed file/filesystem status |
- -c FORMAT custom output format
- -f filesystem status instead of file status
- -L follow symlinks
- -t terse output format
|
stat /etc/passwdstat -c "%a %U %G" file.txtstat -f /varstat -L symlinkstat -t /etc/hosts
|
readlink |
Print resolved symbolic links |
- -f canonicalize, resolve all symlinks fully
- -e like -f but requires final path to exist
- -m like -f but does not require any path to exist
|
readlink /etc/alternatives/javareadlink -f ./relative/../pathreadlink -e /etc/hostsreadlink -m /nonexistent/pathreadlink symlink.txt
|
realpath |
Print resolved absolute file path |
- -e require path to exist
- -m no requirement, allow missing components
- --relative-to=DIR output relative to DIR
- -s do not expand symlinks
|
realpath file.txtrealpath -e /etc/hostsrealpath --relative-to=/home .realpath -m /does/not/existrealpath -s ./symlink
|
mktemp |
Create a temporary file or directory |
- -d create a directory instead of a file
- -p DIR use DIR instead of $TMPDIR
- -u dry run, print name without creating
- --suffix=SUFFIX append suffix to generated name
|
mktempmktemp -dmktemp /tmp/myapp.XXXXXXmktemp -d -p /var/tmpmktemp --suffix=.log
|
tempfile |
Create a temporary file (legacy Debian-style) |
- -d DIR directory to create in
- -p PREFIX filename prefix
- -s SUFFIX filename suffix
- -m MODE file permissions
|
tempfiletempfile -p myapp_tempfile -d /tmp -s .logtempfile -m 600FILE=$(tempfile); echo "$FILE"
|
dirname |
Strip last component from a file path |
- -z, --zero — end each output line with NUL
- --help
- --version
|
dirname /var/log/httpd/access_logdirname "$0"dirname /etc/passwddirname ./relative/path/file.txtdirname -z /a/b/c
|
pwd |
Print working directory |
- -L logical (default)
- -P physical, resolve symlinks
|
pwdpwd -Ppwd -Lcd /tmp; pwd(cd /var/log && pwd)
|
cd |
Change directory |
- -L logical path (default)
- -P physical path, resolve symlinks
- -e exit non-zero if -P dir not found
- cd - previous dir
- cd (no args) $HOME
|
cd /var/logcd ..cd -cd ~jdoecd -P /var/www/html
|
pushd |
Push a directory onto the directory stack |
- DIR — push DIR and cd into it
- +N rotate to Nth directory in stack
- -n suppress directory change, only manipulate stack
|
pushd /var/logpushd +1pushd -n /tmppushd ~/projectspushd ..
|
dirs |
Display the directory stack |
- -c clear the directory stack
- -v verbose, one per line with index
- -p print one per line (no index)
- +N/-N show single entry by index
|
dirsdirs -vdirs -cdirs -pdirs +1
|
alias |
Create a shorthand for a command (duplicate — see above) |
- NAME=VALUE define an alias
- -p print all defined aliases (no args also works)
|
alias ll="ls -la"alias grep="grep --color=auto"alias -palias rm="rm -i"alias ..="cd .."
|
unalias |
Remove an alias (duplicate — see above) |
- -a remove all aliases
- NAME remove specific alias
|
unalias llunalias -aunalias grepunalias ..unalias rm
|
history |
Show command history (duplicate — see above) |
- -c clear history
- -d OFFSET delete entry
- -a append session history to file
- -r read history file into current session
- -w write history to file
- -n read new lines not yet read
- N show last N lines
|
history 20history -chistory -d 45!123 (re-run command 123)history | grep yum
|
fc |
Fix/re-execute a command from history |
- -l list recent commands
- -e EDITOR choose editor for command
- -s re-execute a command (like history substitution)
|
fc -lfc -l -10fc -s ls (re-run last ls)fc -e vim 15fc -l 10 20
|
bind |
Display or set readline key bindings |
- -p list all key bindings and functions
- -P list bindings in readable form
- -x KEYSEQ:CMD bind a key to a shell command
- -f FILE read bindings from file
|
bind -p | lessbind -x '"\C-l":clear'bind -Pbind -f ~/.inputrcbind '"\e[A": history-search-backward'
|
shopt |
Set/unset bash shell options |
- -s OPTION enable a shell option
- -u OPTION disable a shell option
- -p print all options and their state
- -q quiet, test option state via exit code
|
shopt -s nullglobshopt -u dotglobshopt -pshopt -s histappendshopt -q extglob
|
set |
Set shell options and positional parameters |
- -e exit immediately on error
- -x print commands before executing (xtrace)
- -u treat unset variables as error
- -o pipefail fail pipeline if any command fails
- -- separate options from positional args
|
set -eset -xset -euo pipefailset -- arg1 arg2set +x (disable tracing)
|
unset |
Remove a variable (duplicate — see above) |
- -v unset a variable (default)
- -f unset a function
|
unset MYVARunset -f myfunctionunset HISTFILEunset -v PATH_BACKUPunset TMPDIR
|
export |
Export a variable (duplicate — see above) |
- -p list all exported variables
- -n unexport a variable
- NAME=VALUE set and export
|
export PATH=$PATH:/opt/binexport -pexport -n MYVARexport JAVA_HOME=/usr/lib/jvm/java-11export EDITOR=vim
|
source |
Execute a script in current shell (duplicate — see above) |
- FILE [args] — read and execute commands from file in current shell (alias: .)
|
source ~/.bashrcsource /etc/profilesource venv/bin/activatesource script.sh arg1. ./config.sh
|
. |
Execute commands from a file (POSIX alias for source) |
- FILE [args] — read and execute commands from file in current shell (same as source)
|
. ~/.bashrc. ./env.sh. /etc/profile. venv/bin/activate. script.sh arg1
|
exec |
Replace shell / redirect descriptors (duplicate — see above) |
- COMMAND — replace shell process with COMMAND
- -a NAME set argv[0] name
- N<&M / N>&M — redirect file descriptors (no new process)
|
exec bashexec 3< file.txtexec > output.log 2>&1exec -a myproc ./binaryexec ssh host
|
eval |
Construct and execute a command from arguments |
- STRING — construct and execute a command from arguments
|
eval "ls -l $DIR"eval $(ssh-agent -s)eval "echo \$$VARNAME"CMD="ls -l"; eval $CMDeval "$(cat command.txt)"
|
wait |
Wait for background jobs to complete |
- %N wait for specific job
- PID wait for specific process ID
- -n wait for next job to finish (any)
|
wait %1wait 1234wait -nwait (wait for all background jobs)job1 & job2 & wait
|
jobs |
List active jobs (duplicate — see above) |
- -l list PIDs too
- -p list only PIDs
- -r running jobs only
- -s stopped jobs only
|
jobsjobs -ljobs -pjobs -rjobs -s
|
bg |
Resume a job in the background (duplicate — see above) |
- %N resume specific stopped job in background (no other options)
|
bgbg %1bg %2CTRL-Z then bgbg %vim
|
disown |
Remove a job from the shell job table (duplicate — see above) |
- -h keep job in job list but not sent SIGHUP
- -a apply to all jobs
- -r apply to running jobs only
- %N specify job by number
|
disown %1disown -h %2disown -adisown -rcommand & disown
|
kill |
Send a signal to a process by PID |
- -SIGNAL or -s SIGNAL name/number
- -l list signal names
- -9 SIGKILL
- -15 SIGTERM (default)
- -1 SIGHUP
|
kill -15 $(pgrep httpd)kill -9 1234kill -HUP $(cat /var/run/nginx.pid)kill -lkill %1
|
killall |
Send a signal to processes by name |
- -SIGNAL name/number
- -i interactive confirm
- -u USER match only user processes
- -w wait for processes to die
- -v report if signal sent
|
killall httpdkillall -9 javakillall -u jdoe -i firefoxkillall -w sshdkillall -v nginx
|
pkill |
Kill processes matching a pattern |
- -SIGNAL specify signal
- -u USER
- -f full cmdline match
- -x exact match
- -o oldest match
|
pkill -9 -f myscript.pypkill -u jdoepkill httpdpkill -x bashpkill -o -f server.js
|
pgrep |
Find processes matching a pattern |
- -l list name with PID
- -u USER match effective user
- -f match full cmdline
- -x exact match
- -n newest matching
- -o oldest matching
|
pgrep -l sshdpgrep -u nginxpgrep -f "java -jar app"pgrep -n httpdpgrep -x cron
|
nice |
Set process priority (duplicate — see above) |
- -n ADJUSTMENT set niceness (-20 highest to 19 lowest priority)
- --help
- --version
|
nice -n 10 commandnice -n -5 sudo makenice --adjustment=15 backup.shnice tar czf a.tgz /datanice -19 find / -name "*.tmp"
|
ionice |
Set I/O scheduling priority (duplicate — see above) |
- -c CLASS 1=realtime 2=best-effort 3=idle
- -n LEVEL priority 0-7 (with class 1/2)
- -p PID apply to existing process
- -t ignore failure to set priority
|
ionice -c2 -n7 dd if=/dev/zero of=/tmp/test bs=1M count=100ionice -c3 rsync -a /src /dstionice -p 4321 -c1 -n0ionice -c2 -n0 backup.shionice -t -c3 updatedb
|
schedtool |
Query/set scheduler policy and CPU affinity |
- -F FIFO scheduling policy
- -B batch scheduling policy
- -N normal scheduling policy
- -p PRIORITY set priority
- -e run command with settings applied
|
schedtool -F -p 10 -e myprogschedtool -B -e backup.shschedtool -N -p 0 -e normaltaskschedtool -r -a 0,1 -e myprogschedtool -F -p 99 -e realtime_task
|
taskset |
Set/get a process's CPU affinity |
- -c LIST specify CPU list (e.g. 0-3)
- -p PID apply to existing process
- -a apply to all threads of process
|
taskset -c 0-3 myprogtaskset -p 1234taskset -pc 2 1234taskset -c 0,2,4 myprogtaskset -a -c 0-1 -p 5678
|
numactl |
Control NUMA policy for processes/memory |
- --cpunodebind=NODE bind CPU execution to NUMA node
- --membind=NODE bind memory allocation to NUMA node
- --hardware show NUMA hardware layout
- --show show current NUMA policy
|
numactl --cpunodebind=0 --membind=0 myprognumactl --hardwarenumactl --shownumactl --interleave=all myprognumactl --physcpubind=0-3 myprog
|
ulimit |
Show/set per-user resource limits |
- -a show all limits
- -n max open file descriptors
- -u max user processes
- -f max file size
- -v max virtual memory
- -S soft limit
- -H hard limit
|
ulimit -n 4096ulimit -aulimit -u 2048ulimit -Hnulimit -Sf unlimited
|
prlimit |
Get/set process resource limits |
- --pid=PID target process
- --nofile=SOFT:HARD set file descriptor limit
- --nproc=SOFT:HARD set process limit
- --output=FIELDS custom columns
|
prlimit --pid 1234 --nofile=4096prlimit --pid 1 --nprocprlimit --pid 1234 --nofile=2048:4096prlimit -p 5678 --memlockprlimit --output=RESOURCE,SOFT,HARD --pid 1
|
sysctl |
Read/write kernel runtime parameters |
- -a show all parameters
- -w NAME=VALUE set at runtime
- -p [FILE] load from sysctl.conf
- -n show value only, no name
- --system load all system config files
|
sysctl -a | grep ip_forwardsysctl -w net.ipv4.ip_forward=1sysctl -p /etc/sysctl.d/99-custom.confsysctl net.ipv4.tcp_syncookiessysctl --system
|
/proc/sys/ |
Kernel tunables filesystem interface |
- (not a command; a filesystem path) — read: cat /proc/sys/PATH
- write: echo VALUE > /proc/sys/PATH
- tree mirrors sysctl names, e.g. net/ipv4/ip_forward
|
cat /proc/sys/net/ipv4/ip_forwardecho 1 > /proc/sys/net/ipv4/ip_forwardcat /proc/sys/vm/swappinessecho 10 > /proc/sys/vm/swappinessls /proc/sys/kernel/
|
modprobe |
Load/unload a kernel module and dependencies |
- -r remove module
- -v verbose
- -n dry run
- -f force load
- -l list matching modules (deprecated)
|
modprobe -v e1000emodprobe -r nf_conntrackmodprobe -n bondingmodprobe -f dummymodprobe bonding mode=1
|
lsmod |
List currently loaded kernel modules |
- (no options; lists loaded kernel modules)
|
lsmodlsmod | grep nf_conntracklsmod | wc -llsmod | grep -i raidlsmod > /tmp/modules.txt
|
rmmod |
Remove a kernel module |
- -f force removal
- -v verbose
- -s log to syslog
- MODULE — module name to remove
|
rmmod dummyrmmod -f nf_conntrackrmmod -v bondingrmmod looprmmod -s e1000e
|
insmod |
Insert a single kernel module |
- (no standard options besides module path and params)
- MODULE.ko
- param=value pairs after module path
|
insmod /lib/modules/$(uname -r)/kernel/drivers/net/dummy.koinsmod ./mymodule.ko debug=1insmod bonding.ko mode=1 miimon=100insmod ./test.koinsmod /path/to/module.ko param=value
|
depmod |
Generate module dependency list |
- -a process all modules (default)
- -n dry run, print to stdout
- -v verbose
|
depmod -adepmod -vdepmod -ndepmod $(uname -r)sudo depmod -a
|
kmod |
Low-level tool for managing kernel modules |
- list — list loaded modules (like lsmod)
- insert MODULE — load a module
- remove MODULE — unload a module
- static-nodes — generate static device nodes
|
kmod listkmod insert /path/to/module.kokmod remove bondingkmod static-nodeskmod list | grep nf_
|
lsmod |
List loaded kernel modules (duplicate — see above) |
- (no options; lists loaded kernel modules)
|
lsmodlsmod | grep nf_conntracklsmod | wc -llsmod | grep -i raidlsmod > /tmp/modules.txt
|
lsmod |
List loaded kernel modules (duplicate — see above) |
- (no options; lists loaded kernel modules)
|
lsmodlsmod | grep nf_conntracklsmod | wc -llsmod | grep -i raidlsmod > /tmp/modules.txt
|
lsmod |
List loaded kernel modules (duplicate — see above) |
- (no options; lists loaded kernel modules)
|
lsmodlsmod | grep nf_conntracklsmod | wc -llsmod | grep -i raidlsmod > /tmp/modules.txt
|