PWD: Show current path
CD: Switch directories
Usage: CD
Cd.. /Switch to Parent directory
CD/Switch to root directory
CD ~ (or CD only) switch to the current user home directory (the folder under the username named under Home)/root directory
mkdir Creating a Directory
mkdir directory name-p recursively Create directory
RmDir Delete Empty Directory
Usage: RmDir directory name
Also available: RM-RF directory name
LS View directory or file information
Main options:
-L lists the details of the directory or file. such as permissions, modification time, etc.
-a lists all files in the current directory, including hidden files (hidden files at the beginning of the point)
vi text editor
Type I enter edit state
exit Edit Press ESC
save exit: : Wq
Enter/, go to search
input: Set NU, Displays the number of rows for each row
press keyboard g to navigate directly to the end
CP Replication
Usage: CP [options] file name or directory destination address
-r copy directory and all directories and files under directory
CP a.txt b.txt Copy a file with a name B file (directory name)
MV Move
Usage: MV file name or directory destination directory
MV A.txt. /move a file to the parent directory (move one file to another directory without renaming)
MV A.txt. /b.txt move a file to the previous level and change the name to B file (move one file to another directory and rename)
RM Delete a file or directory
-F Force Delete
-R Delete Directory
Frequently used: RM-RF files or directories
Find File
Usage: Find [path] [options]
Common options are:
Find. -name *.log find files ending with. Log in the current directory
Find/-name log in the root directory for log-named directories
grep filtering
Finds the character (string) in the specified file and prints the line
Usage: grep string file name
grep band file looking for band string in file
Cat display text file contents
Usage: Cat filename cat file name
Head View first few lines
Usage: head-n 5 file name
Tail writes files to standard output starting from a specified point
Tail-n 5 file name view after a few lines
Tail-f Error.log constantly refreshed, see the latest content
PS viewing process (dynamic)
-EF displays all running processes and displays commands to start the process
Netstat viewing network status (net status shorthand)
NETSTAT-APN View All ports
An, sort the output in a certain order
P, which indicates which process is calling the
| pipe character (vertical bar, The English IME state shift+ on the keyboard |\ )
Create a pipeline between commands, Use the output from the preceding command as input to the following command
echo print file contents or edit file contents
Common options are:
-n does not wrap output
-e You can use the escape character (\ n carriage return, \ t tab)
example:
echo" I am studying Linux ">>xujun.txt append file trailer content
echo $? if the return value is 0, indicates the last command was successful. If it is 1 to 255, it is a failure
echo-e "Wo\tshi\tshei" > Xujun.txt
Touch creates a blank file, and if the current directory has the same file, the timestamp of the file is updated
-A Modify access (access) time
-M Modify Modify (Modify) time these two parameters to understand
Uname viewing system
-M view system is a few operating systems
-R View kernel version of the system
-A view detailed system kernel version and system operating system
RZ upload
If this command is not available in the system, install it using yum install Lrzsz
-Y Overlay
Directly input RZ, you can upload files
SZ Download
If this command is not available in the system, install it using yum install Lrzsz
-Y Overlay
Sz-y Test.txt
SU Switch User
Su Root
History View Command Chronicle
chmod permissions given to commands
-R recursively Change permissions for all subdirectories and files under the directory
Digital way: r=4 w=2 x=1
chmod 777 Lemon
Directly input RZ, you can upload files
Linux basic Commands Encyclopedia