Linux related summary

Source: Internet
Author: User
Tags readable

In the world of Linux, there are questions asking man, equivalent to Java's API. Its usage is man you will not command two.  Linux system has 7 runlevel (runlevel): Commonly used is 3 and 5 run Level 0: System down state, the system default operation level cannot be set to 0, otherwise can not start the operation Level 1: Single user working status, root privilege, for system maintenance, prohibit remote login RunLevel 2: Multi-User State (no NFS), no NETWORK SERVICE RunLevel 3: Full multiuser State (with NFS), login to console command line mode run Level 4: System unused, reserved runlevel 5:x11 for console, enter graphical interface RunLevel 6: System shutdown and restart    The default run level cannot be set to 6, otherwise it will not start normally three. Boot Process 1. The kernel boots the Power BIOS self-test, according to the boot device set in the BIOS (usually the hard disk) to boot, the operating system takes over the hardware, the first read into the boot directory kernel files. 2. Running the INIT init process is the starting point for all processes in the system, and you can compare it to the ancestor of all processes in the system, without which any process in the system will not start. The INIT program first needs to read the configuration file/etc/inittab 3.RunLevel Many programs need to boot up.    They are called "services" in Windows, and in Linux they are called "daemons" (daemon).    One of the major tasks of the Init process is to run these boot-up programs.    However, different applications need to start different programs, such as when serving as a server, the need to start Apache, as a desktop is not required.    Linux allows different start-up programs to be assigned for different occasions, which is called "RunLevel" (runlevel).     That is, at startup, depending on the runlevel, determine which programs to run. Linux system has 7 runlevel (RunLevel): Run Level 0: System down state, the system default RunLevel cannot be set to 0, otherwise it will not start running Level 1: Single user working status, root privilege, for system maintenance, prohibit remote login run Level 2: Multi-user status (no NF S) Run Level 3: Full multiuser State (with NFS), login to console command line mode run Level 4: System unused, keep RunLevel 5:x11 console, log in to GUI mode run Level 6: The system shuts down and restarts, the default run level cannot be set to 6, otherwise can start normally 4. System initialization in INIT configurationThere is a line in the file: Si::sysinit:/etc/rc.d/rc.sysinit It calls the/etc/rc.d/rc.sysinit, and Rc.sysinit is a bash shell script that basically completes some system initialization work. , Rc.sysinit is an important script to run each runlevel first, and it mainly does the following: activating the swap partition, checking the disk, loading the hardware module, and some other priority tasks 5. After the terminal RC is completed, return to Init.    At this point the basic system environment has been set up, various daemons have been started. Init then opens 6 terminals so that the user can log on to the system. The following 6 lines in Inittab define 6 terminals:   6. User Login system in general, there are three ways users can log in: (1) command line login (2) SSH login (3) GUI login four. Add line number to command: Increase line number: Set Nu, remove line number: Set Nonu 1.2 modes ① General mode: Open a file with VI directly into the general mode (this is the default mode).    In this mode, you can use the "up or down" button to move the cursor, you can use "delete character" or "Delete whole line" to process the contents of the file, you can also use "copy, paste" to process your data. Delete the current line of the cursor, DD delete the cursor (including) How many lines, D digit D undo the previous step, U copy the current line of the cursor, YY copy a paragraph (from the first line to the first few lines), y number y arrow to move to the destination line paste, p delete a letter x, equivalent to Del X , equivalent to backspace delete a word, DW copies a word, YW moves to the wardrobe, shift+^ moves to the end of the line, shift+$ moves to the header, the number 1+shift+g moves to the end of the page, Shift+g moves to the target line, the number N+shift+g② edit mode: In general mode can be deleted, copied, pasted and so on, but can't edit the contents of the file!  Wait until you press "I, I, O, O, A, a, R, R," and any one of the letters before entering edit mode. Watch out! Usually in Linux, when you press these keys, the words "INSERT or REPLACE" appear at the bottom left of the screen, so you can edit them.    If you want to return to normal mode, you must press the "ESC" button to exit edit mode. I current cursor before a current cursor o the next line of the current cursor ③ instruction mode: In general mode, enter ":/?" 3 Any one of the buttons, you can move the cursor to the bottom row.  In this mode, you can provide "search data" action, and read, save, a large number of substitution characters, leave VI, display line number, and so on the action is achieved in this mode!  : Q  //quit Exit VI Editor: W//write Save modified Content: Wq//Save and exit: q!  Force quit when the text content has been modified and you do not want to save: w! Force save when there is no write permission to the text W Q! Exclamation point enforcement substitution:%s/old character/new character/g/find,/Find Word, N is find Next, shift+n is look up? find,? is searched for the word, n is to find the previous, Shift+n is to look down five Linux users and user groups 1. User New User: Useradd username set password for user: passwd new user name, followed by prompt for password user presence No: ID User name View Current User: whoami/who am I switch User: su-username name switch User Delete User: Userdel Modify User: Usermod (after the end of the user group knowledge point back to explain) Usermod-g user group User Name 2. User groups: Each user has a user group, and the system can centrally manage all users in a single user group. Different Linux systems provide a different set of user groups, as users under Linux belong to a user group with the same name, which is created at the same time as the user is created. The management of user groups involves adding, deleting, and modifying user groups. The addition, deletion, and modification of a group is actually an update to the/etc/group file. New group: Groupadd Group name Delete Group: Groupdel Group name Modify Group: GROUPMOD Group name groupmod-n New group name old group name six. File and directory structure 1. Directory Structure tree directory structure/bin: binary abbreviation, this directory holds the most frequently used commands /boot: Here are some of the core files that are used to start Linux, including some connection files and image files, and install them on the/dev:device (device) abbreviation, which stores Linux external devices. The way you access your device in Linux is the same way you access your files. /etc: all the configuration files and subdirectories required for system management. Home directory for normal users, each user in Linux has a directory of their own, usually named after the user's account name. /lib: The most basic dynamic connection shared library required for the system to boot, which acts like a DLL file in Windows. These shared libraries are required for almost all applications. /lost+found: This directory is generally empty, and when the system shuts down illegally, some files are stored here. /media:linux system will automatically identify some devices, such as USB flash drive, optical drive, etc., when identified, Linux will attach the identified device to this directory. /MNT: The system provides this directory for users to temporarily mount other file systems, we can mount the CD-ROM drive on the/mnt/, and then enter the directory to view the contents of the CD-ROM. /OPT: This is the directory where additional installation software for the host is placed. Like you're installing a oracl.The e-database can be placed in this directory. The default is empty. /proc: This directory is a virtual directory, it is the mapping of system memory, we can access this directory directly to obtain system information. /root: This directory is a user home directory for system administrators, also known as super-permissions. /sbin:s is the meaning of super user, which is stored in the system administrator's use of the hypervisor. /selinux: This directory is unique to Redhat/centos, SELinux is a security mechanism, similar to the Windows Firewall/srv:service abbreviation, which holds some data that needs to be extracted after the service is started. /sys: This is a big change in the linux2.6 kernel. This directory installs a new file system Sysfs that appears in the 2.6 kernel. /tmp: This directory is used to store some temporary files. /usr: This is a very important directory, the user's many applications and files are placed in this directory, similar to the Program Files directory under Windows. /var: This directory is stocked with things that are constantly being expanded, and we are accustomed to placing directories that are often modified in this directory. Includes various log files.  cd~ back to the current user's home directory cd-back to the last directory  2. File attributes the Linux system is a typical multi-user system, different users are in different positions and have different permissions. In order to protect the security of the system, the Linux system has different requirements for different users to access the same file (including directory files). In Linux we can use the LL or LS–L command to display the properties of a file and the 10 characters from left to right for the user and group to which the file belongs: A group of three, and a combination of three parameters that are "rwx". where [R] stands for readable (read), [W] stands for writable (write), [x] stands for executable (execute). Note that the location of the three permissions does not change, and if there is no permission, a minus sign [-] is present. From left to right, 0-9 of these numbers are used to indicate that the No. 0 bit determines the file type, and 第1-3位 determines the permissions that belong to the owner of the file. ---user 第4-6位 determines that the owning group (the same group of users of the owner) has permission to the file,---group 第7-9位 determines that another user has permission to the file---Other action to the file: [R] stands for readable (read): Can read, view [W] represents writable (write ): Can be modified, but does not mean that the file can be deleted, the precondition for deleting a file is to have write permission to the directory where the file is located in order to delete the file. [x] represents the executable (exeCute): Can be performed by the system to the directory: [R] stands for readable (read): Can read, ls view directory contents [W] for Writable (write): Can be modified, directory creation + DELETE + rename directory [x] stands for executable (execute): You can enter this directory 3. File permission class chmod change the file or directory permission file: R-View; w new modification; x-Execute file directory: R-list directory content; W Create and delete in directory; x enter directory to delete a file: The directory in which the file resides has write permission.   You can delete the file.

Linux Related summary

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.