Linux Cheat Sheet
Linux Cheat Sheet
uname Displays system information: kernel version, chmod 644 /data/ Sets the permissions of the file data test.c to / /
machine type, and more. test.c be /
read write for the owner, and read-only for
uname -r Displays the running Linux kernel's release the group and others.
version. chmod 755 /dir1 Assigns read, write, and execute permissions
uptime Shows current time, system uptime, users, to the owner, and read and execute
and load averages. permissions to the group and others for the
Hardware
ping host Sends I C MP packets, measures round-trip
time to "host".
dmesg Displays messages from the kernel's ring whois domain Retrieves and displays domain's registration
buffer. information.
/ /
cat proc cpuinfo Displays detailed information about the C PU. dig domain Queries DNS, provides domain's DNS
cat /proc/meminfo
information.
Displays detailed system memory usage
information. dig -x host Resolves IP address to hostname, shows DNS
information.
lshw Lists detailed hardware configuration of the
system. host google.com Performs an IP lookup for the domain name
lsblk Lists information about all available block wget file_ path Downloads file from specified path.
devices. netstat Displays various network-related information
free -m Shows system memory usage in megabytes. and statistics.
lsusb -tv Shows US B devices as a tree, verbosely. tar -cf backup.tar / Creates a tar archive of /home/u buntu
who Displays who is currently logged in. rpm -i Installs the package "pkg _ name.rpm" using
groupadd admin Creates a new user group named admin. pkg _ name.rpm RPM Package Manager.
adduser Sam Creates a new user account named Sam. rpm -e pkg _ name Uninstalls the specified RPM package.
dnf install pkg _ name Installs the specified package using DNF.
userdel Sam Deletes the user account named Sam.
pacman -S Installs the specified package using Pacman.
usermod Modifies properties of an existing user
pkg _ name
account.
mkdir dir1 Creates a new directory named dir . 1 make install Installs compiled code into specified system
rm file1 Deletes the file named file1. locations.
/
ln -s path to / / Creates sym bolic link named link_ name to /
find home -name Searches " /home " directory for files named
input.
Login
more file1 Displays file1 content, paginating through
output. ssh user @hostname Initiates SS H connection to specified
head file1 Displays the first ten lines of file1. hostname.
tail file1 Displays the last ten lines of file1. ssh -p port_ number Initiates SS H connection using specific port.
gpg -c file1 Encrypts file1 with symmetric cipher using user @hostname
passphrase. Connect to the host Securely connect to the system via SS H
via telnet default default port 22
gpg file2.gpg Decrypts file2.gpg, prompting for the
port 23
passphrase.
wc Counts words, lines, and characters in files. telnet host Connect to the host via telnet default port 23.
xargs Executes commands with piped or file- File Transfer
provided arguments.
scp file.txt Copies file.txt to remote host's specified
Process Related remoteuser @remote directory.
_host:/remote/
ps Displays a snapshot of current processes. directory
ps aux | grep telnet Displays running telnet processes with rsync -a home / / Synchronizes content from source directory
details. ubuntu / backup / to destination directory,preserving attributes.
pmap Shows memory map of a process. rsync -a var www / / / Synchronizes local directory to remote,
top Displays dynamic real-time view of running web / preserving attributes.
tasks. user@remote host:/ _
pstree Displays a tree of running processes. du -sh dir1 / Displays summary of total disk usage size of /
dir1, human-readable.
Directory Traverse