Please follow the Linux basic commands as required on the machine .
CD command: Switch directories
(1) switch to directory/usr/local
Cd/usr/local
(2) go to the current upper directory
Cd..
(3) go back to your home folder
CD ~
LS command: View files and directories
(4) view directory/usr for all files
Cd/usr
Ls
mkdir Command: Create new directory
(5) Enter the/tmp directory, create a directory named a , and see how many directories exist
Cd/tmp
mkdir A
Ls
(6) Create directory A1/a2/a3/a4
Mkdir-p A1/A2/A3/A4
CD A1/A2/A3/A4
RmDir Command: Delete empty directory
(7) Delete the directory a(/tmp ) created in the example above
RmDir A
Ls
(8) Delete directory a1/a2/a3/a4to see how many directories exist
Rmdir-p A1/A2/A3/A4
Ls
CP Command: Copy files or directories
(9) copy the. BASHRC under the home folder to/ usr , named bashrc1
Cp/home/kyro/.bashrc/usr/bashrc1
Cd/tmp
Ls-a
Create a new directory Test in/tmp and copy the contents of this directory to/ usr
Cd/tmp
mkdir test
sudo cp –r/tmp/test/usr
MV command: Move files and directories, or rename
(one) Move the example file Bashrc1 to the directory /usr/test
sudo mv/usr/bashrc1/usr/test
Rename the above example test directory to test2
sudo mv/usr/test/usr/test2
RM command: Removing files or directories
Delete the Bashrc1 file copied from the previous example
sudo rm/usr/test 2/bashrc1
Remove the Test2 directory from the example above
sudo rm-r/usr/test 2
Cat Command: View file contents
() View the contents of the . BASHRC file under the home folder
Cat ~/.BASHRC
TAC Command: Reverse list
(+) Reverse View the contents of the. BASHRC file in the home folder
Cat ~/.BASHRC
More command: One page, one page turn to view
Page turn toview the contents of the . BASHRC file in the home folder
More~/.bashrc
Head Command: Remove the previous lines
View the contents of the. bashrc file in the home folder first line
Head –N-~/.BASHRC
View the contents of the. bashrc file under the home folder , which is not displayed in the following line, showing only the previous lines
Head –n-50 ~/.BASHRC
Tail command: Take back a few lines
View the contents of the. bashrc file in the home folder last line
Tail –N-~/.BASHRC
View the contents of the . bashrc file in the home folder , listing only the data after
Tail –n +50 ~/.bashrc
Touch Command: Modify the file time or create a new file
Create an empty file in/tmp Hello and check the time
Cd/tmp
Touch Hello
LS –l Hello
Modify the Hello file to adjust the date to 5 days ago
Touch –D "5 days ago" Hello
Chown Command: Modify file Owner Permissions
Change the owner of the hello file to the root account and view the properties
sudo chown Root/tmp/hello
LS –l/tmp/hello
Find command: File lookup
Find the file named. BASHRC in the home folder
Find ~-NAME.BASHRC
Tar command: Compress command
Create a new folder in/directory test and then package it in / directory into test.tar.gz
sudo mkdir/test
sudo tar –zcv –f/test.tar.gz test
Unzip to/tmp directory
sudo tar –zcv –f/test.tar.gz-c/tmp
grep command: Find string
Find the string ' examples ' from the ~/.BASHRC file
grep –n 'examples' ~/.bashrc
Configure the Java environment variable, set in ~/.bashrc
Gedit ~/.BASHRC
() view The value of the Java_home variable
Echo $JAVA _home
Familiar Linux operations