SlideShare uma empresa Scribd logo
1 de 21
Introduction
 UNIX Architecture
 UNIX file system
 Relative & Absolute path
 File permission
 Directory related commands
 Files related commands
 Miscellaneous commands


Presented by – Anil Kumar Kapil

February 7, 2014

UNIX
INTRODUCTION
What is UNIX?










Available in different flavors








An operating system
Invented in 1969 at AT&T Bell Labs
Command Line Interpreter
GUIs (Window systems) are now available
Written in the C programming language.
Multi-user : Several people can use a UNIX computer at the same time
Multi-process : A user can also run multiple programs at the same time

Solaris (Sun),
AIX (IBM)
Linux (open source)
Irix (SGI)
Berkeley

Unix is case-sensitive.

February 7, 2014




The UNIX operating system is made up of
three parts; the kernel, the shell and the
programs.




Commands and Utilities: There are various
command and utilities which you would use in
your day to day activities. cp, mv, cat and grep
etc.
Shell: Shell is an interface between user and
kernel. Shell interprets your input as
commands and pass them to kernel.

Utilities and Programs

User Interface

Operating System

Computer
Hardware

Unix Kernel



Kernel : The kernel is the heart of the
operating system. It interacts with hardware
and most of the tasks like memory
management, task scheduling and file
management .

Shell
(sh, bash, tcsh, ksh …)

cp, cat, rm, mv, grep, find, ls etc…

February 7, 2014

UNIX ARCHITECTURE
UNIX FILE SUBSYSTEM

All data in UNIX is organized into files. All files are organized into directories. These
directories are organized into a tree-like structure called the filesystem.



In UNIX, data, directory, process, hard disk etc (almost everything) are expressed as a
file.



Basic Directory Terms
Home directory

The home directory is a directory assigned to a user. When you log
in, your working directory will be set to your home directory
Root directory
Top of a file tree
Current directory Directory you’re in now
Dot (.)
Another term for the current directory
Dot-dot (..)
Parent of the current directory
Tilde (~)
$HOME directory

February 7, 2014


UNIX FILE SUBSYSTEM
February 7, 2014

NOTE: Unix file names
are CASE SENSITIVE!

Important

Directories

/bin This contains files that are essential for correct operation of the system. These are
available for use by all users.
/home  This is where user home directories are stored.
/var This directory is used to store files which change frequently, and must be available to be
written to.
/etc  Various system configuration files are stored here
/dev  This contains various devices as files, e.g. hard disk, CD- ROM drive, etc.
/sbin  Binaries which are only expected to be used by the super user.
/tmp Temporary files.
UNIX FILE SUBSYSTEM
In UNIX there are three basic types of files:




Directory is a special file that contains the names of other files and/or
subdirectories..





Regular file holds ASCII text, binary data, image data, databases, applicationrelated data, and more

Symbolic link. A type of file that point to another file

Every file has a data structure (record) known as an I-node that stores
information about the file, and the filename is simply used as a reference to
that data structure.

February 7, 2014


UNIX FILE TYPE

Regular file :
Most common file type found in the Solaris Operating
Environment
 Store different kinds of data.
 Regular files can hold ASCII text, binary data, image data,
databases, application-related data, and more.


February 7, 2014


UNIX FILE TYPE

Directory file :
Directories store information that associates file names with
inode numbers.
 Unlike regular files that can hold many different kinds of data,
directories can hold only one kind


February 7, 2014


UNIX FILE TYPE

Symbolic link :
A symbolic link is a file that points to another file.
 Like directories, symbolic links contain only one kind of data.
 A symbolic link contains the pathname of the file to which it
points.


February 7, 2014


RELATIVE & ABSOLUTE PATH

Path means a position in the directory tree.



Relative path





Absolute path





starts from current working directory
If you are already in the users directory, the
Relative pathname for file1 is usern/file1

start from root (/) and follow the tree
The absolute pathname for file1 is
/users/usern/file1

Specifying Paths



What is the absolute path to index.html?
What is the relative path to index.html

(assuming that usern is your pwd)?

February 7, 2014


LISTING FILES
ls: To list the files and directories stored in the current directory.
Syntax: ls [<file> … ]







