Common Linux commands (1) -- File Processing Command Format: Command-option parameter example: ls-la/etc Description: www.2cto.com 1) when there are multiple options, can be written together. 2) Two special directories. and .., represents the current directory and the parent directory of the current directory respectively. 3) Only commands that can be executed by the root user are stored in the directory:/sbin and/usr/sbin 4) all commands that can be executed by users are stored in the directory:/bin and/usr/bin 5) bin ---> binary file, usr ---> user, sbin ---> super binary 1. Command name: ls execution permission: All Users www.2cto.com Function Description: Display directory File Syntax: ls option [-ald] [file or directory]-a shows all files, including hidden files-l detailed information display-d view directory properties such: view the file details in the root directory: ls-l/explain the displayed file information: drwxr- Xr-x 94 root 4096 Nov 14 etc d: Indicates file type: d directory file directory-binary file l soft link file link rwxr-xr-x: indicates the permission r-read, w-write, and x-execute. The first three characters of rwx r-x indicate the owner u (user) the three characters in the permission center indicate the permissions of the group g (group), and the last three characters indicate the permissions of other people o (other): indicates the number of hard links root: Owner root: GROUP: file size. This is not an accurate number. In linux, there is a concept of data blocks, this is a minimum storage unit. A data block is 512 byte by default. Nov 14: Creation Time or last modification time. etc: file name 2. Command name: cd execution permission: All Users function description: switch directory Syntax: cd [Directory] cd/switch to the root directory cd.. Return to the directory above level 3. Command name: pwd execution permission: All Users Function Description: display the current working directory Syntax: pwd [root @ localhost ~] # Pwd/root [root @ localhost ~] #4. Command name: touch execution permission: All Users Function Description: Create an empty File Syntax: touch [file name] [root @ localhost test] # touch first.txt 5. Command Name: mkdir execution permission: All Users Function Description: Create a new directory Syntax: mkdir [directory name] [root @ localhost test] # mkdir abc 6. Command name: cp execution permission: all User Function descriptions: copy file or directory Syntax: cp-R [source file or directory] [target directory]-R copy the two files/etc/inittab and/etc/services to the/test directory [root @ localhost test] # cp/etc/inittab/etc/services/test copy the etc directory to the test directory [root @ localhost test] # cp-R/etc/test 7. Command name Mv execution permission: description of all user functions: Mobile file and renamed Syntax: mv [source file or directory] [target directory] renames services under the current directory to ser [root @ localhost test] # mv services ser moves the inittab file under the/test directory to/tmp directory [root @ localhost test] # mv/test/inittab/tmp move the.txt file under the/testdirectory to the/tmpdirectory, and change the name to a2.txt at the same time [root @ localhost test] # mv/test/a.txt/tmp/a2.txt 8, command Name: rm execution permission: All Users Function Description: rm-r [file or directory] Syntax: delete the file to delete the aa file in the current directory, you need to confirm [root @ localhost test] # rm aa force Delete the aa file in the current directory, and do not need to confirm [root @ local Host test] # rm-f aa forcibly deletes the bb directory in the current directory. Do not confirm [root @ localhost test] # rm-rf bb 9. Command Name: cat execution permission: All Users Function Description: display file content Syntax: cat [file name] [luxh @ localhost ~] $ Cat/etc/issueCentOS release 6.2 (Final) Kernel \ r on an \ m 10. Command name: more execution permission: All Users Function Description: pagination file content Syntax: more [file name] (Space) or f display next page (Enter) display next line q or Q exit [luxh @ localhost ~] $ More/etc/services 11. Command name: head execution permission: All Users Function Description: view the first few lines of the File Syntax: head-num [file name]-num displays the first num row of the file [luxh @ localhost ~] $ Head-5/etc/services #/etc/services: # $ Id: services, v 1.48 2009/11/11 14:32:31 ovasik Exp $ # Network services, Internet style # IANA services version: last updated, command name: tail command path:/bin/tail execution permission: All Users Function Description: view the last few lines of the File Syntax: tail-num [file name]-num: displays the content of the file dynamically in the num row after the file-f [luxh @ localhost ~] $ Tail-5/etc/servicesblp5 48129/udp # Bloomberg locatorcom-bardac-dw 48556/tcp # com-bardac-dwcom-bardac-dw 48556/udp # com-bardac-dwiqobject 48619/tcp # iqobjectiqobject 48619/udp # The iqobject-f parameter can be used to view dynamically changed files, for example, the log file [luxh @ localhost ~] $ Tail-f/etc/log 13. Command name: tail execution permission: All Users Function Description: Generate link File Syntax: ln-s [source file] [target file]-s create soft link create file/etc/issue soft link save to abc directory/abc/issue. soft [root @ localhost abc] # ln-s/etc/issue/abc/issue. soft [root @ localhost abc] # ls-ltotal 0lrwxrwxrwx. 1 root 10 Nov 15 issue. soft->/etc/issue [root @ localhost abc] # issue. soft->/etc/issue indicates issue. soft points to the/etc/issue soft link similar to the windows shortcut to create a file/etc/issue hard link and store it in the abc directory/abc /Issue. hard [root @ localhost abc] # ln/etc/issue/abc/issue. hard [root @ localhost abc] # ls-ltotal 4-rw-r -- r --. 3 root 62 May 8 2012 issue. hardlrwxrwxrwx. 1 root 10 Nov 15 issue. soft->/etc/issue [root @ localhost abc] # Hard link, similar to copy, and Will synchronously update the source file. Modifications to the hard link file will be updated to the source file.