#Linux Cheatsheet
#Files and navigating
#Networking
#Processes
#System Info
#Compressing
#Permissions
#Others
#Files and Navigating
#Directory listening
ls
#Formatted listening
ls -l
#Formatted listening including hidden files
ls -la
#Change directory
cd
#Change to parent directory
cd..
#Show the path where actually you are
pwd
#Create a directory
mkdir
#Remove directory
rm -r
#Force remove
rm -f
#Copy file
cp
#Rename or moove file
mv
#Create file
touch file
#Output contents of file
cat [file]
#Write standart input into file
cat > [file]
#Append standart input into file
cat >> [file]
#Output contents of file it grows
tail -f [file]
#Networking
#Ping host
ping [host]
#Show the actually routing table
route -n
#Check your iptable's rules
iptables -L
#List all ports
netstat -a
#Got whois for domain
whois [domain]
#Get DNS for domain
dig [domain]
#Reserve lookup host
dig -x [host]
#Download file
wget [file]
#Recurively download files from url
wget -r [url]
#Outputs the webpage from url
curl [url]
#Connect to host as user
ssh user@host
#Connect using port
ssh -p [port] user@host
#Connect and use bind port
ssh -D user@host
#Processes
Display currently active processes
ps
#Detailed outputs
ps -aux
#Kill process with process id (pid)
kill [pid]
#Kill all processes named proc
killall proc
#System Info
Show current date/time
date
#Show uptime
uptime
#Who you're logged in as
whoami
#Display who is online
w
#Display cpu info
cat /proc/cpuinfo
#Memory info
cat /proc/meminfo
#Show memory and swap usage
free
#Show directory space usage
du
#Displays readable size in GB
du -sh
#Show disk usage
df
#Show karnel config
uname -a
#Compressing
tar files into file.tar
tar -cf [file.tar] [files]
#Untar into current directory
tar -xf [file.tar]
#Show contents of archive
#Show contents of archive
#Options :
c - create archive
t - table of contents
x - extract
z - use zip/gzip
f - specify filename
k - do not overwrite
v - verbose
#Permissions
#Change permissions of file
chmod [rights] [file]
4 - read(r)
2 - write(w)
1 - execute(x)
#order : owner / group / world
chmod 777 - rwx for everyone
chmod 755 - rw for owner, rx for group and world
#Others
#Search in files for pattern
grep '[pattern]' [files]
#Search for pattern recursively in dir
grep -r '[pattern]' dir
#Find all instances of file
locate [file]
#Show possible locations of app
whereis [app]
Linux命令
于 2022-03-24 22:24:18 首次发布