Linux Commands Cheat Sheet - Merged
Linux Commands Cheat Sheet - Merged
Linux Commands Cheat Sheet - Merged
netstat -r -v print network information, sed stream editor csh, tcsh C shell cal print calender
routing and connections
pico simple editor perl Practical Extraction and Report export assign or remove environment
telnet user interface to the TELNET Language variable
protocol
source [file] load any functions file into the ` [command] backquote, execute command
tcpdump dump network traffic Directory Utilities current shell, requires the file
to be executable date -d print formatted date
ssh -i openSSH client
mkdir create a directory $[variable] if set, access the variable
ping -c print routing packet trace to
host network rmdir remove a directory
dmesg show bootup messages grep [pattern] search for a specific pattern in a ls list files in directory cd .. move up one level in the directory
[file_name] file tree structure
cat /proc/cpuinfo show CPU information ls -a list all files, including hidden
grep -r [pattern] search recursively for a specific cd change directory to $HOME
free -h show free and used memory (-m flag [directory_name] pattern in a directory pwd show the directory currently
indicates memory in MB) working in cd /chosen/directory change to specified directory
locate [name] find all files and directories by a
lshw list information about hardware specific name mkdir [directory] create a new directory
configuration
find [/folder/location] list names that begin with [a] in rm [file_name] remove a file
lsblk list information about block devices -name [a] [/folder/location]
rm -r [directory_name] remove a directory recursively
lspci -tv show PCI devices in a tree-like diagram find [/folder/location] list files larger than 100M in a
-size [+100M] particular folder rm -rf [directory_name] remove a directory recursively Users
lsusb -tv show USB devices in a tree-like without requiring confirmation
diagram
id show details of the active user
cp [file_name1] [file_name2] copy the contents of the first file to
dmidecode show hardware information from the the second file
last show the last logins onto the
BIOS
system
cp -r [directory_name1] recursively copy the contents of the
hdparm -i /dev/[disk] show information about disk data [directory_name2] first directory into the second
who show who is logged into the system
File Transfer directory
hdparm -tT /dev/[disk] conduct a read speed test on disk
w show who is logged in and their
mv [file_name1] rename file_name1 to file_name2
activity
badblocks -s /dev/[disk] test for unreadable blocks on disk scp [file_name.txt] securely copy a specific file to a [file_name2]
[server/tmp] server directory
groupadd add a new group
ln -s /path/to/[file_name] create a symbolic link to a file
[group_name]
rsync -a synchronize the contents of a [link_name]
[/your/directory] specific directory with a backup
adduser [user_name] add new user
[/backup/] directory touch [file_name] create a new file
kill [process_id] kill a process under a given ID System Information df -h show free and used space on
mounted systems
Package Installation pkill [proc_name] kill a process under the specified df -i show free inodes on mounted
uname -r show system information
name filesystems
yum search find a package by a related uname -a show kernel release information
killall [proc_name] kill all processes labelled proc fdisk -l show disk partitions, sizes, and
[keyword] keyword
uptime show how long the system has been types
bg list and resume stopped jobs in
yum info show package information and running, including load average
the background du -ah show disk usage for all files and
[package_name] summary
hostname show system hostname directory
fg bring the most recent suspended
yum install install a package using the YUM job to the foreground
hostname -i show the IP address of the system du -sh show disk usage of current
[package_name. package manager
directory
rpm] fg [job] bring a particular job to the
last reboot show system reboot history
foreground findmnt show target mount point for all
dnf install install a package using the DNF
date show current time and date filesystems
[package_name. package manager lsof list files opened by processes
rpm]
timedatectl query and change the system clock mount [device_path] mount a device
[mount_point]
rpm -i install an rpm package from a local
[package_name. file cal show current calender month and
rpm] day
ssh -p [port] user@host connect to host using a particular netstat -pnltu show active (listening) ports Ctrl + R recall last command that matches
port the provided characters
netstat -nutlp show tcp and udp ports and their
telnet host connect to host via telnet default programs Ctrl + O run the previously recalled
port 23 command
whois [domain] show more information about a
domain Ctrl + G exit command history without
running a command
dig [domain] show DNS information about a
domain !! repeat the last command
dig -x host reverse lookup on domain exit log out of current session