Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 107 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
107
Dung lượng
181 KB
Nội dung
1 Basic Unix And Basic Shell Scripting 2 Course Objectives The participant will learn Unix Introduction Unix file related commands Unix text manipulation commands Environment variables The vi-editor Shell programming Awk programming 3 Introduction to Unix Features of Unix System: 1. Simple design, organization and functioning 2. Portability 3. Background processing 4. Hierarchical File System 5. Multi-user 6. Multi-tasking 7. Security 8. Interactive Operating System 9. Communication facilities 10. Utilities 4 Introduction to Unix Utility Software: 1. Text Manipulation tools: cut, grep, tr, etc. 2. Advanced filters: sed, awk, etc. 3. Document Formatting tools: troff, nroff, etc. 4. Various Programming Languages: C, C++, Java, etc. 5. Interactive Calculators : bc, dc, etc. 6. Advanced tools : lex, yacc. 5 Unix File System The Unix file system is the structure in which all the information on your computer is stored. It has hierarchical file structure, where each directory can contain files, as well as other directories. It looks like an upside down tree. Unix looks at everything as a file. At the top is the root directory, represented by a forward slash (/). At the children node of it is a set of common directories in the Linux system, such as /bin, /dev, /home, etc. 6 Unix File System The diagram shows the Linux file structure / bin/ home/ etc/ dev/ … itp1/ itp2/ … test1.sh test2.sh … 7 Unix File System In Windows file systems, drive letters represent different storage devices like A: is a floppy drive, C: is a hard disk, etc. In Linux, all storage devices are in the same file system hierarchy. Windows file systems uses backslash (\) to separate directory names, whereas Linux uses forward slash (/) for the same. Every file and directory in a Linux system has permissions and ownership associated with it. File names have suffixes in Windows, whereas in Linux you can use them as conventions. 8 Unix File System The chunk of the disk is divided into blocks (1024- bytes block, or 4096-bytes block, etc.) in multiple of 512 bytes in size. These blocks are organized into four groupings- boot block, superblock, inode blocks and data blocks. FS1 FS2 FS3 Boot block Super block inode list Data blocks … 9 UNIX Users Users 1. Super user 2. Owner 3. Group 4. Others 10 Introduction to Unix Logging on and Logging off. Step 1: telnet <System Address> Step 2: login : ravindra Step 3: password : ****** Login incorrect Step 4: login : ravindra Step 5: password : ****** Step 6: $ Command prompt to execute commands Step 7: $ logout [...]... (the Bourne again shell) was born Like the Korn shell bash was based upon the Bourne shells language and like the Korn shell, it also pinched features from the C shell and other operating systems 12 Unix Shells The Bourne Shell The Bourne shell is the original UNIX shell program It is very widely used You can start the Bourne shell —if it hasn't been set as your default startup shell by typing... at the command prompt This will not spawn a new shell window, but rather will just change your current shell to the Bourne shell The Bourne shell supports conditional branching in the form of if/then/else statements In addition, the Bourne shell supports case statements and loops (for, while, and until) The Bourne shell uses the $ as a prompt 13 Unix Shells The Korn shell The Korn shell is a... C shell is more interactive than the Bourne shell, with additional features that aren't available in older shells The configuration of the C shell is controlled by the rc and the login files 15 Unix Shells The tc shell The tc shell is a more modern variation of the C shell It reads the same configuration files that the C shell uses Tcsh contains command line editing keystrokes that the C shell. .. is missing, and has more "modern" conveniences that the C shell lacks 16 Unix Shells The Bourne-Again shell The Bourne-Again shell is a variation of the Bourne shell It is commonly used in Linux, but is widely available in other standard UNIX distributions The Bourne Again shell is another modification of the Bourne shell, and uses the $ as a prompt To start the Bourne Again shell, type... variation of the Bourne shell It supports everything the Bourne shell does, and adds features not available in the Bourne shell The Korn shell is not a standard offering in UNIX installations If you have the Korn shell, you can run it by typing ksh or /bin/ksh at the shell prompt A public-domain version of the Korn shell, called pdksh The Korn shell was originally written by David Korn and is copyrighted... structure of the Korn shell is very similar to that of the Bourne shell The Korn shell, 14 however, is more interactive Unix Shells The C shell The C shell is a very commonly used shell Its programming structure closely resembles that of the programming language "C." The C shell uses the "%" as a prompt The C shell supports all of the features that the Bourne shell supports, and has a more natural... system call open 20 Commands In Unix Option –k -f Description searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output gives one line introduction to the command (only complete word matches are displayed) 21 Basic commands in Unix $ date The command prints or sets the system date and time $ date –r TestFile... Command line editing N N Y Y Y Underlying Syntax sh csh ksh sh csh 18 Basic commands in Unix $ who The command shows who is logged on $ who am I The command shows who are you $ who \ > am \ >i\ We can type a command over two or more lines A backslash character before the end of the line followed by a new line is taken to be continuation of the line 19 Commands In Unix $ man The command.. .Unix Shells The Bourne shell /bin/sh (written by S R Bourne) Along came the people from UCB and the C -shell /bin/csh was born Into this shell they put several concepts which were new, (the majority of these being job control and aliasing) and managed to produce a shell that was much better for interactive use Eventually David Korn from AT&T had the bright idea to sort out this mess and the... out this mess and the Korn shell /bin/ksh made its appearance The Korn shell became part of System V but had one major problem; unlike the rest of the UNIX shells it wasn't free, you had to pay AT&T for it 11 Unix Shells Also at about this time the GNU project was underway and they decided that they needed a free shell, they also decided that they wanted to make this new shell POSIX compatible, thus . 1 Basic Unix And Basic Shell Scripting 2 Course Objectives The participant will learn Unix Introduction Unix file related commands Unix text manipulation commands Environment. 14 Unix Shells The Korn shell The Korn shell is a much newer variation of the Bourne shell. It supports everything the Bourne shell does, and adds features not available in the Bourne shell. . in older shells. The configuration of the C shell is controlled by the .rc and the .login files. 16 Unix Shells The tc shell The tc shell is a more modern variation of the C shell. It