1 / 15

UNIX Shell

UNIX Shell. Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology hoai@cse.hcmut.edu.vn. Where is a shell ?. C programs scripts. Users. Shells & Utilities. ksh, bash, gcc, find. open(), fork(), Exec(),. kernel. Hardware. What is a shell ?. To users:

jeneil
Download Presentation

UNIX Shell

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UNIX Shell Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology hoai@cse.hcmut.edu.vn

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

  3. What is a shell ? • To users: • 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 hoai:x:556:500:Tran Van Hoai:/home/hoai:/bin/bash • Default shell for interactive use • “which” to find a path of a shell hoai@moon:~> which tcsh /usr/bin/tcsh hoai@moon:~> which bash /bin/bash • “exec” to change shell hoai@moon:~> 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. hoai@moon:~> ls -l lib.tar.gz -rwx------ 1 hoai users 80738389 2005-09-27 17:09 lib.tar.gz command arguments Simple commands • Sequence of non-blank arguments separated by blanks or tabs • First argument = name of command

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

  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. hoai@moon:~> ls -l lib.tar.gz -rwx------ 1 hoai users 80738389 2005-09-27 17:09 lib.tar.gz read write execute Example

  15. Unix file system is NEXT

More Related