Professional Documents
Culture Documents
Unix Concepts
Unix Concepts
Unix Concepts
Unix shell
• Shell is command-line interpreter for unix.
• It gathers input commands from user and executes programs based on inputs.
• Most popular shell are:
• csh
• Bash
• Shell script is a collection of unix commands that are written in a file, and widely for automation in professional world.
File and Directories
• Unix allow “files” and “directories” creation.
• A directory is like a folder, it contains pieces of paper, or files.
• A large folder can even hold other folders-directories can be inside directories.
• Each file each directory has a name eg: lets create file test in home.
• The short name for a file is test,
• The full name would be /home/temporary/test.
• The full name is usually called the path.
Files and Directories
• For example, here is how /home/temporary/test is read as:
/home/temporary/test
This initial slash indicates the root directory. This signifies the
directory called home. It is inside the root directory.
• Here, the first column represents different access modes, i.e., the permission associated with file or a directory.
• The permissions are broken into groups of threes, and each position in the group denotes a specific permission, in this
order: read(r), write (w), execute (x)
• The first three characters (2-4) represent the permissions for the file’s owner. For example, -rwxr-xr– represents that the
owner has read(r), write(w), execute(x) permission
• The second group of three characters (5-7) consists of the permissions for the group to which the file belongs. For
example, -rwxr-xr– represents that the group has read read(r) and execute(x) permission, but no write permission.
• The last group of three characters (8-10) represents the permissions for everyone else. For example –rwxr-xr– represents
that there is Read(r) only permission.
Unix commands- permissions chmod
• Chmod
• Change mode
Shortcuts
PIPE and redirecting input and output
• Pipe
• You can connect two commands together so that the output
from one program becomes the input of the next program. Two
or more commands connected in this way from a pipe.
• To make a pipe, put a vertical bar (|) on the command line
between two commands.
• Eg:# cat hello.txt | sort | uniq
• Creates three processes (coreesponding to cat, sort and
uniq) which execute concurrently. As they execute, the
output of the whole process is on to the sort process
which inturn passed on to the uniq process, uniq displays
its output on the screen (a sorted list of users with
duplicate lines removed)
• Semicolon ; is used to execute many commands sequentiallay
• Echo “siliconus ” ; cd /home/temporary ; gvi test
• The output from programs is usually written
to the screen and called as standard output
• The input of a program is usually comes from
the keyboard and called as standard input.
Processes associated with the current shell