0% found this document useful (0 votes)
11 views

Linux Kernel

linux
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Linux Kernel

linux
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

LINUX KERNEL

- What is a Kernel?
Interface between hardware and software
- Shell anything like a GUI that we have in Windows or GUI in Linux
Shell and kernel together, that software built together in one package and that is called
operating system
Introduction to Shell
- What is a Shell?
Its like a container
Interface between users and Kernel/OS
CLI is Shell
- Find your Shell
Echo $0
Available Shells “cat/etc/shells”
Your Shell? /etc/passwd
- Windows GUI is a shell
- Linux KDE GUI is a shell
- Linux sh, bash etc. is a shell
Types of Linux Shells
- Gnome
- KDE
- sh: shell
- bash: born again shell (has a lot of enhanced features and it is very user friendly)
- csh and tcsh (most of the people don’t use tcsh and csh unless you really are proficient in
C and C++ programming)
- ksh
Shell Scripting
- what is a Shell Script?
A shell script is an executable file containing multiple shell commands that are executed
sequentially. The file can contain:
+ Shell (#!/bin/bash)
+ Comments (# comments)
+ Commands (echo, cp, grep etc.)
+ Statements (if, while, for etc.)
- Shell script should have executable permissions (e.g. -rwx r-x r-x)
- Shell script has to be called from absolute path (e.g /home/userdir/script.bash)
- If called from current location ./script.bash
Shell Script – Basic Scripts
- Output to screen using “echo”
- Creating tasks
+ telling your id, current location, your files/directories, system info
+ Creating files or directories
+ Output to a file “>”
- Filters/Text processors through scripts (cut, awk, grep, sort, uniq, wc)
Input/ Output
- Create script to take input from the user
read: command wait for user input
echo
If-then Scripts
- IF the statement
If this happens = do this
Otherwise = do that
For Loop Scripts
- For loops
Keep running until specified number of variable
e.g: variable = 10 the run the script 10 times
OR
variable = green, blue, red (then run the script 3 times for each color)
do-while scripts
- do while
The while statement continually executes a block of statements while a particular
condition is true or met.

e.g: Run a script until 2pm


while [ condition]
do
command1
command2
command3
done

You might also like