Linux command learning summary

Create folder
mkdir test01

Create a file
touch test01.txt

View files (current screen display)
more test01.txt

View file (full content of file)
cat test01.txt

Modify the file
vim test01.txt

save after modification
:wq

Do not save after modification
:q!

Switch user from root to lye
su - lye  

Switching from lye to root requires a password
su - root

search
grep "" test01.txt

Query for help with grep
man grep

Delete folders and contents
rm -rf test01

clear screen
clear

create user
useradd abc
passwd 123

change user group
chgrp lye test01

change file owner
chown lye test01

change file permissions
chmod lye test01

Find the directory structure under a folder
find tmp -type f

View the directory structure of the current folder
pwd

unzip files
unzip mampbusi.war -d mampbusi

Query occupied ports
lsof -i:port number

netstat -apn | grep 4040

Kill the port:
kill -9 port

query service process
ps aux | grep mampbusi

View the size of all files in the current directory
ls -lht

Check the size of a certain file
ls -lh app.log

View disk space (in M)
df -m

Modify the current user password
passwd

Upload and download files (no need to install first)
installation instructions:
yum install lrzsz

Upload command:
rz

Download instructions:
sz

The downloaded content is stored under X/Y/Zmodem
Clear the content in the file
:>test.txt

>test.txt



Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326743305&siteId=291194637