Shell & Command
Overview of Shells
 What are Shells
 Shell functions
  interactive textual user interface
  operating environment
  facility for launching and managing commands and programs
  programming language


                             Users


                              Shell


                             Kernel
Types of Shell
Using shells
 View the shell: echo $SHELL
 Change the Shell: /etc/passwd
 Default shell Linux : /bash
 Default shell Unix (SUN/tcsh, AIX/ksh)
Using the Command Line
•Command-line interface present a shell.
•The shell prompt is configured by the /etc/bashrc file
Using the Command Line
Practive 1
• Basic command for Operating:
 - pwd, cd
 - ls
 - touch, mkdir, cp, mv, rm, rmdir
 - cat, less, tail, more
Practive 2
History Program
 List of the commands of history
 HISTSIZE environment variable in either the
  /etc/profile or ~/.profile file.
 Command other: fc
Practive 3
Edit text Program
 Vim
 Vi
 Nano
Practive 4
 Find - search for files in a directory hierarchy (-name or no, ‘’,” ”,
  +n, -n)
            find [-H] [-L] [-P] [path...] [expression]
 Locate - find files by name
            locate [OPTION]... PATTERN...
   The database searched by default: /var/lib/mlocate/mlocate.db
 Grep, egrep, fgrep - print lines matching a pattern
            grep [options] PATTERN [FILE...]
 Sed - stream editor for filtering and transforming text
  sed [OPTION]... {script-only-if-no-other-script} [input-file]...
Practive 5
 Tar - The GNU version of the tar archiving utility (-c, -x, -z, -j)
                    tar <operation> [options]
 gzip (-d), gunzip (-d), zcat (-d) - gzip, gunzip, zcat - compress
  or expand files
 Zip, unzip
 Bzip2 (-z, -d) - a block-sorting file compressor
 Cpio - copy files to and from archives (-i, -o)
Example:       find /tmp | cpio -o > etc.cpio
               cpio -i < /etc.cpio
Managing Processes
 Command or job is executed in a shell.
 Unique process id number or PID.
 Foreground and background
 Create, Monitor, and Kill Processes.
   Ps (tty?, pts?, who, ps), pstree, top, free
                  ps [options]
   Kill (-9,-15), killall: terminal process
   bg, fg
Signal and Kill
 SIGINT 2 Term Interrupt from keyboard
 SIGQUIT 3 Core Quit from keyboard
 SIGILL 4 Core Illegal Instruction
 SIGABRT 6 Core Abort signal from abort(3)
 SIGFPE 8 Core Floating point exception
 SIGKILL 9 Term Kill signal
 SIGSEGV 11 Core Invalid memory reference
 SIGPIPE 13 Term Broken pipe: write to pipe with no readers
 SIGALRM 14 Term Timer signal from alarm(2)
 SIGTERM 15 Term Termination signal
Managing Processes
Modifying Process Priorities
 Assigned priority level on the system.
 The priority numbers exist on a scale from –20 to 19.
  (default priority level is zero)
         nice priority command
Environment Variables and Settings

  Any command that is executed is a process. Processes
   can be initiated by the user,or by the operating system
   itself.
  Each process has an associated environment
  Example
    PATH=/bin
    http_proxy=http_proxy://10.10.10.10:8080
    http_proxy=http_proxy://lab:lab@10.10.10.10:8080
    Export, set, unset
Editing Environment variables
 The init process and the PATH variable
   init is a parent process for all the other processes of the
    system.
   The init path is fixed in the source of the init program
   All the programs that are started from /etc/inittab work in
    the init environment

2.1.using the shell

  • 1.
  • 2.
    Overview of Shells What are Shells  Shell functions  interactive textual user interface  operating environment  facility for launching and managing commands and programs  programming language Users Shell Kernel
  • 3.
  • 4.
    Using shells  Viewthe shell: echo $SHELL  Change the Shell: /etc/passwd  Default shell Linux : /bash  Default shell Unix (SUN/tcsh, AIX/ksh)
  • 5.
    Using the CommandLine •Command-line interface present a shell. •The shell prompt is configured by the /etc/bashrc file
  • 6.
  • 7.
    Practive 1 • Basiccommand for Operating: - pwd, cd - ls - touch, mkdir, cp, mv, rm, rmdir - cat, less, tail, more
  • 8.
    Practive 2 History Program List of the commands of history  HISTSIZE environment variable in either the /etc/profile or ~/.profile file.  Command other: fc
  • 9.
    Practive 3 Edit textProgram  Vim  Vi  Nano
  • 10.
    Practive 4  Find- search for files in a directory hierarchy (-name or no, ‘’,” ”, +n, -n) find [-H] [-L] [-P] [path...] [expression]  Locate - find files by name locate [OPTION]... PATTERN... The database searched by default: /var/lib/mlocate/mlocate.db  Grep, egrep, fgrep - print lines matching a pattern grep [options] PATTERN [FILE...]  Sed - stream editor for filtering and transforming text sed [OPTION]... {script-only-if-no-other-script} [input-file]...
  • 11.
    Practive 5  Tar- The GNU version of the tar archiving utility (-c, -x, -z, -j) tar <operation> [options]  gzip (-d), gunzip (-d), zcat (-d) - gzip, gunzip, zcat - compress or expand files  Zip, unzip  Bzip2 (-z, -d) - a block-sorting file compressor  Cpio - copy files to and from archives (-i, -o) Example: find /tmp | cpio -o > etc.cpio cpio -i < /etc.cpio
  • 12.
    Managing Processes  Commandor job is executed in a shell.  Unique process id number or PID.  Foreground and background  Create, Monitor, and Kill Processes.  Ps (tty?, pts?, who, ps), pstree, top, free ps [options]  Kill (-9,-15), killall: terminal process  bg, fg
  • 13.
    Signal and Kill SIGINT 2 Term Interrupt from keyboard  SIGQUIT 3 Core Quit from keyboard  SIGILL 4 Core Illegal Instruction  SIGABRT 6 Core Abort signal from abort(3)  SIGFPE 8 Core Floating point exception  SIGKILL 9 Term Kill signal  SIGSEGV 11 Core Invalid memory reference  SIGPIPE 13 Term Broken pipe: write to pipe with no readers  SIGALRM 14 Term Timer signal from alarm(2)  SIGTERM 15 Term Termination signal
  • 14.
  • 15.
    Modifying Process Priorities Assigned priority level on the system.  The priority numbers exist on a scale from –20 to 19. (default priority level is zero) nice priority command
  • 16.
    Environment Variables andSettings  Any command that is executed is a process. Processes can be initiated by the user,or by the operating system itself.  Each process has an associated environment  Example  PATH=/bin  http_proxy=http_proxy://10.10.10.10:8080  http_proxy=http_proxy://lab:lab@10.10.10.10:8080  Export, set, unset
  • 17.
    Editing Environment variables The init process and the PATH variable  init is a parent process for all the other processes of the system.  The init path is fixed in the source of the init program  All the programs that are started from /etc/inittab work in the init environment