Some common commands of Linux (1)

Time:2019-11-30

Linux shortcut
1. LS lists the documents on this address,
– a list all (including hidden files)
– L display as a list
– t sort by time

2. Create file by touch

3. Echo ‘ABC’ > write file name to file content (overwrite previous content)
Echo ‘CDC’ >

4. MKDIR – P test / test1 / test2 create directory

5. Cat file name: you can view the file content

6. Head – (n) 2 file name: the first two lines of the file can be viewed
Tail – (n) 3 file name: you can view the last few lines of the file (where n can be omitted, and the minus sign cannot be omitted)

7. Tree: you can view the file number structure

8. CD: back to the root directory
Cd ~: back to root
CD -: return to the previous directory
CD..: return to previous directory
CD.: current directory

9. Find. – name ‘*. TXT’: view all files ending in. TXT in the current directory (name is fixed and does not need to be changed)

10. Sudo find / – name ‘*. TXT’: use high permission to search in the root directory. All files ending in. TXT

11. PWD: view the current directory

12. CP: Copy command
  cp test1.txt new.txt
Original file new file
  cp test1.txt /home/tarena/1910xly/xinwenjainming.txt
Path plus new filename

13. MV original file new file: cut
  mv new.txt new2.txt

14. RM – F: forced deletion
– R: delete subdirectories
– I: ask if you want to delete the file