ls - short listing
ls -l - long listing
ls -a  list all the files including hidden files that start with . .
ls –lt  list all files names based on the time of creation, newer files bring first.
ls –R lists all the files and files in the all the directories, recursively.

Example: ls –l backup
-rw-r--r-drwxr-xr-x
lrwxr-xr-x



1 ian wheel
4 ian admin
1 ian admin

9218
136
16

21
17
6

Aug 14:49
Jan 16:31
Jan 19:31

support.dat
talk-others
w -> /shared/w

In the ls -l listing example, every file line began with a d, -, or l. These characters indicate
the type of file
Prefix

Description

-

Regular file, such as an ASCII text file, binary executable, or hard link.

D

Directory file that contains a listing of other files and directories.

L

Symbolic link file. Links on any regular file.

February 7, 2014


FILE PERMISSION


Suppose you type in ls -l and the result is

Typesrwx r-x r--access supported22:28UNIX.
of file 1 hans doc 858 Aug 22 by hw1
-






r – read only permission
What do all these symbols mean?
w –write permission
x –execute permission




in case of directory, “x” grants permission to list directory contents. It signifies whether you are
permitted to search files under the directory

Unix users can be classified into these categories:




User – the user who created the file.
Group – the group owns the file.
Other – the rest of the world

February 7, 2014




Chmod  Change the access mode of one or more
files
Symbolic mode





Whose (user, group, or others) permissions you want to change
What (+ to add, - to subtract, = to equal) operation you want to
perform on the permission
The permission (r, w, x)

Numeric modes
Permissions are stored in the UNIX system in octal numbers.
An octal number is stored in UNIX system using three bits
 Bit 1, value 0 or 1 (read permission) , weight 4
 Bit 2, value 0 or 1 (write permission), weight 2
 Bit 3, value 0 or 1 (defines execute permission),
weight 1
For example, a value of 101 will be 5. (The value of
binary 101 is (4 * 1) + (0 * 1) + (1 * 1) = 5.)

Examples:






umask: Each time a file is created, its initial file mode
is defined by applying the current value of the file
creation mask






chmod o+r file.txt
chmod u+x file.txt
chmod u=rwx, g=r, o=wr my_file

umask  Show see the current value of the file creation mask
umask 077  To change the value of the file creation mask

chgrp: change group of the file
chown: change owner of the file

Examples


chmod 751 my_file

-R recursively descend through directory changing
group of all files and subdirectories

February 7, 2014

FILE PERMISSION


pwd: the absolute pathname of your current working directory



cd: Change directory
Examples:
 cd backups/unix-tutorial
 cd ../class-notes
 cd ~
 cd ..

February 7, 2014

WORKING WITH DIRECTORIES


cat: Display the contents of file
Syntax: cat <file>
Examples:

cat /export/home/xyz.txt  cat displays a file with no page breaks

cat file1 file2 >file3  concatenates file1 and file2, and writes the results in
file3. If no input file is given, cat reads
from the standard input file.

cat /dev/null/ > message.log  To Cleanup a file content :
# /dev/null/ acts as a black hole from where anything directed to or read from is set as Null.



more: displays a file one screenful at a time




more file1

cp: Copy file
Syntax: cp [options] <sources> <destination>
Options:
-i Interactive. cp prompts for confirmation whenever the copy would overwrite an existing target. A Y answer means that the
copy should proceed. Any other answer prevents cp from overwriting target.
-r  Recursive. cp copies the directory and all its files, including any subdirectories and their files to target.

cp tutorials.txt tutorial.txt.bak

cp –r dir1 /export/home/bsarda/dir2



touch: update the access and modification times of given file
touch a.txt
-a - Changes the access time of file.
-m Changes the modification time of file.


February 7, 2014

FILES RELATED COMMANDS


rm: remove file
Syntax: rm [options] <file>
Examples:

rm tutorials.txt

rm -rf /export/home/anil/dir2/ --This will remove files (write-protected too becoz of –f option) recursively from the
directory. If the dir is write-protected then it cant.



mv: Move/Rename file/directory
Syntax: mv [options] <sources> <destination>
Examples:

mv tutorials.txt tutorial2.txt

mv tutorials.txt /export/home/anil/dir2/



head: Showing first “n” lines of file, by default will display the first 10 lines of a file
Syntax: head –n file1
Examples:

