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

main_linux-commands-cheat-sheet (1)

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)
11 views

main_linux-commands-cheat-sheet (1)

Uploaded by

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

Linux Commands Cheat Sheet

Hardware Information
Searching File Commands System Management and Info
Disk Usage

dmesg grep [pattern] [file] Search for a pattern in


Show bootup a file ls List files in the directory uname -r Show system information
cat /proc/cpuinfo grep -r [pattern] [directory] Search a pattern
messages Show CPU recursively ls -a List files, include hidden uname -a Show kernel release info df -h Show free space on
free -h locate [name] system
information Search for files & pwd files Show current uptime Show uptime length/avg. df -l Show free nodes on
lshw find [/location] -name [x] system
Show free and used List items beginning mkdir [name] directory Create a hostname load Show system fdisk -l Disk partition types and
with [x]
lsblk find [/location] -size [+100M] sizes
memory Hardware List items larger than rm [file] directory hostname -l hostname Show system du -ah Show disk usage for all
lspci -tv 100MB files
configuration info Block rm -r [directory] Remove a file last reboot IP address Show reboot Show disk usage for
du -sh
lsusb -tv current directory
devices info File Transfer rm -rf [directory] Recursively remove date history
findmnt Show target mount
Tree-diagram of PCI directory Force remove Show current time and date point
mount [device] [mount_point] Mount a device
devices Tree-diagram of directory

USB devices
dmidecode Show BIOS hardware cp [file1] [file2] Copy file1 to file2 timedatectl Manage the system clock
info scp [file.txt] [server/tmp] Create a tar file from a
file
hdparm -i /dev/[disk] cp -r [directory1] [directory2] Copy directory1 to cal Show current day and
Show disk data info rsync -a [/location]
Sync the contents of
hdparm -tT /dev/[disk] mv [filename1] [filename2] directory2 Rename afile whoami month Show the current
[/backup/] a location with the
Disk read speed
badblocks -s /dev/[disk]
backup directory
ln -s [/path/file] [link] finger [username]
Variables
Create symbolic link to user
test Unreadable file
touch [file] ulimit [flags] [limit] Show user information let "[variable]=[value]" Assign integer value to var
blocks test Create a new file
View or limit system resources export [variable] Export a Bash variable

File Compression Process Related declare [variable]="[value]" Declare a Bash variable


more [file] Show file contents shutdown [hh:mm] Schedule a system shut down
tar cf [file.tar] [file] Create a tar file from a set List variables and functions
ps Show active process head [file] Show first 10 lines of a shutdown now Shut down immediately
snapshot
tar xf [file.tar] Extract archived echo $[variable] Display value of the
pstree file Show processes as a tail [file] file Show last 10 lines modprobe [module-name] Add a new kernel module variable
killall [process_name] tree
tar czf [file.tar.gz] Create a gzip tar
file Show process memory gpg -c [file] of a file Encrypt a file Show all network
pmap
usage interfaces
gzip [file] Create a gz compressed
file Show all running gpg [file.gpg]
top Decrypt a file Network Management
processes Shell Command Management
kill [process_id] Kill the process by wc Count words/lines/bytes
ID
ip addr Show IP alias [alias]='[command]' Create command
pkill [process_name] Kill the process by ls | xargs wc show
Words/lines/bytes in addresses alias
Package Installation name watch -n [interval] [command]Set interval to run a command
ip address add [ip] Assign IP address to
Kill all processes by cut -d[delimiter] [file] interface
name directory Cut file section sleep [interval] && [command] Postpone command execution
yum search [keyword] Find a package by a trap "[commands]" [signal] ifconfig
keyword List background [data] | cut -d[delimiter]
bg and print
processes
netstat -pnltu
Most recent suspended awk '[pattern] {print $0}' [file] dig -x [ip] IP address reverse
yum info [package] Package info & Cut data section and print
apt install [package] Install a package with job to foreground lookup
fg summary netstat -nutlp Print command
APT
shred -u [file] history
Bring [job] to Print lines matching a
yum Install whois [domain] Show domain's DNS
foreground info
install [package.rpm] a package with diff [file1] pattern Overwrite and
List files opened by Domain reverse Keyboard Shortcuts
fg [job] dig [domain]
[file2] source lookup
delete a file Compare two
Execute command on
dnf Install dig -x [host]
signal [file]
install [package.rpm] a package with files
lsof
[command] | tee [file]
Pause terminal until Compile from source
rpm -i [package.rpm] >/dev/null
process completes code
Install a local rpm
package Store command output to
a Ctrl + Z Stop process (can be
rpm Remove
Users and Groups
file, skip terminal output hostname -l Show local IP resumed)
-e [package.rpm] an rpm
address Ctrl + W Cut the word before the
wait
cursor

Ctrl + C Kill current


process
tar zxvf [source_code.tar.gz]
chown [user]:[group] [file] Change file owner and userdel [user] Delete a cd [/location] Change to a
cd [source_code] !! Repeat the last
user specified directory
./configure command
usermod Modify user
make Install software from exit Log out of the
information
make install nohup Run host IP session
Ctrl + Cut part of the line
curl -O [file_url] Download a file from U before the cursor
last Show last system
chmod 777 [file] File read, write, logins
nslookup [domain] Show domain Ctrl + K Cut part of the line after
SSH Login execute permissions who Show who is
information the cursor
to everyone logged in
chmod 755 [file] Full permission to w Show logged users and
Ctrl + Y Paste from
ssh [user]@[host] Connect to host as owner, read activity
Directory Navigation clipboard
user permissions for others groupadd [group] Add a new
Ctrl + R Recall last
Full permission to group
command
ssh Connect chmod owner, read and write adduser [user] Add a new cd .. Move up one Ctrl + O Run the recalled
ssh -p [host]
[port] [user]@[host] Use a non-default
to host via 766 [file] for others user level command
port chown [user] [file] Change file usermod -aG [group] [user] Add user to cd Change directory to Ctrl + G Exit command
telnet [host] Connect to Telnet via group $HOME history
port 23

chgrp [group] [directory] Change directory


group

You might also like