Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

main_linux-commands-cheat-sheet

Uploaded by

demy2014
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

main_linux-commands-cheat-sheet

Uploaded by

demy2014
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Linux Commands Cheat

Sheet Searching

Hardware Information
File Commands Directory Navigation

grep [pattern] search for a specific pattern ls list files in cd .. move up one level in the
dmesg show [file_name] in a file directory directory tree structure
cat /proc/cpuinfo show CPU bootup ls -a list all files, including
information find [/folder/location] list names that begin with rm [file_name] remove
hidden a
grep -r [pattern] search recursively for a cd change directory to
lsblk list information about block -name [a] [a] in [/folder/location] file
free -h show free and used memory (- [directory_name] specific pattern in a pwd show the directory $HOME
devices rm -r remove a directory
m flag indicates memory in MB) directory currently working in cd /chosen/directory change to specified
[directory_name] recursively
locate [name] find all files and directories directory
lshw list information about by a specific name mkdir [directory] create a new
hardware configuration directory

lspci -tv show PCI devices in a tree-like find [/folder/location] list files larger than 100M
diagram -size [+100M] in a particular folder rm -rf [directory_name] remove a directory
Users
lsusb -tv show USB devices in a recursively without
tree-like diagram requiring confirmation
id show details of the active
cp [file_name1] [file_name2] copy the contents of the first file
user
dmidecode show hardware information to
the second file last show the last logins onto
from the BIOS
the system
cp -r [directory_name1] recursively copy the contents
hdparm -i /dev/[disk] show information about disk [directory_name2] of the first directory into the
data second directory who show who is logged into the
File Transfer system
hdparm -tT /dev/[disk] conduct a read speed test on
disk w show who is logged in and
mv [file_name1] rename file_name1 to
file_name2 their activity
badblocks -s /dev/[disk] test for unreadable blocks on scp [file_name.txt] securely copy a specific [file_name2]
disk [server/tmp] file to a server directory
groupadd add a new
ln -s /path/to/[file_name] create a symbolic link to
head [file_name] show the first 10 lines of [group_name] group
rsync -a synchronize the contents [link_name] a file
a file
[/your/directory] of a specific directory with
adduser [user_name] add new
[/backup/] a backup directory touch [file_name] create a new
Process Related file usermod
user
use for changing / modifying
tar xf [compressed_file. extract archived gpg -c [file_name] encrypt a usermod -aG add a user to a
more [file_name] show the contents of a user information
tar] File Compression
file file
file [group_name] group
ps show a snapshot of gpg [file_name.gpg] decrypt a [user_name]
active processes file
tar czf create a gzip compressed
tar cf [compressed_file. create
tar file an archived file from wc print the number of words, delete a
[compressed_file.tar.gz] userdel [user_name]
tar] [file_name] a file tail [file_name] show the last 10 lines of
show processes as a lines, and bytes in a file user
pstree a file
tree

Disk Usage
top show all running
processes

gzip [file_name] compress a file with


the .gz extension pmap shows a memory usage
map of processes

show disk partitions, sizes,


df -h show free and used
kill [process_id] kill a process under a uptime
System Information
show how long the system has and types
space on mounted
bg list
givenandIDresume stopped
yum info show package information been running, including load systems
jobs in the background
[package_name]
Package Installation
and summary pkill [proc_name] kill a process under the
uname -r
average
show system
du
df -i-ah
show disk inodes
show free usage for
on all files
specified name show system and directory
bring the most recent hostname information mounted filesystems
fg
hostname
yum
yuminstall
search install
find a package by
using
a the suspended job to the
hostname show the IP address of the du -sh show disk usage of
[package_name.
[keyword] YUM package
related manager
keyword killall foreground
kill uname -i show fdisk current directory
system -l
rpm] fg [job] [proc_name] bring all processesjob
a particular labelled
to -a kernelreboot
show system release
the foreground last reboot
history findmnt show target mount point
dnf install install a package using the
show current time and for all filesystems
[package_name. DNF package manager list files opened by date
lsof
date
rpm] processes
timedatectl query and change the system mount [device_path] mount a
clock [mount_point] device
rpm -i install an rpm package from a
[package_name. local file cal show current calender month
rpm] and day

remove an rpm
package
File Permission whoami show user you are
using

rpm -e w show logged in users in the Ctrl + C kill current process running
chmod 755 [file_name] give full permission to owner, system in the terminal
[package_name.
rpm] and read and execute
permission to group and Ctrl + Z stop current process (can be
tar zxvf
others finger show information about a Keyboard resumed
Shortcuts
in the foreground
chmod 777 [file_name] give read, write, and
chmod 766 [file_name] give full permission to owner, [username] user with fg or in the background
[source_code.tar.gz] install software from source execute permission to
code and read and write with bg)
cd [source_code] everyone
permission to group and Network Ctrl + W cut one word before the cursor
./configure
others and add it to clipboard
make
make install chown [user] change the file ip addr show IP addresses and
SSH Login [file_name] ownership show network interfaces Ctrl + cut part of the line before
U the cursor and add it to
chown [user]: [group] change the owner and ip address add assign an IP address to clipboard
ssh user@host connect to host as [file_name] group ownership of a file [IP_address] interface eth0 Ctrl + K cut part of the line after the
user cursor and add it to clipboard
ssh host securely connect to host via ifconfig show IP addresses of all
SSH default port 22 network interfaces Ctrl + Y paste from
clipboard
recall last command that
matches the provided
netstat -nutlp show tcp and udp ports and characters
telnet host connect to host via telnet their programs Ctrl + O run the previously
default port 23 recalled command
whois [domain] show more information
connect to host using a about a domain Ctrl + G exit command history
ssh -p [port] user@host netstat -pnltu show active (listening) Ctrl + R
particular port ports without running a
dig [domain] show DNS information command
about a domain !! repeat the last
command

dig -x host reverse lookup on exit log out of current


domain session
dig -x reverse lookup of an IP
[ip_address] address

host [domain] do an IP lookup for a


domain
hostname -I show the local IP
address
wget [file_name] download a file from a
domain

You might also like