head -20 tutorials.txt



tail: Showing last “n” lines of file, by default will display the last 10 lines of a file
Syntax: tail –n file1
Examples:

tail -20 tutorials.txt



wc: counts the characters, words or lines in a file depending upon the option.




wc -l filename  print total number of lines in a file.
wc -w filename print total number of words in a file.
wc -c filename  print total number of characters in a file.



diff: compare the two files and print out the differences



cmp: compare the two files and print out the differences

February 7, 2014

FILES RELATED COMMANDS




man: This is help command, and will explains you about
online manual pages
date: Display date and time
date + “%m-%d-%y %H:%M:%S”
date + “%D” -- mm/dd/yy

date + “%T” --hh:mi:ss
To get year as 2009 in full use „Y‟ otherwise „y „will give 09 only.
# To have a new line in between Date and Time use %n like
$date “+Date : %D %n %T” will give the output as

Date: 09/19/08
09:29:28





banner: prints characters in a sort of ascii art poster



cal: print the calander on current month by default

Examples:

banner wait

Syntax: tail –n file1
Examples:

cal 8 1965  print calander of august of 1965



sleep
Examples:

sleep 10  Tell a shell script to pause for 10 seconds




env: See environment variables



clear: clear the screen



dircmp: compares two directories.
Example :If i have two directories in my home directory
named dirone and dirtwo and each has 5-10 files in it. Then

dircmp dirone dirtwo will return this
Dec 9 16:06 1997 dirone only and dirtwo only Page 1
./cal.txt
./fourth.txt
./dohazaar.txt
./rmt.txt
./four.txt
./te.txt
./junk.txt
./third.txt

February 7, 2014

MISCELLANEOUS COMMANDS
TEXT PROCESSING COMMANDS
echo



sort: sort command sort the lines of a file or files, in alphabetical order
Example:

sort file.txt

sort -r file.txt

sort –f file.txt

sort –n file.txt

sort -k3 file.txt



cut: selects a list of columns or fields from one or more files





-- display in reverse order
-- ignore case
-- numerical order
-- Sorts using the third field of each line

cut –d „ „ -f 1,2,11, 15-20 file.txt
cut –c 1-8 file.txt  it will extract first 8 characters of every line in the file.

uniq: removes duplicate adjacent lines from sorted file while sending one copy of each second file
Examples

sort names | uniq -d  will show which lines appear more than once in names file
Options:
-c print each line once, counting instances of each.
-d print duplicate lines once, but no unique lines.

-u print only unique lines





tee: Put output on screen and append to file
Examples

who | tee -a > <file>

February 7, 2014


VIEWING & SETTING ENVIRONMENT VARIABLES
env



PATH Variable




Which




List of places (directories) on the system where the shell should look to locate a command. Each command you type is
physically located as a file somewhere on your file system

To find whether a particular command exists in you search path. If it does exist, which tells directory contains that command

Where

February 7, 2014


February 7, 2014

QUESTIONS ?
February 7, 2014

Thank You ……

Mais conteúdo relacionado

Mais procurados (20)

Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
 
Introduction to unix
Introduction to unixIntroduction to unix
Introduction to unix
 
Unix Administration
Unix AdministrationUnix Administration
Unix Administration
 
The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structure
 
UNIX Operating System ppt
UNIX Operating System pptUNIX Operating System ppt
UNIX Operating System ppt
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
 
Linux fundamentals Training
Linux fundamentals TrainingLinux fundamentals Training
Linux fundamentals Training
 
Linux file system
Linux file systemLinux file system
Linux file system
 
File system
File systemFile system
File system
 
Xfs file system for linux
Xfs file system for linuxXfs file system for linux
Xfs file system for linux
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Linux standard file system
Linux standard file systemLinux standard file system
Linux standard file system
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Ubuntu File System
Ubuntu File SystemUbuntu File System
Ubuntu File System
 
Linux: Basics OF Linux
Linux: Basics OF LinuxLinux: Basics OF Linux
Linux: Basics OF Linux
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Unix files
Unix filesUnix files
Unix files
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
Linux training
Linux trainingLinux training
Linux training
 

Destaque

Basic command ppt
Basic command pptBasic command ppt
Basic command pptRohit Kumar
 
