1 / 15

Introduction to Linux

Introduction to Linux. Linux startup process Unix Shells and scripts. Startup of Linux. When you start linux, you normally see lines of messages with a SUCCESS or FAIL tag on the right. (Press F2 to see these messages on SuSE Linux.) These messages basically tells you devices it detects.

rocio
Download Presentation

Introduction to Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Linux Linux startup process Unix Shells and scripts

  2. Startup of Linux When you start linux, you normally see lines of messages with a SUCCESS or FAIL tag on the right. (Press F2 to see these messages on SuSE Linux.) These messages basically tells you devices it detects. After that, Linux will be launched in 1 of 7 runlevels.

  3. Runlevels of Linux Changing the default runlevel is sort of like switch Windows into safe mode. The 7 runlevels of Linux are as follows: Runlevel 0 Halt (shutdown machine) Runlevel 1 Single-user mode* Runlevel 2 User-defined mode Runlevel 3 Multi-user mode (no GUI) Runlevel 4 Another user-defined mode Runlevel 5 Multi-user mode (GUI) Runlevel 6 Reboot * In single-user mode, networking is disabled, usually only root partition is mounted with read-only.

  4. Purpose of runlevels? Runlevels restricts the kernel. On a workstation, you probably want to run linux with a runlevel of 5 to allow multiple people to use that machine. On a server, you would run linux with a runlevel of 3 because you wouldn't need X-server to be on. On runlevel 3, X-server in not started by default. When you restore a backup to a linux machine, you would run with runlevel 1.

  5. Switching runlevels The default runlevel is defined in the file /etc/inittab. To switch runlevel on the fly, use the command init and pass in the desired runlevel. (init 3)

  6. Daemon processes... A program that should be run in the background without user intervention is called a daemon process. A daemon, in the real world, is a type of being immediate between God and humans that is neither evil nor good and is the help of both as defined by Greek methology. Usually, when a daemon is started, it'll detach from a terminal, fork a child process and exits. When a parent process exits and the child is still running, the init process becomes the parent for the child.

  7. /etc/rc.d Any startup scripts are normally placed in this directory. Inside this directory, there are normally subdirectories rc0.d to rc6.d that corresponces to the different runlevels. Normally, you would place symbolic links inside the rc subdirectories and have them point to the actual rc script. This way, the script is more managable.

  8. Sample startup script #!/bin/sh case "$1" in start) if [ -x /usr/local/apache/bin/apachectl ]; then /usr/local/apache/bin/apachectl startssl > /dev/null 2>&1 && echo -n ' Apache HTTP Server' fi ;; stop) if [ -x /usr/local/apache/bin/apachectl ]; then /usr/local/apache/bin/apachectl stop > /dev/null && echo ' Apache stopped' fi ;; *) echo "$0 start | stop" ;; esac

  9. Shells Common shells: sh bourne shell csh c shell ksh korn shell bash bourne again shell tcsh tc shell zsh z shell Perferred shell for linux users is bash. Perferred shell for BSD users is tcsh. To change your default shell, use the chsh command.

  10. Shell scripts Normally, shells scripts are run with the bourne shell as this shell exists in all unixes. The first line of a shell script is which shell the script is going to be run by. #!/bin/sh After that, they are basically shell commands. A shell script must have the executable permission.

  11. BSD Startup BSD do not use runlevels. Instead, BSD uses what's called “kernel secure level”. A higher securelevel means more restriction. When BSD boots up, it runs in a securelevel of 0. After that, the secure level may not be lowered, but may be raised.

  12. The default securelevel is -1. At securelevel 1, X-Server may not be run. Imutable flags may not be changed. At securelevel 2, all of level 1 and time might may not be changed to more than about 1 sec. And firewall rules may not be changed.

  13. Because there are no runlevels, BSDs do not have the /etc/rc0.d directories. Instead, scripts in /etc/rc.d and /usr/local/etc/rc.d are executed.

More Related