Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIX Shell Dr. Tran, Van Hoai

Similar presentations


Presentation on theme: "UNIX Shell Dr. Tran, Van Hoai"— Presentation transcript:

1 UNIX Shell Dr. Tran, Van Hoai
Faculty of Computer Science and Engineering HCMC Uni. of Technology

2 Where is a shell ? Users Shells & Utilities kernel Hardware C programs
scripts Users Shells & Utilities ksh, bash, gcc, find open(), fork(), Exec(), kernel Hardware

3 What is a shell ? To users: And definition A user interface to UNIX
Many shells Thought harder to use than GUI, but not Harder to learn And definition Program to make the system understand commands (also called command intepreter)

4 Purpose of shell Interactive use Customization of UNIX session
Environment variables Startup files Programming Shell scripts: executing a series of commands

5 Favourite shells GNU Project’s Bash (Bourne-Again SHell) (bash)
Thompson shell → Bourne shell → Bash Most popular Command-line editing Korn shell (ksh) “Tenex” C shell (tcsh) C programming style

6 Shell for individual /etc/passwd Default shell for interactive use
hoai:x:556:500:Tran Van Hoai:/home/hoai:/bin/bash Default shell for interactive use “which” to find a path of a shell which tcsh /usr/bin/tcsh which bash /bin/bash “exec” to change shell exec bash

7 Interactive use Command history Command-line editing
File/command expansion Job control

8 Shell scripting Script = set of shell and UNIX commands
Text file Executable program Automating repetitive task and administrative tools

9 Simple commands Sequence of non-blank arguments separated by blanks or tabs First argument = name of command ls -l lib.tar.gz -rwx hoai users :09 lib.tar.gz command arguments

10 Types of arguments Options/Flags Parameters -X or –longname
$ tar –c –v –f archive.tar main.c main.h Options/Flags -X or –longname Parameters Strings, file names Depends on command

11 Getting help on UNIX “man”: display manual page
Manual entry organization Commands System calls Subroutines Special files File format and conventions Games

12 Security fundamentals
Multiple users identified by a number and and name hoai:x:556:500:Tran Van Hoai:/home/hoai:/bin/bash superuser = (id 0, name root) Set of users can form a group A user can belong to several groups

13 How are users/groups used?
Used to determine if file or process operations can be performed Can a given file be read? Written to ? Can this program be run? Can I use this piece of hardward? Can I stop a particular running process?

14 Example hoai@moon:~> ls -l lib.tar.gz
-rwx hoai users :09 lib.tar.gz read write execute

15 Unix file system is NEXT


Download ppt "UNIX Shell Dr. Tran, Van Hoai"

Similar presentations


Ads by Google