Nguyễn Vũ Hưng The Unix and GNU/Linux command line - power tools
Nguyễn Vũ Hưng The Unix and  GNU/Linux command line - power toolsNguyễn Vũ Hưng The Unix and  GNU/Linux command line - power tools
Nguyễn Vũ Hưng The Unix and GNU/Linux command line - power toolsVu Hung Nguyen
 
White paper MABAC (Multi Level Attribute Based Access Control) by Gustavo Gi...
White paper MABAC  (Multi Level Attribute Based Access Control) by Gustavo Gi...White paper MABAC  (Multi Level Attribute Based Access Control) by Gustavo Gi...
White paper MABAC (Multi Level Attribute Based Access Control) by Gustavo Gi...Gustavo Giorgetti
 
Operating Systems (printouts)
Operating Systems (printouts)Operating Systems (printouts)
Operating Systems (printouts)wx672
 
Inode explanation
Inode explanationInode explanation
Inode explanationashishkb
 
Sentiment analysis of arabic,a survey
Sentiment analysis of arabic,a surveySentiment analysis of arabic,a survey
Sentiment analysis of arabic,a surveyArabic_NLP_ImamU2013
 
Case study operating systems
Case study operating systemsCase study operating systems
Case study operating systemsAkhil Bevara
 
Access Control: Principles and Practice
Access Control: Principles and PracticeAccess Control: Principles and Practice
Access Control: Principles and PracticeNabeel Yoosuf
 
Chapter 10
Chapter 10Chapter 10
Chapter 10 Google
 
A beginners introduction to unix
A beginners introduction to unixA beginners introduction to unix
A beginners introduction to unixzafarali1981
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)meashi
 
Unix memory management
Unix memory managementUnix memory management
Unix memory managementTech_MX
 

Destaque (20)

Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
Unit 2 ppt
Unit 2 pptUnit 2 ppt
Unit 2 ppt
 
Nguyễn Vũ Hưng The Unix and GNU/Linux command line - power tools
Nguyễn Vũ Hưng The Unix and  GNU/Linux command line - power toolsNguyễn Vũ Hưng The Unix and  GNU/Linux command line - power tools
Nguyễn Vũ Hưng The Unix and GNU/Linux command line - power tools
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
 
White paper MABAC (Multi Level Attribute Based Access Control) by Gustavo Gi...
White paper MABAC  (Multi Level Attribute Based Access Control) by Gustavo Gi...White paper MABAC  (Multi Level Attribute Based Access Control) by Gustavo Gi...
White paper MABAC (Multi Level Attribute Based Access Control) by Gustavo Gi...
 
Operating Systems (printouts)
Operating Systems (printouts)Operating Systems (printouts)
Operating Systems (printouts)
 
Unix ch03-03(2)
Unix ch03-03(2)Unix ch03-03(2)
Unix ch03-03(2)
 
Inode explanation
Inode explanationInode explanation
Inode explanation
 
Sentiment analysis of arabic,a survey
Sentiment analysis of arabic,a surveySentiment analysis of arabic,a survey
Sentiment analysis of arabic,a survey
 
Case study operating systems
Case study operating systemsCase study operating systems
Case study operating systems
 
How inodes Work
How inodes WorkHow inodes Work
How inodes Work
 
Access Control: Principles and Practice
Access Control: Principles and PracticeAccess Control: Principles and Practice
Access Control: Principles and Practice
 
8 Access Control
8 Access Control8 Access Control
8 Access Control
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
A beginners introduction to unix
A beginners introduction to unixA beginners introduction to unix
A beginners introduction to unix
 
Lect12
Lect12Lect12
Lect12
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
 
Basic Unix
Basic UnixBasic Unix
Basic Unix
 
Unix memory management
Unix memory managementUnix memory management
Unix memory management
 
File Management
File ManagementFile Management
File Management
 

Semelhante a Introduction to UNIX Operating System and Commands

Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxalehegn9
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)anandvaidya
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338Cam YP Co., Ltd
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338Cam YP Co., Ltd
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Scriptsbmguys
 
User administration concepts and mechanisms
User administration concepts and mechanismsUser administration concepts and mechanisms
User administration concepts and mechanismsDuressa Teshome
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritpingchockit88
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Vu Hung Nguyen
 
