Essential commands for Linux 1. 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 the Directory: pwd 6. view the current directory size: du 7. show the directory file list: ls-l (-a: add the hidden directory to display) Where: Blue: Directory; Green: executable file; Red: compressed file; light blue: linked file; gray: other files; red and white: 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 www.2cto.com
Ii. Drive mounting Class 1. check hard disk usage: df-T-h 2. check the disk partition: fdisk-l 3. mount the hardware and software areas: mount-t/dev/fdx | hdax/mnt/directory name, where: modos -- FAT16; vfat -- FAT32; ntfs -- NTFS; optical drive -- iso9660 supports Chinese names: mount-o iocharset = x/dev/hdax/mnt/directory name mount the optical drive: mount-t auto/dev/cdrom/mnt/cdrom mount the ISO file: mount-t iso9660-o loop xxx. iso/path 4. unmount: umount/mnt/directory name unmount all: umount-a 5. create a file system: mkfs-t/dev/hdxx. Ftype: ext2, ext3, and swap
Iii. Program Installation Class 1. RPM package installation: (1) install rpm-ivh somesoft. rpm (2) reverse installation of rpm-e somefost. rpm (3) query rpm-q somefost or rpm-qpi somefost. rpm (where: p is not installed; I contains information) (4) query the location after installation: rpm-ql somefost. rpm (5) upgrade and install: rpm-Uvh somesoft. rpm (6) force installation: rpm-ivh -- nodeps somesoft. rpm or rpm-ivh -- nodeps -- force somesoft. rpm 2. source code package installation: read README basic usage: (1) configuration: unzip the directory. /configure (2) Compile: make (3) install in the decompressed Directory: make install 3 in the decompressed directory. src. the rpmbuild command and -- r are required for rpm installation. Ebuild parameters. For example, rpmbuild -- rebuild ***. src. rpm. Then, find the iso program installation under FC3 under/usr/src/: system-config-packages -- isodir = iso directory. Install the iso program under RH: redhat-config-packages -- isodir = iso directory
Iv. compression and decompression class 1.tar.gz: (1) Decompression: tar-xvzf file .tar.gz.pdf (2)tar.gz to tar: gzip-d file .tar.gz (2) compression: gzip file to be compressed 2.tar uncompressed class: (1) unpack: tar-xvf file .tar; (2) package: tar-cvf file .tar file list 3.zip class: (1) unzip: unzip file .zip-d dir; (2) compress: zip zipfile list of files to be compressed 4.bz2 class: (1) unzip: bunzip2 file .bz2 or bzip2-d file .bz2; (2) compress: bzip2 File to be compressed 5. z class: (1) decompress: uncompress file. z; (2) compression: compress File
5. process control class www.2cto.com 1. list the current process ID: ps-auxw 2. 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: xkill 3. view resource usage: (1) top (2) free (3) dmesg 4. check the environment variable value: env 5. restart: (1) reboot (2) Ctrl Alt Del (3) init 6 6. shutdown: (1) shutdown-h now (2) halt (3) init 0 7. switch desktop: switchdesk gnome | KDE |...
6. program running 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 Backspace 4. 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 $ PATH 6. view the current shell Stack: echo $ SHLVL 7. </>: Input/Output redirection. |: The left input of the MPs queue is the right input of the MPs queue.
VII. User Account type 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. recover the account to be terminated: passwd-u user account name 7. permission setting (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 -- add permissions; --- delete permissions; = -- set permission files: r -- read-Only 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 under the Directory; x -- allow access to the Directory (2) chmod xxx file/directory name where: execute = 1; write = 2; read = 4 x value: 0 -- no permission (commonly used); 1 -- can only be executed (uncommon); 2 -- can only be written (uncommon ); 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
8. vi editing Class 1. enter the command mode: (1) Insert I; (2) Open 0; (3) Modify c; (4) Replace r; (5) replace s 2. after (1), enter the full screen editing mode. 3. Command mode --> edit mode (a/I); edit mode --> command mode (Esc); command mode --> last line mode (:). Www.2cto.com 4.: w/w newfile save 5.: q/q! Exit iv;: wq save and quit
IX. network service 1. display network interface parameters: ifconfig 2. display System Email: mail 3. start/stop the web Service: httpd-k start | stop | restart 4. view network status: (1) online status: ping xxx. xxx. xxx. xxx; (2) network condition: netstat, where: options:-a = All sockets;-l = contains network devices;-n = Digital IP; -o = Other information;-r = route table;-t = only columns of TCP sockets;-u = only columns of UDP sockets;-w = only columns of raw sockets; -x = only columns of Unix Domain sockets
10. Other Categories 1. display graphics card 3D information: glxinfo and glxgears
Author hanzhou4519