Introduction To Unix: Common To Solaris - Husha
Introduction To Unix: Common To Solaris - Husha
Common to Solaris
-Husha
Anatomy of a Unix operating system
Boot sequence of Unix
1) Power switch on
2) Boot block mount.
3) Kernel initializes itself. Reads the /etc/system file. Customization is
allowed.
moddir – changes path of the kernel module.
rootfs - specify the system type of the root file system ( ufs ).
PID 0 (sched)
PID 1 (init).
Init phase
Execution of sbin/init program.
Run levels.
Inittab file – states the default run level and some actions to be
performed while the system reaches up to that level.
rc scripts & run levels. – /etc/rc0.1 , /etc/rc2.d etc.
Run Levels
SVR4
directory
structure
Files
Everything is a file.
Parent child relation b/w the files is maintained.
• Files grow dynamically only restriction being the mass of the storage
capacity.
• Owners dictate the read, write and execute permission of a file.
Permissions on a File
ls -lai
412403 -rwxrwxrwx 1 husha unknown 158 Feb 5 18:30 1.sh
470298 drwxrwxrwx+ 8 husha unknown 4096 Feb 4 19:32
DownloadFolder
346861 -rwxrwxrwx 1 Administ unknown 2330333 Feb 4 16:47
TutCorBa.zip
3360748 -rw-rw-rw- 1 husha unknown 61542 Feb 5 12:33 cvs.txt
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
blksize_t st_blksize;
blksize_t st_blocks;
mode_t st_attr; };
Vi editor
Vi is a full screen editor available in most Unix machines.
It was created by Bill Joy, a graduate student, who
later became the cofounder of Sun Microsystems.
Vi offers cryptic, and mnemonics, internal commands for
editing work. It makes use of the complete keyboard.
Which shell ?
Echo $SHELL – gives you the shell with which you are working
bourn shell sh - /bin/sh . ( .profile - login file )
C shell csh - /bin/csh. ( .cshrc ).
Korn shell ksh - /bin/ksh. ( .kshrc ).
bash shell bash - /bin/bash. ( .bashrc).
Shell Variables
Aliases – lets you assign shorthand's for the frequently used commands.
alias l ls –l , alias l=ls-l;
Command history. ( ! Command )
HISTSIZE=500
HISTFILE="$HOME/.bash_history“
SAVEHIST=500 export HISTSIZE
HISTFILE SAVEHIST
Shell programming – a group of UNIX commands in a file executing a
task. Such files are called shell scripts.
Test.sh
#!sh
#!sh +x
echo $1
if [ -r "C:/husha/input.txt" ]; then
echo "file found"
else
echo "file not found"
fi
Input file input .txt “welcome this is a new day and new day is always a new beginning.” –
33 lines of these.