Operating systems unix
Operating systems   unixOperating systems   unix
Operating systems unixAchu dhan
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.pptMeesanRaza
 
Linux Notes-1.pdf
Linux Notes-1.pdfLinux Notes-1.pdf
Linux Notes-1.pdfasif64436
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfAllinOne746595
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.pptKiranMantri
 
linux-lecture1.ppt
linux-lecture1.pptlinux-lecture1.ppt
linux-lecture1.pptNikhil Raut
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linuxLiran Ben Haim
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 

Semelhante a Introduction to UNIX Operating System and Commands (20)

Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptx
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
 
User administration concepts and mechanisms
User administration concepts and mechanismsUser administration concepts and mechanisms
User administration concepts and mechanisms
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
Basic unix commands_1
Basic unix commands_1Basic unix commands_1
Basic unix commands_1
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
Operating systems unix
Operating systems   unixOperating systems   unix
Operating systems unix
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
Linux Notes-1.pdf
Linux Notes-1.pdfLinux Notes-1.pdf
Linux Notes-1.pdf
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdf
 
UNIX.pptx
UNIX.pptxUNIX.pptx
UNIX.pptx
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
 
QSpiders - Unix Operating Systems and Commands
QSpiders - Unix Operating Systems  and CommandsQSpiders - Unix Operating Systems  and Commands
QSpiders - Unix Operating Systems and Commands
 
linux-lecture1.ppt
linux-lecture1.pptlinux-lecture1.ppt
linux-lecture1.ppt
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linux
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 

Último

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 

