[Turn] talking about the startup process of Linux system

Source: Internet
Author: User
Tags aliases

Original: http://blog.csdn.net/justdb/article/details/9621271 copyright notice: This article for Bo Master original article.

Linux system start-up by reading different configuration files, execute the corresponding shell script to complete. Of course this article is simply from the perspective of the file analysis, a deeper level of this article is not covered.

The following files were read mainly:

1/boot/grub/grub.conf2/etc/Inittab3/ETC/RC5.D (RC.D)0- AboutSeq4/etc/passwd (login,input username and password)5/etc/Shadow6/etc/profile:init the ENVvarof user7/etc/profile.d/*. SH8 ~/.bash_profile9 ~/.bash_historyTen ~/.BASHRC One /ETC/BASHRC

Let's start by looking at the grub.conf file

1 [email protected] grub]# ll menu.lst2lrwxrwxrwx.1Root root One7o?=o?= + Ten: theMenu.lst./grub.conf3 [email protected] grub]# pwd4/boot/Grub5 grub.conf file Contents:6 default=0  7timeout=5  8Splashimage= (hd0,0)/boot/grub/splash.xpm.gz9 HiddenmenuTenTitle Red Hat Enterprise Linux (2.6. +- -. el6.i686) OneRoot (hd0,0)   Akernel/boot/vmlinuz-2.6. +- -. el6.i686 ro -root=uuid=ed98469d-857b-4ae5-91e4-118e0167ead7 Rd_no_luks RD_NO_LVM -Lang=en_us. utf-8RD_NO_MD Quiet Sysfont=lat arcyrheb-Sun16 RHGB theCrashkernel=auto keyboardtype=pc keytable=US RD_NO_DM -initrd/boot/initramfs-2.6. +- -. el6.i686.img

Execute the runlevel command to see that the boot level is 5

1 [email protected] grub]# runlevel   2 5

We enter the ETC directory, we can see a lot of RCX.D directory

1 [[email protected] grub]# cd/etc/init.d  2   3 [[email protected] init.d]# CD/etc  4[[email protected] etc]# CD RC  5 rc          rc0.d/      rc1.d/      rc2.d/      rc3.d/      rc4.d/      rc5.d/  6 rc6.d/      rc.d/       rc.local    Rc.sysinit    

We go into the/ETC/PROFILE.D directory and we can see a lot of executable scripts

1[Email protected] test]# LL/ETC/PROFILE.D/*. SH2 -rw-r--r--. 1 root root 1143 Apr 2010/etc/profile.d/colorls.sh3 -rw-r--r--. 1 root root (APR) 2010/etc/profile.d/cvs.sh4 -rw-r--r--. 1 root root 192 Dec 2005/etc/profile.d/glib2.sh5 -rw-r--r--. 1 root root 2010/etc/profile.d/gnome-ssh-askpass.sh6 -rwxr-xr-x. 1 root root 288 Sep 2009/etc/profile.d/kde.sh7 -rw-r--r--. 1 root root 2706 Sep 2 2010/etc/profile.d/lang.sh8 -rw-r--r--. 1 root root 108 Feb 7 2007/etc/profile.d/less.sh9 -rw-r--r--. 1 root root 933 June 2010/etc/profile.d/qt.shTen -rw-r--r--. 1 root root 2142 Sep 8 2010/etc/profile.d/udisks-bash-completion.sh One -rw-r--r--. 1 root root 269 may 2010/etc/profile.d/vim.sh A -rw-r--r--. 1 root root 169 may 2009/etc/profile.d/which2.sh

Because the boot level is 5, so we go into rc5.d, we can see a lot of files, s means when the system starts to execute, K means when the system shuts down to execute.

[Email protected] grub]# ll/etc/rc5.d/k01certmonger k50netconsole k75ntpdate k89rdisc s11auditd S24avahi-Daemon s26pcscd s82abrtd k01smartd k50snmpd k76ipsec k95cgconfig S11portreserve S24nfslock S26udev-post S85qpidd k02oddjobd k50snmptrapd k80kdump k95firstboot s12rsyslog S24openct s28autofs s90crond k10psacct k50vsftpd k80sblim-SFCB s00microcode_ctl s13cpuspeed s24rpcgssd s30vboxadd s95atd K10SASLAUTHD K60nfs K80SSSD s01sysstat s13irqbalance s24rpcidmapd s30vboxadd-x11 s97rhnsd k15httpd k69rpcsvcgssd k84wpa_supplicant s02lvm2-monitor s13rpcbind s25cups S35vboxadd-service s98tog-Pegasus K20tomcat6 k73ypbind k86cgred s08ip6tables s15mdmonitor s25netfs S50bluetooth s99local k36mysqld k74nscd k87restorecond s08iptables S 22messagebus s26acpid s55sshd k50dnsmasq k74ntpd k88nslcd S 10network S23networkmanager S26haldaemon S80postfix

Let's take a look at the contents of the. bashrc file in the user's home directory

1[email protected] grub]# cat ~/. BASHRC2 #. BASHRC3   4 # User specific aliases and functions5   6Alias rm='rm-i'  7Alias cp='cp-i'  8Alias mv='mv-i'  9   Ten# SourceGlobalDefinitions One if[-f/etc/BASHRC]; Then A. /etc/BASHRC -Fi

Let's take a look at the contents of the. bash_profile file in the user's home directory

1[email protected] grub]# cat ~/. Bash_profile2 #. Bash_profile3   4 # Get The aliases and functions5 if[-F ~/. BASHRC]; Then6. ~/. BASHRC7 fi8   9 # User specific environment and startup programsTen    OnePath= $PATH: $HOME/bin A    -Export PATH

A complete flowchart such as:

[Turn] talking about the startup process of Linux system

Related Article

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.