Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.

Similar presentations


Presentation on theme: "Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will."— Presentation transcript:

1 Unix/Linux cs3353

2 The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will interpret lists of commands entered by the user, or read cmds from a file (known as a script). –A prompt is displayed by the shell program indicating it is ready to accept input from the user.

3 Shell Types Bourne Shell (ALGOL syntax) –sh, –bash –ksh –zsh C-shell (based on C language syntax) –csh –tcsh

4 Unix/Linux Commands commandName options files man commandName –to read about the command Example: man find

5 accounts Root –Has absolute control over the OS Regular –User login id number, string, and password.

6 Shell Startup The.bash_profile (in place of the.profile) and.bashrc are used at TU. Ubuntu,.bashrc

7 Linux Files Everything in the OS is organized into files. There is a i-node for every file on the file system (i = information)

8 Files Regular files includes (aka ordinary) –executable (*) and –hidden files (.). Special files: –Symbolic link (@) –Directory (d) –Others: block special, named pipe, character special Use the cmd: file filename Use the ls command.

9 The File System Navigate with cd, pwd, ls Organized by directories –mkdir, rmdir –cp, mv, rm / is known as root /boot /home /var /tmp

10 Directory Pathnames Absolute – always begins with root /. Relative – does not begin with root./aFile bFile /home/user/cFile../data/dFile

11 File names See pg 57 255 characters, no / allowed.

12 ls –l Type-user-group-other -rwxr-xr— Token 1 Token 2-4 Token 5-7 Token 8-10 Access control is through the chmod cmd.

13 chmod Octal: –chmod [ugo]+|-[rwx] –Octal r=4, w=2, x=1, the complement of umask –X is required for a script to run (pg 29) Examples

14 The Shell Env Variables –Local are only visible in the current process. –Environment variables are inherited by sub- processes, Example: PATH –PATH is used by the shell to find commands entered by the user. export PATH=$PATH:.:~/bin echo $PATH

15 Input and Output STDIN = 0 the standard input STDOUT = 1 the standard output STDERR = 2 the standard error Most cmds are designed to display output to the stdout Many cmds are designed to read input from the stdin. Error messages go to stderr.

16 Input & Output The default location for output is the terminal screen. It is possible to redirect the output of a command to: –Another command using a pipe | –A file using the output redirect symbol > Example: date > aFile ps | wc –l

17 Input & Output It is possible to control the input to a command The read command is designed to capture input from the standard input: cat file >Steve >stop greeting < file echo “What is your name?” read Name echo “Greetings $Name”

18 Processes Init is process id # 1 Dummy processes during system startup do not have a process ID. All other processes have a process ID.

19 Example Use ps and sleep to introduce background processes using the & ps will show processes running on a system. A process can be stopped (killed) by using the PID. kill pid

20 Substitution (Meta Characters) *, ?, [range] !, ^, $


Download ppt "Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will."

Similar presentations


Ads by Google