UNIX Linux - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

UNIX Linux

Description:

As a Butler, an OS performs services that would be too complicated or dangerous ... To activate a permission use a and to deactivate a permission use a - symbol. ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 41
Provided by: BAVA9
Category:
Tags: unix | deactivate | linux | msdos

less

Transcript and Presenter's Notes

Title: UNIX Linux


1
UNIX / Linux
  • Courtesy B. VachonRevised G. Cooper

2
What is an Operating System?
  • The OS is part Butler and part Security Guard.
  • As a Butler, an OS performs services that would
    be too complicated or dangerous for other
    programs to do for themselves (e.g., printing,
    loading applications, etc.)
  • As a Security Guard, the OS protects the users
    and their data.
  • Keeps files from interfering with each other.
  • Makes sure that users cant read or write to each
    others files unless they have permission.
  • It allocates to each user their fair share of the
    computers resources memory, disk space,
    processing time, etc.
  • It can restrict computer access to authorized
    users only.

3
Layers of an Operating System (OS)
  • An Operating System can be divided into three
    parts
  • Utilities consist of the file management commands
    and programs associated with the OS.
  • (e.g., for DOS CHKDSK, FORMAT, DISKCOPY)
  • Shell is what stands in between the user and the
    kernel.
  • Enable users to set up aliases, histories, etc.
  • Popular UNIX shells include the Bourne Shell, C
    Shell, Kornshell, Bourne Again Shell (bash), and
    T Shell.
  • The Kernel is the collection of programs that
    provides the basic capabilities of the OS.

4
History of UNIX
  • UNIX started out as MULTICS, a collaborative
    effort with GE, ATT and MITT in the late 60's.
  • UNIX was officially developed by Ken Thompson and
    Dennis Ritchie of Bell Labs (ATT) in New Jersey
    in 1970.

5
History of UNIX
  • UNIX was developed to accept short commands and
    display no responses unless something went wrong.
  • It was intended to be used by only a small number
    of people and it was assumed that the users were
    to be experienced professionals.

6
History of DOS
  • MS-DOS and PC-DOS was developed by Bill Gates and
    Paul Allen in the late 70's for Microsoft.
  • IBM had approached them for an OS which would
    work with their IBM-PC.
  • Because DOS was constructed later than UNIX, its
    programmers could build on existing experience
    with UNIX and borrow many UNIX features.

7
Why You Should Investigate UNIX?
  • UNIX
  • makes it possible to share a system with other
    people without interfering with each other.
  • is multitasking enables you to do several things
    at once.
  • is a mature system (its been around for 30
    years).
  • is extremely customizable, it can be streamlined.
  • can run on almost any computer (i.e., from a
    microcomputer to a supercomputer).
  • is in demand - companies want to hire people with
    UNIX expertise.
  • is an extremely powerful OS.
  • E.g. using only one command, backup all of the
    files which were created less than a day ago in
    Windows 95,
  • cp (find . -ctime -1)
  • it is an extremely stable OS

8
(No Transcript)
9
The Different Flavours of UNIX
  • UNIX System V (originally ATTs)
  • Now Novell (SVR4.2 UNIXWare).
  • Berkeley BSD (Berkeley Software Distribution)
  • AIX (IBM)
  • HP/UX (Hewlett-Packard)
  • OSF/1 (DEC)
  • SCO UNIX (SCO) which also sold XENIX (originally
    Microsofts)
  • Solaris (SUN)
  • Linux (Slackware, Redhat, Caldera, Debian
    Mandrake)

10
The UNIX Philosophy
  • Reducing User Effort
  • Combining Small Tools into Larger Ones
  • Customizing

11
UNIX
Dilbert - United Features Syndicate Inc.
12
The man pages
  • To get help with commands in UNIX we can use the
    man command.
  • The man pages (Manual Pages) provide detailed
    descriptions to commands
  • Warning to new users man pages are often very
    encrypted and difficult to understand.
  • man command-name (e.g., man cp)

13
The man pages
  • The keystrokes for navigating within a man page
    are
  • Spacebar - to advance to the next screen
  • Enter - to move one line down
  • b - to move one screen up
  • q - to quit (exit)
  • Note A quicker and sometimes more effective way
    to get help, is to type in the command you wish
    help with and then follow it with --help
  • For example cp --help

14
Login In
  • Whenever you use the UNIX OS you will be
    requested for a login name.
  • A login name is also referred to as the userid.
  • When prompted for a password, make sure that you
    enter it exactly as before.
  • Upper-case vs. Lowercase
  • UNIX systems are very case-sensitive.
  • Most commands must be typed in lowercase.
  • To UNIX, a lowercase command typed in upper-case
    will mean something totally different.
  • For example
  • ECHO Hello will not work
  • echo Hello will display Hello on the screen

15
The echo command
  • The echo command will display the argument on
    screen.
  • echo argument
  • By using quotes, UNIX treats the entry as one
    argument.
  • The command line can be up to 8,192 characters.
  • Command variations

If You Type In . . .
UNIX would . . .
ECHO HI MOM
Bash ECHO command not found
echo Hi Mom
Hi Mom
echo Hi Mom
Hi Mom
echo Hi Mom
Hi Mom
16
The passwd and exit commands
  • The passwd command will allow the user to change
    passwords.
  • The user will be prompted to enter the current
    password (for authorization) and then enter the
    new password twice.
  • The exit command is used to exit out of the UNIX
    OS.
  • Linux also accepts the logout command.

17
Text and Binary Files
  • UNIX treats all files as either text or binary.
  • Text files contain ordinary lines of text.
  • Binary files are all other files.
  • They contain any kind of data and are commonly
    created with software packages.
  • E.g.,
  • spreadsheet
  • graphics
  • word processing
  • executable files

18
Rules for UNIX Filenames
  • UNIX systems comply to the POSIX portable
    character set standard.
  • Filenames can contain
  • abcdefghijklmnopqrstuvwxyz
  • ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • 0123456789
  • . (dot or period)
  • _ (underscore)
  • - (dash or minus symbol)
  • Depending on the version of UNIX that you are
    using, the filename could also incorporate other
    characters, however, these are compliant to all
    UNIX systems.

19
Rules for UNIX Filenames
  • All UNIX systems support filenames of up to 14
    characters in length.
  • Other versions of UNIX may go beyond this
    limitation.
  • Filenames are not limited to one dot as in the
    DOS environment.
  • E.g.,
  • .user
  • please.read.me
  • unit-1.page-2
  • Upper-case and lowercase filenames are considered
    separate files. (ie are case-sensitive)
  • E.g.,
  • sonnet and SONNET are not the same file.

20
Slash and Backslash
  • Just as in the DOS system, UNIX uses the same
    concept of directory structure.
  • However, UNIX uses the / (slash) instead of
    backslash character \ to separate components of
    a filename and to indicate the root directory.

21
The more Command
  • The more command is used to display text file(s).
  • more option filename filename
  • Command options (Linux)
  • -d displays messages
  • -p do not scroll (clear the screen, then display
    the text).
  • Command navigation keys (Linux)
  • Spacebar Display next screen
  • b or B Skip backwards 1 screen (page)
  • q Exit

22
The less Command
  • The less command is also used to display text
    file(s).
  • less option filename filename
  • More flexible because it allows backward movement
    in the file as well as forward movement.
  • Type help when using the less command to see the
    exhaustive list of commands
  • Also, it doesnt have to read the entire input
    file before starting, therefore its faster when
    opening large files.

23
The cat and ls commands
  • The cat command
  • Similar to the more command but not as user
    friendly (e.g., doesnt pause when screen is
    full).
  • cat filename filename
  • Can be used to create text file (similar to the
    copy con command)
  • The ls command
  • The ls command (short for list) displays a list
    of files in alphabetical order.
  • Linux also offers the dir command.

24
The cp command
  • The cp command lets the user copy files.
  • cp options from-filename(s) to-filename
  • The cp command requires a destination argument.
  • If the last argument in the command is that
  • of an existing directory, then the cp command
    will copy the file(s) into it.
  • of a file, then the cp copy will create the file.
  • of an existing file, then the cp command will
    replace the existing file without confirmation.

25
The cp command
  • It is an error if
  • the last argument is not a directory
  • more than two files are given.
  • By default, it does not copy directories.
  • Handy options include
  • -i (interactive)
  • -r (recursive)

26
The rm command
  • The rm command (short for remove) lets the user
    remove or delete file(s).
  • rm option filename filename . . .
  • Handy options include
  • -i (interactive)
  • -r (recursive)

27
The mv command
  • The mv command lets the user move (or rename)
    files.
  • Once moved, the original file is no longer found
    and destination file or directory must be
    specified.
  • mv options filename(s) new-file or directory
  • If the last argument in the command is that of an
    existing file, then the mv command will replace
    the existing file without confirmation.

