Essential commands for Linux

Source: Internet
Author: User
Tags rpmbuild
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... 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.