Common commands in linux and Common commands in linux
(1) When vim opens a file, it can be used (2) write to the current file: press I, and the insert word is displayed in the lower left corner, which indicates that the text can be inserted; (3) move the cursor up or down: Up: K ← down: j ← left: H ← right: L → (4) line feed and Delete line feed write: o Delete line: dd return u (5) save and exit ESC shift + q exit ESC shift + w save ESC shift + x save and exit ESC shift +! Q force exit (6) file directory Class 1. create directory: mkdir directory name 2. delete the empty directory: rmdir directory name 3. delete the subdirectory unconditionally: rm-rf directory name 4. change the current directory: cd directory name (go to the user's home directory: cd ~; Go to the upper-level Directory: cd-) 5. view your own directory: pwd6. view the current directory size: du7. display the directory file list: ls-l (-a: Add show hidden directory) Where: Blue: Directory; Green: executable files; Red: compressed files; light blue: linked files; Gray: other files; Red: Incorrect link file 8. browse File: more file name. txt; less file name. txt 9. copy file: cp source file target file (-r: Contains directory) 10. find the file: (1) find (2) locate command name 11. link: (1) create a hard link: ln to link the source file (-d: create a directory link); (2) create a symbolic link: ln-s to link the source file (7) vi editing Class 1. enter the command mode: (1) Insert I; (2) Open 0; (3) Modify c; (4) Replace r; (5) replace s2. (1) and then enter the full-screen editing mode. 3. Command mode --> edit mode (a/I); edit mode --> command mode (Esc); command mode --> last line mode (:). 4.: w/w newfile save 5.: q/q! Exit vi;: wq save exit (8) program running Class 1. query command: whereis command name 2. run the X-Window program in the background: program name & 3. forcibly exit the X-Window program: Ctrl Alt Backspace4. view help: (1) Concise help: command name -- help | less (2) more help: man command name (3) info command name (4) help command name 5. view the system path: echo $ PATH6. view the current shell Stack: echo $ SHLVL7. </>: Input/Output redirection. |: The left input of the MPs queue is the right input of the MPs Queue (9) network service 1. display network interface parameters: ifconfig2. Display System Email: mail3. start/stop web Service: httpd-k start | stop | restart4. view network status: (1) online status: ping xxx. xxx. xxx. xxx; (2) network condition: netstat, where: options:-a = All socket S;-l = contains network devices;-n = Digital IP address;-o = Other information;-r = route table;-t = only columns of TCP sockets; -u = UDP sockets only;-w = raw sockets only;-x = Unix Domain sockets only (10) User Account Class 1. add User Account: (1) User name: adduser User Account Name (2) Set Password: passwd user account name 2. delete User Account: userdel User Account Name 3. add User Group: groupadd user group name 4. delete user group: groupdel user group name 5. temporarily terminate a user account: passwd-l user account name 6. resume terminated account: passwd-u User Account Name (11) permission settings (1) chmod-a | u | g | o |-| = r | w | x file/directory name, where: a -- all users (all); u -- user ); g -- User group; o -- other users (other u Sers) -- add permission; --- Delete permission; = -- set permission file: r -- read permission (read); w -- write permission (write); x -- execute permission (execute) directory: r -- allow files and subdirectories in the column directory; w -- allow generation and deletion of files in the directory; x -- allow access to the Directory (2) chmod xxx file/directory name: execute = 1; write = 2; read = 4x value: 0 -- no permission (commonly used); 1 -- only executable (not common); 2 -- only write (not common ); 3 -- write and execution only (uncommon); 4 -- read-only (common); 5 -- read-only and execution (common); 6 -- read and write (common); 7 -- read. write and execute (12) process control class 1. list the current process ID: ps-auxw2. terminate process: (1) terminate a single process: kill process ID (2) terminate all processes of the program: Killall program name (3) terminate the X-Window program: xkill3. view resource usage: (1) top (2) free (3) dm Esg4. check the environment variable value: env5. restart :( 1) reboot (2) Ctrl Alt Del (3) init 66. shutdown: (1) shutdown-h now (2) halt (3) init 07. switch desktop: switchdesk gnome | KDE |... (1) extract: tar-xvzf extract to tar: gzip-d file .tar.gz (2) compression: gzip files to be compressed 2.tar uncompressed class: (1) decommission: tar-xvf file .tar; (2) Packing: tar-cvf file. tar file 3.zip class: (1) Decompression: unzip file. zip-d dir; (2) compression: zip zipfile to be compressed file 4.bz2 class: (1) Decompression: bunzip2 file. bz2 or bzip2-d file. bz2; (2) compression: bzip2 File to be compressed 5. Z class: (1) decompress: uncompress file. z; (2) compression: compress file (14) Drive mounting Class 1. check hard disk usage: df-T-h2. check disk partition: fdisk-l3. mount the hard and soft areas: mount-t/dev/fdx | hdax/mnt/directory name :: modos -- FAT16; vfat -- FAT32; ntfs -- NTFS; optical drive -- iso9660 support Chinese name: mount-o iocharset = x/dev/hdax/mnt/directory name (where: x = cp936 or mount the optical drive: mount-t auto/dev/cdrom/mnt/cdrom mounting ISO file: mount-t iso9660-o loop xxx. iso/path4. unmount: umount/mnt/directory name unmount all mount: umount-a5. create a file system: mkfs-t/dev/hdxx. Ftype: ext2, ext3, and swap