2019-09-22
1, change directories; display directory; create files; creating folders; view file contents
- pwd: View the current directory
- cd: Change directory
- cd . : current path
- CD .. : on the one path of the current path
- ls: displays all the files in the current directory
- touch: create a file with a file name can also be used without a file name
- mkdir: create a folder
- cat: show the file contents of all
- vi: write the content in the text
- ZZ: Press twice to exit the uppercase letters can edit the text
- tab: auto-complete command name completion long and complex document name, enter the first or the first few letters
- history: View historical command; then use! + Number of lines: you can re-execute the command
- mv: Rename
- cp: Copy the contents
2, linux command basic format
- command [-options] [parameter]: command options parameters
- Options:
- -a: Show All
- -l: Displays in list form
- -h: File size digits change
- ls /: displays all the files in the root directory
- ls / bin: bin folder displays all files
- ls -a: Displays the current directory of all files, including hidden
3, Tsuhaifu:? *, []
- *: All represent unknown
- ? : Indicates the unknown, and a question mark on behalf of a number
- ls 2 *: displays all files that begin with 2
- ls 2? : The first display is 2, behind only the file-digit
- ls 2? ? : The first display is 2, behind double-digit file
- ls 1 【12345】 3 和 ls 1 [1-5] 3
4, soft links and hard links (equivalent to create shortcut)
- ln -s 1.txt 1-softlink,txt
- ln 1.txt 1-hardlink,txt
5, grep get content
- grep "ntfs" xxx.t: looking for content text contains the ntfs
- grep -n ....: content returned in front of the line will bring
- grep -v .....: display contents does not include a restriction condition
- grep "^ ntfs" xxx.t: display content nfts beginning
- grep "ntfs $" xxx.t: the end of the display contents nfts