Unix Programming (18Cs56) by G B Janardhana Swamy Assistant Professor Dept. of CSE, SCEM, Mangaluru
Unix Programming (18Cs56) by G B Janardhana Swamy Assistant Professor Dept. of CSE, SCEM, Mangaluru
By
G B Janardhana Swamy
Assistant Professor
Dept. of CSE, SCEM, Mangaluru.
Job Opportunities
Job Description
Job Roles
• Expertise in Linux System
• UNIX Administrator / Engineer
Administration, Operating System, and
• UNIX Systems Engineer Hardware troubleshooting, configure
and install the equipment / able to
• UNIX Admin Engineer repair, reconfigure and install several
servers/clusters, able to manage the
• Linux Engineer different cases to provide resolution,
refresh/copy the databases and its
• UNIX Expert schemas using different Unix
• Senior UNIX Admin commands & developing UNIX scripts
Career Path
• The different career roles and paths are present in the UNIX Engineering stream and
also the average salaries are very high in the UNIX career path.
• The requirements for different roles in the area of UNIX / Linux in the USA are
increasing enormously every day as the existing servers or systems maintenance work
is getting more and more nowadays.
• Unix is the backbone of Internet services and all the
various other services such as , Facebook and Google
,chat and Netflix.
Reference book:
• To understand HOME & PATH variable and Absolute and Relative path names
• To execute directory related commands - pwd, cd, mkdir, rmdir and File relat
commands- cat, mv, rm, cp, wc and od
• In 1960- Multics (Multiplexed Operating and
Computing System), GE, MIT and Bell Laboratories
Timeline
• In 1969-first version of UNIX called UNICS (Uni-
plexed Information and Computing System)
• The Kernel
• The Shell
• Multiuser
• Multitasking
• Portability
• Networking
Features(Co
nt..)
• Organized file system
• Utilities
• Device independence
• Security
Command Structure
command [options] [arguments]
• Command names must be between 2 and 9 characters in length.
• Commands are case sensitive, for instance command and Command
• All options are preceded by a hyphen (-). ex: -a, -f, -x, -l, -r.
• Where an arguments indicates on what the command is to perform its
action, usually a file or series of files.
For example:
$pwd -Command with no options and Arguments
$wc cse.txt -Command with Arguments but no options
$ls -l -Command with options but no Arguments
$ls -l cse.txt -Command with options and Arguments
Command Output/Result
echo outputs the strings it is being
passed as arguments
Execution of
printf formats and prints data
basic commands
ls lists your files
Locating files: location of an
executable program using who Tells you who's logged on
type command.
INTERNAL EXTERNAL
• Ex: echo, cd, pwd & printf • Ex: cat, ls, mv & mkdir
Combining • UNIX allows you to specify more
than one command in the single
Commands command line. Each command
has to be separated from the
other by a; (semicolon).
For example:
wc sample.txt ; ls
sample.txt>newfile
>indicates redirecting you to
another file
How to become a Superuser
A Superuser is a user with unrestricted access to all files and commands.
There are two ways to become a superuser
1.login into console directly as a root
2. execute the command su after logging under another username
• $/bin/su –
• Password:
• #-indicate that the user has now become the superuser
• Once the su command is entered, the system prompts for the superuser’s
password.
Naming
Files
• Consist of up to 255 characters,
any ASCII except / and NULL.
When you log onto the system, A command runs in UNIX by executing a disk
UNIX automatically places you in a file. When you specify a command like date,
directory called the home directory. The the system will locate the associated file
shell variable HOME indicates the home from a list of directories specified in the
directory of the user. PATH variable and then executes it. The
PATH variable normally includes the current
E.g., directory also
$ echo $HOME • echo $PATH
/home/kumar • $PATH= “set your own path”
• echo $PATH
Relative and absolute pathnames
A B S O LU T E R E L AT I V E
• Complete path from start of actual • . and .. indications for the current
filesystem from / directory. and the parent directory.
Directory Related File Related
$pwd- Finding the present $cat- Create, displaying and
working directory. concatenating files.
$cd- Changing the directory. $mv-Moving or renaming files
and directories.
Commands $rmdir-
Removing directories
$wc- Counting the number
of lines,
words and characters.
• https://www.quora.com/What-is-the-application-of-Unix-and-
Linux-And-where-can-it-be-used.
• https://www.careerride.com/Linux-internal-external-
commands.aspx.
• https://www.geeksforgeeks.org/absolute-relative-pathnames.