Practical 12
Practical 12
Shell
A shell is a special user program that provides an interface for the user
to use operating system services. Shell accepts human-readable commands
from users and converts them into something which the kernel can understand.
It is a command language interpreter that executes commands read from input
devices such as keyboards or from files. The shell gets started when the user
logs in or starts the terminal.
Types of Shell
The Bourne shell was the first default shell on Linux systems, released in
1979. The shell program name is sh, and the traditional location is /bin/sh. The
prompt switches to $, while the root prompt is #.
The bourne shell is also known as ‘sh’ in short. Bourne is both a scripting
language and a command-line interface.
2. C Shell (csh)
The C shell (csh) is a Linux shell from the late 1970s whose main
objective was to improve interactive use and power the C language. Since the
Linux kernel is written in C, the shell aims to provide stylistic consistency
across the system.
The path to the C shell executable is /bin/csh. The prompt uses % for
regular users and # for the root user.
4. KornShell (ksh)
The KornShell (ksh) is a Unix shell and language based on the Bourne
shell (sh) developed in the early 1980s. The location is in /bin/ksh or /bin/ksh93,
while the prompt is the same as the Bourne shell ($ for a user and # for root).
The Bourne Again Shell is a Unix shell and command language created
as an extension of the Bourne shell (sh) in 1989. The shell program is the
default login shell for many Linux distributions..
The shell name shortens to bash, and the location is /bin/bash. Like the
Bourne shell, the bash prompt is $ for a regular user and # for root.
6. Z Shell (zsh)
The Z shell (zsh) is a Unix shell created as an extension for the Bourne
shell in the early 1990s. The feature-rich shell borrows ideas from ksh and tcsh
to create a well-built and usable alternative.
The Friendly Interactive Shell (fish) is a Unix shell released in the mid-
2000s with a focus on usability. The feature-rich shell does not require
additional configuration, which makes it user-friendly from the start.
The 'clear' command clears out all the previous commands and outputs from
terminal display.
pwd
The 'pwd' command stands for 'print working directory'. It doesn't accept any
option or argument and displays the detail of current working directory.
type
Linux 'type' command tell us whether a command given to the shell is a built-in
or external command.
Syntax:
type <command>
Example:
type pwd
type cd
type man
type cat
type file
which
Syntax:
Example:
which ls pwd rmdir mkdir cp cd file man
mkdir
Used to create a directory if not already exist. It accepts the directory name as
an input parameter.