Introduction to UNIX UNIX Operating System by zwj23860



                      Introduction to UNIX

                       File structure
                       Common commands
                       Basic applications

                        CS192- YKM      9/4/01                        1

                  UNIX Operating System
         • UNIX is a multi-user, multitasking operating
           system with built-in networking functions
            – multi-user system, which lets many people
              simultaneously access and share the resources of a
              server computer
            – A multitasking system lets one user execute more than
              one program at a time
         • UNIX is also a portable operating system
            – portability means it can be used in a variety of
              computing environments

                        CS192- YKM      9/4/01                        2

Y.K.M.                                                                    1

                   Brief History of UNIX
         • A group of programmers at Bell Labs originally
           developed UNIX in the early 1970s
         • Bell Labs distributed UNIX in its source code
           form, so anyone who used UNIX could customize
           it as needed
         • Microsoft DOS and Microsoft Windows adopted
           original UNIX design concepts, such as the idea
           of a shell--an interface between the user and the
           operating system--and the hierarchical structure
           of directories and subdirectories

                      CS192- YKM   9/4/01                      3

                Layers of a UNIX System

                      CS192- YKM   9/4/01                      4

Y.K.M.                                                             2

                         Linux and UNIX
         • Linux is an implementation of UNIX.
         • Linus Torvalds created Linux and released it to
           the public in 1991.
         • You can install Linux on a PC where it can coexist
           with other operating systems.

                        CS192- YKM      9/4/01                         5

                             UNIX Shells
         • kernel: base operating system, interacts directly
           with the hardware and services the user
            – only accessible through kernel mode, which is reserved
              for the system administrator
         • Shell: interface between the user and the
           operating system
            – UNIX shells: Bourne shell, Korn shell, C shell, etc
            – Linux: Bash shell is default command interpreter
            – You can choose (shell programming)

                        CS192- YKM      9/4/01                         6

Y.K.M.                                                                     3

         • As a peer on a peer-to-peer local-area network in
           which each computer has Linux installed
         • Telnet connection to a remote computer
            – Telnet is a terminal emulation program for the Internet
            – a computer on the Internet has an Internet Protocol (IP)
              address (such as
            – most systems on the Internet also have a domain name
              such as
            – nslookup machinename returns both
         • Through a log-on terminal, connected to a UNIX
         • On a standalone PC that has the Linux installed

                        CS192- YKM     9/4/01                            7

                     Entering Commands
         • UNIX is case-sensitive, most UNIX commands in
         • You must a command using correct syntax
            – man somecommand: generates manual document
         • Syntax refers to a command’s format/wording,
           and options/arguments to extend/modify its
         • Always remember to logout using
           exit/logout/click button.

                        CS192- YKM     9/4/01                            8

Y.K.M.                                                                       4

               UNIX System Administrator
         • The system administrator manages the system by
           creating/ deleting accounts, and ensuring that the
           system performs services as expected
            – also called the superuser, because the system
              administrator has unlimited permission to change the
            – has a unique user name: root
            – system administrator’s prompt: #
         • all other users are ordinary users
            – command prompt for ordinary users format:
              [user name@hostname]$

                         CS192- YKM      9/4/01                          9

                        UNIX File System
         • A file is the basic component for data storage
         • UNIX considers everything it interacts with as a
           file, even devices such as monitors
         • A directory can contain other files and directories
            – subdirectory is the child of the parent directory
         • The tree-like structure for UNIX file systems
           starts at the root level
            – Root is the file at this level, denoted by character “/”

                         CS192- YKM      9/4/01                          10

Y.K.M.                                                                        5

                   Typical UNIX Directory

                        CS192- YKM     9/4/01                    11

             Subdirectories of the Root File
         • /usr: most operating system files and programs
         • /home: space for all users’ work
             – user owns and can access most files in his home
             – can grant or deny access to files
         •   /bin: binaries, or executables
         •   /lib: shared library images
         •   /dev: device drivers
         •   /mnt points for temporary mounts.
             – Subdirectories /mnt/cdrom /mnt/floppy
         • /tmp temporary place

                        CS192- YKM     9/4/01                    12

Y.K.M.                                                                6

                      Paths and Pathnames
         • To specify a file/directory, use its pathname,
           which follows the branches of the file system to
           the desired file
         • A forward slash (/) separates each directory name
         • pwd: display your current path (pwd: print
           working directory)
         • Absolute path begins at the root level and lists all
           subdirectories to the destination file
         • Relative path to begin at your current working
           directory and proceed from there
            – cd .    current directory
            – cd ..   to parent directory
                        CS192- YKM     9/4/01                13

                 Environment commands
         • ls (list) command: directory’s contents (files and
         • ls –l: in detail
         • ls –a: hidden files also
         • Wildcard:       *: any string ?: any character
         • Redirection: ls –l > somefile
         • date: date and time
         • whoami: current user
         • finger ausername: get someone’s login

                        CS192- YKM     9/4/01                14

Y.K.M.                                                            7

               Environment and file control
         •   mkdir somedirectory: create new directory
         •   rmdir somedirectory: delete directory
         •   cd somedirectory: change directory
         •   mv somefile somedirectory: move file to
         •   mv directory1 directory2: rename directory
         •   cp file1 file2: copy file
         •   mv file1 file2: rename file1 as file2
         •   rm file1: delete file1
         •   chmod mode file1: change mode of file1

                       CS192- YKM    9/4/01                15

                 Process control & Output
         •   ps: print status of current processes
         •   kill jobid: kill job with given id
         •   somecommand&: run command in background
         •   ctrl-c: interrupt process

         • lp –d aprinter file1: print file1 on aprinter
         • lpq –P aprinter: show print jobs in queue
         • lprm –P a printer jobid: kill a print job

                       CS192- YKM    9/4/01                16

Y.K.M.                                                          8

                      Some applications
         • Text editors:
            – vi: classic
            – pico: menu
            – mouse supported: notepad etc.
         • Mail:
            – mail command
            – pine mailer: menu
            – Mouse supported: Netscape, Kmail etc
         • Browsers:
         • Etc:

                       CS192- YKM    9/4/01          17

Y.K.M.                                                    9

To top