28
The cd command
  • The cd command (short for change current
    directory) lets the user change the current
    directory.
  • cd directory-name
  • Command variations

If You Type In . . .
UNIX would change to the . . .
cd
The users home directory
cd /
The Root directory
cd /bin
The bin directory (branching from the root)
cd ..
The parent directory (one level up)
cd ../dirname
The sibling directory
cd -
The last directory you were in. Use it again and
it switches back to the directory you were in.
29
The mkdir and rmdir commands
  • The mkdir command is used to create directories.
  • mkdir directory-name
  • A user can only create directories in directories
    they have write permission to (e.g., their home
    area).
  • The rmdir command is used to remove an empty
    directory.
  • rmdir directory-name
  • The directory cannot be the working directory
    (directory they are in).

30
The pwd command
  • The pwd command (present working directory) asks
    your system to tell you what directory youre
    currently in.
  • It displays the absolute path as opposed to the
    relative path

31
Unix File System
  • Unlike Windows which have drive letters to
    contend with, Unix only has one single top level
    root directory.
  • Other drives appear as directories.
  • The process of telling the file system that the
    drive exists and what directory it should appear
    at is called mounting the drive.

32
Files and Directories
  • UNIX employs the same concept of directory
    structures as DOS.
  • Most UNIX systems will have the following
    structure
  • Its the highest level directory
  • Should not be cluttered with files or too many
    directories.
  • Home directory for root (superuser)

/ root
home
bin
dev
etc
tmp
  • Binary directory contains the essential utilities
    and commands
  • Device directory contains device files

user2
user3
user1
  • Temporary holding area for programs
  • Users personal directories
  • Administrative, configuration and other system
    files are here

33
File Characteristics
  • The UNIX file system records the following
    characteristics for each file including
  • the size of the file
  • the date and time it was last changed
  • and who is permitted to use the file and how are
    they permitted to use it.

34
Three Sets of File Permissions
  • Owner
  • The person who created the file is the owner of
    the file.
  • Group
  • The system supervisor can create groups to help
    teams work together.
  • Each person on the system is assigned to one
    primary group and could be assigned to several
    other secondary groups.
  • When a file is created, the owners primary group
    automatically receives their rights to that file.
  • Other
  • Everyone else on the system who is not the files
    owner or in the files group.

35
Type of File Permissions
  • UNIX has three types of file permissions and each
    is represented by a code letter.
  • r Lets you read the file.
  • w Lets you write to the file.
  • x Lets you execute the file.
  • They are always written in the following order
  • rwx

36
Type of File Permissions
  • A file will list the permissions to it as
    rwxrwxrwx
  • The file permissions are divided into three
    sections
  • The first sequence of rwx are the owners rights
  • The second sequence of rwx are the groups rights
  • The last sequence of rwx is for the others
    rights.
  • If a letter is substituted by a dash (-), then
    that right is not available.

37
Type of File Permissions continued . . .
  • For example

These rights . . .
Indicate . . .
rwxrwxrwx
Everybody has rights to the file/directory
rwxrw-r--
Owner (rwx) all rights Group (rw-) read and
write rights Others (r--) read right only
r--r--r--
Owner (r--) read right only Group (r--) read
right only Others (r--) read right only
38
Types of Directory Permissions
  • UNIX has a similar system of permissions for
    directories.
  • Each is represented by a code letter.
  • r Lets you read the files/ subdirectories in the
    directory.
  • w Lets you create new files/subdirectories in
    that directory.
  • x Lets you search through the directory.

39
Listing File Characteristics
  • The ls command can also be used to list file
    characteristics.
  • ls -l filename (e.g., ls -l sonnet)

A - Indicates a file or directory (- for file, d
for directory) B - File permissions for owner
(read and write) C - File permissions for group
(read and write) D - File permissions for others
(read) E - of hard links to the file F - Owners
name G - Owners primary group name H - File size
(bytes) I - Date and time since it last
saved J - The name of the file or directory.
40
The chmod command
  • The chmod (change mode) command is used to set
    file and directory permissions.
  • chmod permissions name
  • Specify u for owner, g for group, o for others,
    and a for all.
  • More than one permission can be specified at a
    time.
  • To activate a permission use a and to
    deactivate a permission use a - symbol.

This command
Indicates that for the nursery file
chmod o-w nursery
takes away write permission from others
chmod gorw nursery
gives read write to the group and others
chmod urwx nursery
gives read, write and execute to you
Write a Comment
User Comments (0)
About PowerShow.com