Último (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 

Introduction to UNIX Operating System and Commands

  • 1. Introduction  UNIX Architecture  UNIX file system  Relative & Absolute path  File permission  Directory related commands  Files related commands  Miscellaneous commands  Presented by – Anil Kumar Kapil February 7, 2014 UNIX
  • 2. INTRODUCTION What is UNIX?         Available in different flavors       An operating system Invented in 1969 at AT&T Bell Labs Command Line Interpreter GUIs (Window systems) are now available Written in the C programming language. Multi-user : Several people can use a UNIX computer at the same time Multi-process : A user can also run multiple programs at the same time Solaris (Sun), AIX (IBM) Linux (open source) Irix (SGI) Berkeley Unix is case-sensitive. February 7, 2014 
  • 3.  The UNIX operating system is made up of three parts; the kernel, the shell and the programs.   Commands and Utilities: There are various command and utilities which you would use in your day to day activities. cp, mv, cat and grep etc. Shell: Shell is an interface between user and kernel. Shell interprets your input as commands and pass them to kernel. Utilities and Programs User Interface Operating System Computer Hardware Unix Kernel  Kernel : The kernel is the heart of the operating system. It interacts with hardware and most of the tasks like memory management, task scheduling and file management . Shell (sh, bash, tcsh, ksh …) cp, cat, rm, mv, grep, find, ls etc… February 7, 2014 UNIX ARCHITECTURE
  • 4. UNIX FILE SUBSYSTEM All data in UNIX is organized into files. All files are organized into directories. These directories are organized into a tree-like structure called the filesystem.  In UNIX, data, directory, process, hard disk etc (almost everything) are expressed as a file.  Basic Directory Terms Home directory The home directory is a directory assigned to a user. When you log in, your working directory will be set to your home directory Root directory Top of a file tree Current directory Directory you’re in now Dot (.) Another term for the current directory Dot-dot (..) Parent of the current directory Tilde (~) $HOME directory February 7, 2014 
  • 5. UNIX FILE SUBSYSTEM February 7, 2014 NOTE: Unix file names are CASE SENSITIVE! Important Directories /bin This contains files that are essential for correct operation of the system. These are available for use by all users. /home  This is where user home directories are stored. /var This directory is used to store files which change frequently, and must be available to be written to. /etc  Various system configuration files are stored here /dev  This contains various devices as files, e.g. hard disk, CD- ROM drive, etc. /sbin  Binaries which are only expected to be used by the super user. /tmp Temporary files.
  • 6. UNIX FILE SUBSYSTEM In UNIX there are three basic types of files:   Directory is a special file that contains the names of other files and/or subdirectories..   Regular file holds ASCII text, binary data, image data, databases, applicationrelated data, and more Symbolic link. A type of file that point to another file Every file has a data structure (record) known as an I-node that stores information about the file, and the filename is simply used as a reference to that data structure. February 7, 2014 
  • 7. UNIX FILE TYPE Regular file : Most common file type found in the Solaris Operating Environment  Store different kinds of data.  Regular files can hold ASCII text, binary data, image data, databases, application-related data, and more.  February 7, 2014 
  • 8. UNIX FILE TYPE Directory file : Directories store information that associates file names with inode numbers.  Unlike regular files that can hold many different kinds of data, directories can hold only one kind  February 7, 2014 
  • 9. UNIX FILE TYPE Symbolic link : A symbolic link is a file that points to another file.  Like directories, symbolic links contain only one kind of data.  A symbolic link contains the pathname of the file to which it points.  February 7, 2014 
  • 10. RELATIVE & ABSOLUTE PATH Path means a position in the directory tree.  Relative path    Absolute path    starts from current working directory If you are already in the users directory, the Relative pathname for file1 is usern/file1 start from root (/) and follow the tree The absolute pathname for file1 is /users/usern/file1 Specifying Paths   What is the absolute path to index.html? What is the relative path to index.html (assuming that usern is your pwd)? February 7, 2014 
  • 11. LISTING FILES ls: To list the files and directories stored in the current directory. Syntax: ls [<file> … ]      ls - short listing ls -l - long listing ls -a  list all the files including hidden files that start with . . ls –lt  list all files names based on the time of creation, newer files bring first. ls –R lists all the files and files in the all the directories, recursively. Example: ls –l backup -rw-r--r-drwxr-xr-x lrwxr-xr-x  1 ian wheel 4 ian admin 1 ian admin 9218 136 16 21 17 6 Aug 14:49 Jan 16:31 Jan 19:31 support.dat talk-others w -> /shared/w In the ls -l listing example, every file line began with a d, -, or l. These characters indicate the type of file Prefix Description - Regular file, such as an ASCII text file, binary executable, or hard link. D Directory file that contains a listing of other files and directories. L Symbolic link file. Links on any regular file. February 7, 2014 
  • 12. FILE PERMISSION  Suppose you type in ls -l and the result is Typesrwx r-x r--access supported22:28UNIX. of file 1 hans doc 858 Aug 22 by hw1 -    r – read only permission What do all these symbols mean? w –write permission x –execute permission   in case of directory, “x” grants permission to list directory contents. It signifies whether you are permitted to search files under the directory Unix users can be classified into these categories:    User – the user who created the file. Group – the group owns the file. Other – the rest of the world February 7, 2014 
  • 13.  Chmod  Change the access mode of one or more files Symbolic mode    Whose (user, group, or others) permissions you want to change What (+ to add, - to subtract, = to equal) operation you want to perform on the permission The permission (r, w, x) Numeric modes Permissions are stored in the UNIX system in octal numbers. An octal number is stored in UNIX system using three bits  Bit 1, value 0 or 1 (read permission) , weight 4  Bit 2, value 0 or 1 (write permission), weight 2  Bit 3, value 0 or 1 (defines execute permission), weight 1 For example, a value of 101 will be 5. (The value of binary 101 is (4 * 1) + (0 * 1) + (1 * 1) = 5.) Examples:     umask: Each time a file is created, its initial file mode is defined by applying the current value of the file creation mask     chmod o+r file.txt chmod u+x file.txt chmod u=rwx, g=r, o=wr my_file umask  Show see the current value of the file creation mask umask 077  To change the value of the file creation mask chgrp: change group of the file chown: change owner of the file Examples  chmod 751 my_file -R recursively descend through directory changing group of all files and subdirectories February 7, 2014 FILE PERMISSION
  • 14.  pwd: the absolute pathname of your current working directory  cd: Change directory Examples:  cd backups/unix-tutorial  cd ../class-notes  cd ~  cd .. February 7, 2014 WORKING WITH DIRECTORIES
  • 15.  cat: Display the contents of file Syntax: cat <file> Examples:  cat /export/home/xyz.txt  cat displays a file with no page breaks  cat file1 file2 >file3  concatenates file1 and file2, and writes the results in file3. If no input file is given, cat reads from the standard input file.  cat /dev/null/ > message.log  To Cleanup a file content : # /dev/null/ acts as a black hole from where anything directed to or read from is set as Null.  more: displays a file one screenful at a time   more file1 cp: Copy file Syntax: cp [options] <sources> <destination> Options: -i Interactive. cp prompts for confirmation whenever the copy would overwrite an existing target. A Y answer means that the copy should proceed. Any other answer prevents cp from overwriting target. -r  Recursive. cp copies the directory and all its files, including any subdirectories and their files to target.  cp tutorials.txt tutorial.txt.bak  cp –r dir1 /export/home/bsarda/dir2  touch: update the access and modification times of given file touch a.txt -a - Changes the access time of file. -m Changes the modification time of file.  February 7, 2014 FILES RELATED COMMANDS
  • 16.  rm: remove file Syntax: rm [options] <file> Examples:  rm tutorials.txt  rm -rf /export/home/anil/dir2/ --This will remove files (write-protected too becoz of –f option) recursively from the directory. If the dir is write-protected then it cant.  mv: Move/Rename file/directory Syntax: mv [options] <sources> <destination> Examples:  mv tutorials.txt tutorial2.txt  mv tutorials.txt /export/home/anil/dir2/  head: Showing first “n” lines of file, by default will display the first 10 lines of a file Syntax: head –n file1 Examples:  head -20 tutorials.txt  tail: Showing last “n” lines of file, by default will display the last 10 lines of a file Syntax: tail –n file1 Examples:  tail -20 tutorials.txt  wc: counts the characters, words or lines in a file depending upon the option.    wc -l filename  print total number of lines in a file. wc -w filename print total number of words in a file. wc -c filename  print total number of characters in a file.  diff: compare the two files and print out the differences  cmp: compare the two files and print out the differences February 7, 2014 FILES RELATED COMMANDS
  • 17.   man: This is help command, and will explains you about online manual pages date: Display date and time date + “%m-%d-%y %H:%M:%S” date + “%D” -- mm/dd/yy  date + “%T” --hh:mi:ss To get year as 2009 in full use „Y‟ otherwise „y „will give 09 only. # To have a new line in between Date and Time use %n like $date “+Date : %D %n %T” will give the output as  Date: 09/19/08 09:29:28    banner: prints characters in a sort of ascii art poster  cal: print the calander on current month by default Examples:  banner wait Syntax: tail –n file1 Examples:  cal 8 1965  print calander of august of 1965  sleep Examples:  sleep 10  Tell a shell script to pause for 10 seconds   env: See environment variables  clear: clear the screen  dircmp: compares two directories. Example :If i have two directories in my home directory named dirone and dirtwo and each has 5-10 files in it. Then  dircmp dirone dirtwo will return this Dec 9 16:06 1997 dirone only and dirtwo only Page 1 ./cal.txt ./fourth.txt ./dohazaar.txt ./rmt.txt ./four.txt ./te.txt ./junk.txt ./third.txt February 7, 2014 MISCELLANEOUS COMMANDS
  • 18. TEXT PROCESSING COMMANDS echo  sort: sort command sort the lines of a file or files, in alphabetical order Example:  sort file.txt  sort -r file.txt  sort –f file.txt  sort –n file.txt  sort -k3 file.txt  cut: selects a list of columns or fields from one or more files    -- display in reverse order -- ignore case -- numerical order -- Sorts using the third field of each line cut –d „ „ -f 1,2,11, 15-20 file.txt cut –c 1-8 file.txt  it will extract first 8 characters of every line in the file. uniq: removes duplicate adjacent lines from sorted file while sending one copy of each second file Examples  sort names | uniq -d  will show which lines appear more than once in names file Options: -c print each line once, counting instances of each. -d print duplicate lines once, but no unique lines.  -u print only unique lines    tee: Put output on screen and append to file Examples  who | tee -a > <file> February 7, 2014 
  • 19. VIEWING & SETTING ENVIRONMENT VARIABLES env  PATH Variable   Which   List of places (directories) on the system where the shell should look to locate a command. Each command you type is physically located as a file somewhere on your file system To find whether a particular command exists in you search path. If it does exist, which tells directory contains that command Where February 7, 2014 