Linux foundation consolidation

Linux system boot process can be divided into five parts: the core of the guide; run init; system initialization; establishment of the terminal; user log.
User login
Linux account verification process is login, login will receive a user name mingetty came as the username parameter. Then login user name will be analyzed: If the username is not root, and there is / etc / nologin file, login nologin will output the contents of the file, and then exit. This prevents non-root user login time is usually used for system maintenance. The registered / securetty only / etc terminal only allow the root user login, if the file does not exist, the root can log on any terminal. / Etc / usertty file is used to make additional access restrictions on users, if the file does not exist, there are no other restrictions.
 
After analyzing the user name, login will search / etc / passwd and / etc / shadow passwords and other information to verify the account settings, such as: What are the main directory, which shell to use. If no home directory, the default directory is the root; if the shell is not specified, the default is / bin / bash.
 
After the login procedure is successful, the corresponding terminal in output last logged (recorded in / var / log / lastlog in), and check whether the user has new messages (in / usr / spool / mail / on usernames Under contents). Then start setting various environment variables: For bash, the system first looks for / etc / profile script file and execute it; and then if there is .bash_profile file in the home directory of the user, on the implementation of it, they may call in these files the other configuration files, after all the configuration file is executed, various environment variables are also located well, then the familiar command line prompt, this whole process started over. 
 
[Mode switching manner graphics and text mode]
Linux provides six preset command terminal window Let's login. The default is the first sign in our window, that is tty1, the six windows were tty1, tty2 ... tty6, you can press Ctrl + Alt + F1 ~ F6 to switch between them. If you install a graphical interface, the default is to enter the graphical interface, in which case you can press Ctrl + Alt + F1 ~ F6 to enter one of the commands window interface. When you enter the command window interface and then return to the graphical interface, just press Ctrl + Alt + F7 on the back. If you use vmware virtual machine, the command shortcut key window switch is Alt + Space + F1 ~ F6. If you press Alt + Shift + Ctrl + F1 ~ F6 to switch in a graphical interface to the command window. 
 
[Learn to use the shortcut key]
Ctrl + C: This is used to terminate the current command shortcut key, of course, you can also enter a long list of characters, do not want to let it run directly Ctrl + C, the cursor will jump to the next line. 
Tab: This key is the most useful key, and is also the author of a key knocking highest probability. Because when you hit a half dozen commands, it will help you make the whole. Not only is the command, when you hit a directory, the same can complement, do not believe you try.
Ctrl + D: Exit the current terminal, you can also enter the same exit.
Ctrl + Z: suspend the current process, for example, you are running a command, I suddenly felt a little question to pause, you can use this shortcut. After a pause, you can use fg to restore it.
Ctrl + L: clear screen, move the cursor to the first line.
 
[View] command help information
For example, man ls
 
