Lesson Unix shells

14 22 0
Lesson Unix shells

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Lesson Unix shells present the content: types of shells, compact syntax contains some powerful built-in constructs, used on most unix systems to start and configure the operating system...

Unix Shells Unix Shells Types of Shells Unix Overview Types of Shells Why use shells? • Easiest way to string Unix commands together for execution • Ease of reading • Generally portable across Unix Types of Shells Bourne Shell - sh • First shell • Compact syntax • Contains some powerful built-in constructs • Used on most Unix systems to start and configure the operating system Unix Overview Types of Shells C Shell - csh • Similar to C language • Usually used as the default logon shell • Many functions available Types of Shells Korne Shell - ksh • IBM’s AIX flavor of Unix • Considered to be a superset of the Bourne Shell • Extensions over the Bourne Shell exceed the functionality of the C Shell • Not fully portable • ACI uses the Korne Shell as it’s default shell Unix Overview Types of Shells Bourne-again Shell – bash • Default shell for most Linux operating systems • Superset of the Bourne Shell • Uses command line completion to match partly typed program names, filenames, and variable names Unix Shells Profile File Unix Overview Profile File The Profile file: • Is a hidden file -> profile • Executes when you logon • Can be executed after logon -> profile (note the leading dot) • Used to set environment variables and shell options Profile File Unix Overview • It is better to put aliases in a env environment file and configure your profile to execute the env file • You can have multiple environment files depending on the ACI products you want to access Each product will have its own environment variables file Profile File profile example Profile File profile example continued Unix Overview Profile File profile executed after logon Profile File Executing aliases Unix Overview Unix Shells Environment Variables Environment Variables • Environment Variables are used as “shortcuts” for literal replacements • They are used by shells, commands, and programs • Start with a $ Unix Overview Environment Variables • Examples: -> $PATH • Where shell looks for commands -> $CLASSPATH • Where JAVA programs look for definitions -> $ORACLE_HOME • Where Oracle software is installed -> $COBDIR • Where COBOL compiler is installed Unix Shells Managing Processes Unix Overview Managing Processes • In Unix, every process is assigned a • • unique PID Every process is also assigned a job number that is unique to the current session PIDs are used globally across the system to track processes Managing Processes Commands to manage processes • ps -> list your processes • ps –ef -> list all processes • jobs -> list session processes • z -> to suspend a running process • kill -> to terminate a process • Using PID number • Using job number Unix Overview 10 Managing Processes The following example uses the ps and jobs commands I started a man help page search on the ls command I then stopped the man search process using z Managing Processes Example using ps and kill commands PID 25917 PID 306 Job kill 306 kill-9%1 Unix Overview 11 Managing Processes Example using ps, jobs, and kill commands PID 25917 Job kill %1 Managing Processes The kill command is used to send a signal to a process so an option number must be included in the command • Stop (20) -> SIGTSTP -> kill -20 -> z • Kill (9) -> SIGKILL -> kill -9 Unix Overview 12 Managing Processes In Unix you can suspend jobs and move them to the background or move jobs from the background into the foreground using the bg and fg commands and add the job number Unix Shells Using man Pages Unix Overview 13 Using man Pages Unix provides command line help known as the Unix Man Pages • Man Pages are compressed text files • Use Man Pages to find information about commands, programs, utilities, and coding and writing scripts • Use the man command to invoke -> man ls Using man Pages man command Unix Overview 14 ...Types of Shells Why use shells? • Easiest way to string Unix commands together for execution • Ease of reading • Generally portable across Unix Types of Shells Bourne Shell - sh... bg and fg commands and add the job number Unix Shells Using man Pages Unix Overview 13 Using man Pages Unix provides command line help known as the Unix Man Pages • Man Pages are compressed text... software is installed -> $COBDIR • Where COBOL compiler is installed Unix Shells Managing Processes Unix Overview Managing Processes • In Unix, every process is assigned a • • unique PID Every process

Ngày đăng: 06/08/2020, 04:52

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan