Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Linux Commands Cheat Sheet PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

LinuxCommandsCheatSheet

Hardware Information Searching File Commands System Management and Info Disk Usage

dmesg Show bootup messages grep [pattern] [ le] Search for a pattern in a le ls List les in the directory uname -r Show system information df -h Show free space on system

cat /proc/cpuinfo Show CPU information grep -r [pattern] [directory] Search a pattern recursively ls -a List les, include hidden les uname -a Show kernel release info df -l Show free nodes on system

free -h Show free and used memory locate [name] Search for les & directories pwd Show current directory uptime Show uptime length/avg. load fdisk -l Disk partition types and sizes

lshw Hardware con guration info nd [/location] -name [x] List items beginning with [x] mkdir [name] Create a directory hostname Show system hostname du -ah Show disk usage for all les

lsblk Block devices info nd [/location] -size [+100M] List items larger than 100MB rm [ le] Remove a le hostname -l Show system IP address du -sh Show disk usage for current
directory
lspci -tv Tree-diagram of PCI devices rm -r [directory] Recursively remove directory last reboot Show reboot history
ndmnt Show target mount point
lsusb -tv Tree-diagram of USB devices File Transfer rm -rf [directory] Force remove directory date Show current time and date
mount [device] [mount_point] Mount a device
dmidecode Show BIOS hardware info cp [ le1] [ le2] Copy le1 to le2 timedatectl Manage the system clock
scp [ le.txt] [server/tmp] Securely copy file to server
hdparm -i /dev/[disk] Show disk data info cp -r [directory1] [directory2] Copy directory1 to directory2 cal Show current day and month
rsync -a [/location] [/backup/] Sync the contents of a
location with the backup Variables
hdparm -tT /dev/[disk] Disk read speed test mv [ lename1] [ lename2] Rename a le whoami Show the current user
directory
badblocks -s /dev/[disk] Unreadable blocks test ln -s [/path/ le] [link] Create symbolic link to le nger [username] Show user information let "[variable]=[value]" Assign integer value to var

touch [ le] Create a new le ulimit [ ags] [limit] View or limit system resources export [variable] Export a Bash variable
Process Related
File Compression more [ le] Show le contents shutdown [hh:mm] Schedule a system shut down declare [variable]="[value]" Declare a Bash variable

ps Show active process snapshot head [ le] Show rst 10 lines of a le shutdown now Shut down immediately set List variables and functions
tar cf [ le.tar] [ le] Create a tar le from a le
pstree Show processes as a tree tail [ le] Show last 10 lines of a le modprobe [module-name] Add a new kernel module echo $[variable] Display value of the variable
tar xf [ le.tar] Extract archived le
pmap Show process memory usage gpg -c [ le] Encrypt a le
tar czf [ le.tar.gz] Create a gzip tar le
top Show all running processes gpg [ le.gpg] Decrypt a le
gzip [ le] Create a gz compressed le Network Management Shell Command Management
kill [process_id] Kill the process by ID wc Count words/lines/bytes
ip addr show Show IP addresses alias [alias]='[command]' Create command alias
pkill [process_name] Kill the process by name ls | xargs wc Words/lines/bytes in directory
Package Installation ip address add [ip] Assign IP address to interface watch -n [interval] [command] Set interval to run a command
killall [process_name] Kill all processes by name cut -d[delimiter] [ le] Cut le section and print
ifcon g Show all network interfaces sleep [interval] && [command] Postpone command execution
yum search [keyword] Find a package by a keyword bg List background processes [data] | cut -d[delimiter] Cut data section and print
netstat -pnltu Show active listening ports at [hh:mm] Schedule a job
yum info [package] Package info & summary fg Most recent suspended job to awk '[pattern] {print $0}' [ le] Print lines matching a pattern
foreground
netstat -nutlp Show tcp and udp ports man [command] Display command manual
yum install [package.rpm] Install a package with YUM shred -u [ le] Overwrite and delete a le
fg [job] Bring [job] to foreground
whois [domain] Show domain information history Print command history
dnf install [package.rpm] Install a package with DNF di [ le1] [ le2] Compare two les
lsof List les opened by processes
dig [domain] Show domain's DNS info
rpm -i [package.rpm] Install a local rpm package source [ le] Compile from source code
trap "[commands]" [signal] Execute command on signal
rpm -e [package.rpm] Remove an rpm package
dig -x [host] Domain reverse lookup Keyboard Shortcuts
[command] | tee [ le] Store command output to a
wait Pause terminal until process >/dev/null le, skip terminal output dig -x [ip] IP address reverse lookup
apt install [package] Install a package with APT completes Ctrl + C Kill current process
host [domain] IP lookup for a domain
tar zxvf [source_code.tar.gz] Install software from source nohup [command] & Run a process in background Ctrl + Z Stop process (can be resumed)
cd [source_code] code Users and Groups hostname -l Show local IP address
./con gure Ctrl + W Cut the word before the cursor
make
wget [ le_url] Download a le from url
make install File Permission id Show active user details
Ctrl + U Cut part of the line before the
curl -O [ le_url] Download a le from url cursor
last Show last system logins
chmod 777 [ le] File read, write, execute
nslookup [domain] Show domain information Ctrl + K Cut part of the line after the
SSH Login permissions to everyone who Show who is logged in
cursor

chmod 755 [ le] Full permission to owner, w Show logged users and activity
Ctrl + Y Paste from clipboard
ssh [user]@[host] Connect to host as user read permissions for others
Directory Navigation
groupadd [group] Add a new group
Ctrl + R Recall last command
ssh [host] Connect to host via port 22 chmod 766 [ le] Full permission to owner,
read and write for others adduser [user] Add a new user cd .. Move up one level Ctrl + O Run the recalled command
ssh -p [port] [user]@[host] Use a non-default port
chown [user] [ le] Change le ownership usermod -aG [group] [user] Add user to group cd Change directory to $HOME Ctrl + G Exit command history
telnet [host] Connect to Telnet via port 23
chown [user]:[group] [ le] Change le owner and group userdel [user] Delete a user cd [/location] Change to a speci ed !! Repeat the last command
directory
usermod Modify user information
exit Log out of the session

chgrp [group] [directory] Change directory group

You might also like