[Linux system directory structure]
/ Bin bin is Binary acronym. This directory is the most frequently used commands.
/ Boot store here are some of the core files that are used when you start Linux, including some connection files and image files.
/ Dev dev is an abbreviation Device (device). Stored in the directory of the external device is Linux, Linux in the way of access methods and devices to access the file is the same.
/ Etc This directory is used to store all of the systems management needs of configuration files and subdirectories. ***
/ Home user's home directory, in Linux, each user has its own directory, the directory name is based on the general user account named.
/ Lib This directory is stocked with a basic system dynamic link shared libraries, its role is similar to Windows in the DLL file. Almost all applications need to use these shared libraries.
/ Lost + found directory under normal circumstances this is empty, when the system illegal shutdown, some files stored here.
/ Media linux system will automatically identify some devices, such as a U disk, CD-ROM, etc., when the identification, linux identified device will mount this directory.
/ Mnt system provides this directory is to enable users to temporarily mount other file systems, we can drive mounted on / mnt /, then enter the directory you can view the contents of the CD-ROM drive.
/ Opt This is for the host to install additional software placed in the directory. For example, you install a ORACLE database you can put this directory. The default is empty.
/ Proc This directory is a virtual directory, which is the system memory map, we can get system information directly access this directory through. Contents of this directory on your hard disk but not in memory, we can also directly modify certain files inside, such as the ping command can be shielded by the command of the host, so that others can not ping your machine:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all。
/ Root directory of the system administrator, also known as super user's home directory permissions persons.
/ Sbin s is the Super User's meaning here is stored in the system management program used by system administrators.
/ Selinux This directory is Redhat / CentOS specific directory, Selinux is a security mechanism, similar to the windows firewall, but this mechanism is more complex, this directory is stored selinux related documents.
/ Srv directory to store some of the data service started to be extracted.
/ Sys This is a core linux2.6 great changes. The directory of a file system sysfs 2.6 kernel emerging installation, sysfs file system integrates information on the following three kinds of file systems: for proc file system processes information, devfs file system devices and devpts file for Pseudo terminal system. The file system is a visual reflection of kernel device tree. When a kernel object is created, the corresponding kernel object files and directories are also sub-species is created.
/ Tmp This directory is used to store temporary files.
/ Usr This is a very important directory, many applications and user files are placed in this directory, similar to the program files directory under the windows.
/ Usr / bin: the application system users.
/ Usr / sbin: more advanced management programs and system daemons super users.
/ Usr / src: placing the kernel source default directory.
/ Var This directory contains a constantly expanding with something we were used to modify those directories are often placed in this directory. Including various log files.
 
In linux system, there are several directories is more important, usually need to be careful not to accidentally deleted or shuffle internal documents. / Etc: top also mentioned, this is the system configuration file, if you change a file in the directory may cause the system will not boot. / Bin, / sbin, / usr / bin, / usr / sbin: This is the system default directory to place executable file, such as ls is in / bin / ls directory under. It is noteworthy that, / bin, / usr / bin system is for instruction (except the root pass the user) used by a user, and / sbin, / usr / sbin instruction is used to root. / Var: This is a very important directory, a number of programs running on the system, each program will have a corresponding log is generated, and the log is recorded to this directory, particularly in / var / log 'directory, in addition pre-placement mail is also here.
 
 
【who】
See if other users are online
[How to properly shutdown]
In fact, in the field of linux mostly used in servers, rarely encountered in the operation shut down. After all, running a service on the server is never-ending, except under special circumstances, it will be forced to shut down.
Different linux and windows, under the Linux, because each program (or service) are performing in the context, therefore, behind the screen you can not see very many people actually might have the same time in your host above work, such as web browsing friends, transmitted a letter to friends of friends, etc. FTP to transfer files, if you just press the power switch off, other people's data may be to a halt! That may worry about it! In addition, the biggest problem is, if not shut down properly, it may cause damage to the file system (because no time to write data back to the file, so the file there will be some service issues!).
 
If you want to shut down the system must ensure that no other users currently online. Who can issue this command, and to see if the online network, netstat -a This command can be issued, and the program depends on the background of this command can be executed ps -aux. Use these commands allow you to use a little understanding of the current state of the host! (These commands will be mentioned in later chapters, but for now you can understand!)
 
Proper shutdown procedure is:? Sysnc shutdown reboot halt??
The sync data from the synchronous memory to the hard disk.
shutdown shutdown command, you can look at the man shutdown help documentation. For example, you can run the following command shutdown:
shutdown -h 10 'This server will shutdown after 10 mins' This tells you that the computer will shut down after 10 minutes, and will appear in the user's current login screen.
Shutdown -h now shutdown immediately
Shutdown -h 20:25 will be shut down at 20:25 today
Shutdown -h +10 ten minutes after shutdown
Shutdown -r now reboot the system immediately
Shutdown -r +10 ten minutes after the restart the system
reboot reboot is equivalent to shutdown -r now
halt off the system, and is equivalent to the shutdown -h now poweroff
dev  home  opt bin tmp
 

 

Guess you like

Origin www.cnblogs.com/ihacker/p/11311170.html