Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
- Ravi
www.etraining.guru
Circular View
Horizontal View
Similarly, Unix and Linux OSs have various flavors/versions too. Lets first look at Unix Evolution
Unix Evolution
MULTIcs
(MULTIplexed Information and Computing Service)
UNIX
By, Dennis Ritchie, Brain kernighan and Ken Thompson @AT&T Bell
Laboratories in early 1970's
Unix Evolution
Unix Evolution
Note: You can also call these Single Unix Specifications as POSIX - Portable Operating System Interface for UNIX
Unix Evolution
Unix Evolution
Unix Evolution
What is LINUX?
Linux is a Unix clone written from scratch by Linus Torvalds with
assistance from a loosely-knit team of hackers across the Net. It
aims towards POSIX compliance.
Below are few popular Linux distributions:
Debian - A non-commercial distribution maintained by a volunteer developer community with a
strong commitment to free s/w principles
Ubuntu
Fedora
openSUSE
UNIX Architecture
H/W
Shell
Tools &
Applications
Kernel
UNIX Architecture
Categorized as three levels:
Kernel - Core/Heart of the Operating System
Shell - User interface with Operating System
Tools and Applications - Utilities and User Programs
uname
Command Name: uname
Description: Print system information
Syntax: uname [option]
Usage:
uname -a
uname -s
uname -n
uname -r
uname -o
uname -son
uname -m
uname -i
man
Command Name: man
Description: Online manual pages; In built google!
Syntax: man [command]
Usage:
man uname
man man
User Related
who Shows who is logged on
w Shows who is logged on and what they are doing
whoami Effective userid
who am i details about the userid
stty a
Example: stty intr ^a (To use CTRL + a for interrupt)
cal
banner
clear
alias
Date Command
Examples
-
$ date
$ date +%D
$ date +%T
$ date +%d-%m-%Y
Example:
$date MMDDhhmmYYYY.ss
Where, MM month
DD day
YYYY year
hh hour is based on 24 hour
mm minutes
ss seconds
uname
man
who
w
whoami
who am i
tty
ifconfig
cal
banner
stty
date
clear
alias
What is a filesystem?
A filesystem is a logical collection of files on a partition or disk. You can view
filesystems using df (or) bdf commands
Unix uses a hierarchical file system structure, much like an upside-down tree, with
root (/) at the base of the file system and all other directories spreading from there.
In Unix everything is a file - a stream of bytes. Unix treats documents, directories,
hard-drives, CD-Roms, modems, keyboards, printers, monitors, terminals, etc as
files.
For each file in the filesystem, UNIX stores administrative information in a
structure known as Inode (Index node).
ls -I /etc/passwd
stat /etc/passwd
pwd
ls
cd
mkdir
touch
Long Listing
ls la
ls ltr
cd Change Directory
syntax: cd [options] [directory]
Example: To go to root directory, cd /
cd .
cd ..
cd -
ls l training
cd training;
mv move/rename files
Syntax: mv [OPTIONS] SOURCE DEST
Example: cd training
mv mycopy mvcopy
2 cdctrg32 cdctrg32
Note: type cat linkme. The usage of cat will be covered in later
sessions
File Permissions
ls l filename will display as below:
-rw-rw-r--
1 cdctrg32 cdctrg32
1 cdctrg32 cdctrg32
Example: Can you cat the below file to see the contents of the file
cat /home/cdctrg32/ravi/passwords
Nope. But why?
touch
creates empty file
changes the file timestamp
Example: touch filename
umask
User file creation mode mask 4 digit octal number that unix uses
to determine the file permission for newly created files
(666 umask) value is the default permissions
Exercise: Change the umask value to 000 and create a new file.
(Bingo!!!)
history command
history displays the history of typed commands
Usage: history 20
!! Repeats the last command
!number -> reruns the command given at the given line
passwd To change your password