0% found this document useful (0 votes)
81 views

Unix Programming (18Cs56) by G B Janardhana Swamy Assistant Professor Dept. of CSE, SCEM, Mangaluru

Unix programming provides many job opportunities in roles like UNIX Administrator, UNIX Systems Engineer, and Linux Engineer. The document discusses the UNIX/Linux career path and increasing job demand. It also summarizes some key applications of UNIX like powering internet services, databases, mobile devices, and automotive electronics. The document outlines topics to be discussed like the UNIX architecture, features, commands, file types, and variables like HOME and PATH.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Unix Programming (18Cs56) by G B Janardhana Swamy Assistant Professor Dept. of CSE, SCEM, Mangaluru

Unix programming provides many job opportunities in roles like UNIX Administrator, UNIX Systems Engineer, and Linux Engineer. The document discusses the UNIX/Linux career path and increasing job demand. It also summarizes some key applications of UNIX like powering internet services, databases, mobile devices, and automotive electronics. The document outlines topics to be discussed like the UNIX architecture, features, commands, file types, and variables like HOME and PATH.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

UNIX PROGRAMMING(18CS56)

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.

• The big players, such as Oracle (company) and SAP

Applications (company), run on Unix.

• Unix operating systems (and Unix-like variants) run on


a wide variety of Digital architectures, and are
commonly used on web servers, mainframes, and
supercomputers.

• Mobile devices. Android, an OS based on the Linux


kernel, is the most popular mobile OS in the world,
powering phones.

• Databases. The largest, fastest databases in the world


run on Linux or other Unix platforms.

• Automotive electronics. Navigation, entertainment


and security systems are increasingly based on
embedded Linux.
PROGRAMMING
(18CS56)
Textbook:
1.Sumitabha Das., Unix Concepts and Applications., 4thEdition., Tata McGraw Hill
(Chapter 1,2 ,3,4,5,6,8,13,14)
2. W. Richard Stevens: Advanced Programming in the UNIX Environment, 2nd
Edition, Pearson Education, 2005 (Chapter 3,7,8,10,13,15)
3. Unix System Programming Using C++ - Terrence Chan, PHI, 1999. (Chapter 7,8,9,10)

Reference book:

1.M.G. Venkatesh Murthy: UNIX & Shell Programming, Pearson Education.


2. Richard Blum, Christine Bresnahan: Linux Command Line and Shell Scripting Bible,
2ndEdition, Wiley,2014.
Topics to Discuss
• Timeline-Introduction to Unix

• To Know the Unix Architecture.

• To remember Features of Unix.

• To understand command structure.

• To execute and know about internal and external commands.

• Study on how to become super user

• To study different types of files and understand parent child relationship.

• 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)

• In 1973- Ken Thompson teamed up with Dennis


Ritchie ,rewrote the UNIX core (Kernel) in C, V
edition.

• In 1978-Two divergent lines of UNIX development


(VII edition). SVR4 (Release 4) and BSD.

• Beyond 1978-The Berkeley version of UNIX is known


as BSD, Berkeley Software Distribution by Bill Joy and
Chuck Haley.

• From BSD came the VI editor, C shell, virtual memory,


Send mail, and support for TCP/IP
Versions
Introduction
• Unix is an Operating System which is truly the
base of all Operating Systems like Ubuntu, Solaris,
POSIX, etc. It was developed in the 1970s by Ken
Thompson, Dennis Ritchie, and others in the AT&T
Laboratories.

Dennis Ritchie Ken Thomson


Architecture
Unix OS has three major
components:

• The Kernel

• The Shell

• The File and Process.


Features

• 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.

$type ls -press enter date show current date and time

output: /bin/ls. passwd let’s you change your password

cal shows a calendar of the current


month
Internal and External Commands

INTERNAL EXTERNAL

• built into the shell • Not built into the shell

• The shell doesn't start a separate • These are executables present in a


process to run internal commands separate file

• Doesn't Require PATH • Require PATH

• 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.

• filename vivek.txt ,Vivek.txt &


VIVEK.txt all are three different
files.
Basic File Types

Hidden Files(.) • Ordinary Files − An ordinary file is a file on the


system that contains data, text, or program
An invisible file is one whose first instructions.
character is the dot or period
character (.). • Directories − Contains names and location of
UNIX programs (including the other files. For users familiar with Windows or Mac
shell) use most of these files to OS, Unix directories are equivalent to folders.
store configuration information.
• Special Files − Some special files provide access
to hardware such as hard drives, CD-ROM drives,
For example: $ls -a
.profile
modems, and Ethernet adapters.
Organization of files(Parent-Child
Relationship)
• The Unix file system is
essentially composed
of files
and directories.
Directories are
special files that may
contain other files.

• All files (except one)


share a common
parental link, the top-
most file (i.e. /)
being the
exception.
The HOME & PATH Variable
• HOME • PATH

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.

Directory and $mkdir- Creating the $cp- The cp command is used

File related directory files to copy a file or group of files

Commands $rmdir-
Removing directories
$wc- Counting the number
of lines,
words and characters.

$od- displaying non-printable


characters
References
• Unix shell programtraining-120520125523-phpapp02.pdf

• https://www.quora.com/What-is-the-application-of-Unix-and-
Linux-And-where-can-it-be-used.

• Sumitabha Das., Unix Concepts and Applications., 4thEdition.,


Tata McGraw Hill.

• M.G. Venkatesh Murthy: UNIX & Shell Programming, Pearson


Education.

• https://www.careerride.com/Linux-internal-external-
commands.aspx.

• https://www.geeksforgeeks.org/absolute-relative-pathnames.

You might also like