Escolar Documentos
Profissional Documentos
Cultura Documentos
Structure
2.0 Introduction
2.1 Objlcctives
2.2 Getting Started
2.2.1 User Names And Groups
2.2.2 Logging In
2.2.3 Correcling Typing Mistakes
2.2.4 Format of UNIX Commands
2.2.51 Changlng Your Password
2.2.6 Characters with Special Meaning
2.2.7 UNTIX Documentation
2.3 Files and Directories
2.3.1 Current Directory
23.2 Looking At The Directory Contents
2.3.3 Absolute and Relative Pathnames
2.3.4 Some UNIX Directories and Files
2.4 Summary
2.5 Model Answers
2.0 INTRODUCTION
This unit introduces you to UNIX System V Release 3.2 (hereinafter referred to as UNIX)
and tells you how to start working on your UNIX computer. A few elementary commands are
all that ydu need to get the feel of what working in a UNIX environment is like. The auempt
is to let you sce enough UNIX features to allow you to walk upto a computer running UNIX
login, although in this block we will not touch upon the design of UNIX. This unit is
oriented tbwards showing you the richness of the system and making you comfortable
working in the environment. After all, apart from the academic and theoretical aspects,
UNIX is i rich, open (if a little unfriendly and unforgiving) and otherwise convenient
operating system which gives you a bewildering array of tools to help you be productive.
2.1 OBJECTIVES
After going through this unit you shall be able :
To learn how to start a login session undcr UNIX.
To learn some basic concepts like the hierarchical directory structure.
To learn about the various types of files under UNIX.
To learn how to close a login session.
We will now learn how to start using a UNIX computer. This unit will talk about the basic
steps involved in sig&ng on to a system running UNIX and also what you can do cnce ycu
have gained ingress. But remember thai you cannot learn UNIX merely by rcading this unlt
or even this block. That might at best allow you some familiarity with ~e tcrminology uscd
and might tell you something about its organisation. You might even come to know
something about its features and the tools available undcr it. But you will not bc ablc to work
on a UNI# computer or feel comfortable in a UNIX environment, much less be productive
in it. Nor will you be able to appreciate the power and beauty of UNIX. The only way to
learn UNIX is by working on a real UNIX machine. This unit, this block and othcr
supplemehtary reading material, together with the UNIX documentation, {ill be a valuablc
aid in your voyage of discovery. So you must gain access to a terminal connected to a
working UNIX machine and Q out whatcver you fcel like. Do no1 be afraid of exploring or
making wistakcs. Whenever you lcam about a command or any othcr fcature, do not hesiutc
to try out 011 its variations. Do riot confine yourself to only what is men~ioncdhcrc. This
block is of ncccssity vcry bricf and can only scrvc as an introduction. Usc any othcr malcrial
to which you havc acccss and cxpcrim~~nt lo your hcan's conlcnl. You will lcarn as much
from your mistakcs and from sccing uncxpcclcd oulcomcs as from things you do by Lhc
book.
Sonlc u\cr riamcs are rcscrvcd by UNlX for ils use, for cxamplc bin and uucp. So you cannot
usc lhcsc namcs for yourself. Thcrc is also a spccial kind of uscr on cvcry n T I Xsyslcm who
has all possiblc acccss rights on thc syslcm. This uscr is callcd thc supcr uscr, lhc syslcm
administrator or simply rool bccausc that is lhc uscr namc conventionally allollcd LO him. For
adni~nisualivcconvcnicncc largc sysslcms can havc more Lhan one supcr uscr account. The
supcr uscr is thc onc who can crcalc ncw uscr accounts, shutdown thc syslcm and pcrfonn
oihcr mainlcnancc tasks.
You might bc wondcring why cvcrybody cannot acccss thc computer as root. The rcason is
that whcn you are granlcd acccss lo a compulcr syslcm you arc assigncd a uscr name as wcll
as a password. Yowcan scl your password to whatcvcr you want subjccl LO ccrtain
consu;~inls..Soyou cannol entcr lhc compulcr as rool unlcss you know the root password.
The root password is zealously prolcclcd on any wcll maintained installation as public
knowledge of this password would compromisc thc sccurity of Ulc installation.
Whilc root can acccss all uscr filcs and ovcrride any syslc~~i
protection mcant for mere
mortals, nobody can figurc out what your password is. Howcvcr root can change or rcmove
your password.
2. Can lhcre be morc than onc account wid1 thc samc name on a UNIX system?
P
: 3. Can morc than onc uscr accounl have lhc samc password?
2.2.2 Logging in
ki)u will now learn how to gain acccss Lo a UNIX systcln so that you can usc its facililics.
This pl~occssis called logging in to thc computer. To bc able to login LO a machine you must
l1:lvc a valid uscr accouni on it and you must know your passworcl. Your account woi~ltiIlavc
l x c n crca~ctifar you b y ll~esysicln adniinislra~orwhcn you wcrc allol~cdio u ~ thc
c
UNIX Opcratinz ~ y \ t r m - I computer. .4t that Lime you would also have been told your first password. Whcn you sce
your terminal it would be displaying a message like
IGNOU UNIX computer
login:
The actual message on the first line depends on the installation. This could even be absent,
The message does not affect anything else you do in any way.
You should now type in your user name and press the RETURN key. In most cases you havc
to press the return key for the computer to regis~erwhat you have typed. This key is
sometimes labelled as ENTER. You will find that as you type on the termind scren you will
be able to see whatevcr you have typcd. This is bccause UNIX usually echoes whatevcr yoi~
type on the terminal. So your screen should now look like this
IGNOU UNIX compu!?r
login: k~marr
Passwo~d:
You must type in yow user zarne, also called the login name, eracily as allocated by the
super user. This is becausc UNTS is case sensitive, that is, it disringuishcs between lowcr
case and uppcr case letters. In this respect it differs f r ~ moperxing systems like VMS. So be
careful of small and capital ?cttcrswhile working on UNIX.
When UNIX asks you for pour- pasiivord, key it in carcfufly. Notice iiut your pass.n.oid is liet
echoed as you type..In fact ihr, c3rmr does not move at all. This i s to prevcnt somcbody from
reading your password over you si.,oil!dcr, as that would cr.;lbEz Lj-ia! person 1.0 n:isqacradc:
you by logging into the cornpszr iri your rlame and using i:.
UNIX now checks whether you x e 2 ..~!jli;j aser and wkcit;.-r ;~ : . 3e:i:r:rccJ ;~I:L':'!.
- -
~ c a: pne.ss.-zc sayi;;!:
password. If there is any mist&<::la:-:
Login incorrect
login:
This means you can try to login agaii:. ;71:' car. hc olh -::cn<or,s ;i.!:y you might not
to login even though you are a valid uscr ar,c did not make any typing mistakes. The
:-. - '2
On some UNIX installations there is a limit on the number of attempts, say five, you can UNIX Getting Stnrtod I
make at logging in. The action taken depends on the installation but can be alerting the
system administrator or deactivating the terminal, perhaps for a short time only. So you
should be careful not to make too many typing mistakes. In particular be careful not to forget
or mistype your password and avoid passwords with certain characters like #.
i
i '?
., . '-,., i:i : i i i ~ i g:it[ i r < i i i i i i l \iiiir:h dixs no! exist on your systzm (confirm this from
i'r.. :k)r!!_iir~g
t . sysccri-i : : : ! ~ i i ~ ~ l i t i a r1.!; ; ri:i;,.:,:~ . rii~; dil'!c~.c:ir:ein the e~m;!u~cr'sresponse from that
,?...
,.
i ~ :?jc
t i;i!,g c:<c<i:~<c, \i<i::,: : is so'!
(jL:.yu*,~){ f ~ i x ~ b :l:is
i
, .-. .
4. i - ~ : ' k aii!i
i ~ ' i i yt l jaii
~ r ~lbigial w liigiri wc'n ri~oughyou did nothing wrong vvhile wing to
. .
it. : ,,;, ' L'r.i .;rcL ( i , icasl fi,.e, y ~s ~:. . ~ , ~ ! : l s ~
- -
and then rdtype 'a' and '1' correctly. You can then press the ENTER key to run the cal
command.
-The,line kill character tells UNIX to kill the line, that is, to ignore everything on the line.
You do noti get the prompt after typing this character unless you press the RETURN key. The
line kill character is usually @ but can be changed to something else.
There is a command called stty which enables you to see what the erase and line kill
character ate. It also allows you to change them if you wish. The command allows you to
examine and alter many other terminal settings as well, but for the moment we will not
consider anything else other than erase and line kill. Just type in
% stty
and observe the output. It will, among other things, say something like
erase AH kill @
This mtans that your efise character is AH and your line kill character is @.
Suppose your want to change your kill character to AX. %u can do this by running the
command
% stty Gill AX
Now typing I@ has no effect on the command you type other than putting an @ as part of
your command. It no longer kills your command line. You can similarly set your erase
character to k by saying
% stty erase #
$ stty ewse 1
and now try arming the cal command. You yill not bgable to convey cal to the computer
because '1' is taken as an instruction to erase the previous character. It is for this reason that
the erase and line kill characters are usually not set to any characters you use commonly as
part of commands. Thus it is better not to set them to letters, digits or hyphens or even other
commonly us$d special characters.
However if ydu insist on using '1' as your erase character you can still run the cal command ,
by typing
-
UNIX Gdtlng Started I
The 'Y is called the escape character because it turns off any special meaning attached by the
system to the character immediately after i t This act is called escaping the character. If the
character immediately after 1'has no special meaning then the T has no effect. So you can
type
*
CIi(.r,k Your Progress 3
1. ib'llat arc the ckaractcrs you need to use to corrcct typing mistakes while logging in? Do
rhcsc dcpc~idon your crase or kill chxactcrs in your last login session?
.....................................................................................................................
! h i i ~ u) ~ill you enter a 1'as pxt of your command:'
3. 0:~l :,(!I: do aw:iy with the crssc or line kill characters altogether (that is, n o character
j
11:):; ~ h cc:ii~i:i
: af crnse or iine kill)'?
.............. '............*.............................r.......................r....................................
4. Can you set hog1 crnsc and kiil to the s:me chwactcr?
5. What f:;~ppens if you sct vow crasc character to T?I-Tow do you cscape special
i.f;xac. icrs' now:)
'which displays the current system date and time. You will realise that the computer has no
Way of knowing what the current date and time really are, so what it can tell you is only what
it thinks is the current date and time. This can be set by the system administrator to almost
anything but in most installations, especially those that are networked with other computers,
care is taken to see that the date is set correctly. The date in UNIX means date and time, so
the outputaf the command is something like
Wed Jun 15 13:44:39 IST 1994
Notice that the time zone is p@t of the output. This is significant when you are on a network
spanning time zones.
Another simple one word command is
% who
2. I;:e the calcndar for the year 1752 and look at it.'Is anything the matter?
3. I:~ndout how lo set the system date. Why do you think only the super use is allowed to
(10 this?
4. :i;udy he who command and use it to find the date the machine was started up, and also
Ill.?w many uscrs are currently using your system.
-
2.2.5 Changing your Password
You saw earlier that your password was the only way of preventing somebody else from
using your account on the system. Without it anybody who knew your login name could
,walk up to the machine and start using your account. This would be really serious in the case
of the super user or root.
When you are first given your account you are told what your password is. On some
installations your account is set up without a password and yol; art: asked to choose one for
yoursclf the first time you login. This can be done with the co~iinand
% passwd
where the name of the user whose password is to be changed forms the argument to the
passwd commhnd. The rest of the behaviour of the command is just as before. You will now
realise that you can change the password of any user, including your o w n , ~ l yif you know
his current password. On your system you might simply get the following message if you try
to change som~ebodyelse's password
Permission denied.
How then does root have the power to change your password? Ah! When the user executing
the passwd command is the super user, UNIX does not ask it to supply the old password.
This is haw the super user can change your password to anything without knowing what it is
currently.
2. Can a fricnd (not the super user) hclp ~f you have forgotten your password?
...........
...................................................................................................................... A
Since your password is the only way of protecting your account, you must take care to
choose passwords well, that is, choose one whictt cannot be easily guessed. As a general rule
do not write ddwn your password anywhere and let it be locked up in your head. Do not
choose the names of members of your family or close friends or your dog. In fact it is best to
avoid all proper names and all the words in the dictionary. Let your password have a few
special characters in it (not those which have anything to do with terminal settings). Some
UNIX implementations enforce rules like these whcn you set your password.
% exit
3. (''an you transfer the functions of AS, AQand ADto some other characters?
commands, and even those only briefly. We will not even be able ta consider all the options
available with many of the commands that we do discuss. The u111yway for you to master
them will be by consultiq the documentation.
If any documentation is available on-line at your installation, you can look up the manual
L entry for a command by using the man command. For example, to learn more about the who
command than what we have talked of, say
% man who
You can similarly learn more about the date, cal or any other command. So to learn more
about the man command itself, say
% man man,
If the documentation is not on-line you will have to use the printed UNIX manuals.
UNlX Operating System-I
% pwd
This means that your current directory is called kumarr and is located under the directory usr,
which is in turn locatzd under the root directory. Of course the actual home directory you are
allotted wili depcni! on your installation. By the way pwd is one of thc fcw UNIX commands
which do nct iake any arguments or options.
The otiipilt that pwd displays is called the full pathname of your currcnt working directory.
Th:s is also known as the complete or absolute pathname, that is, thc pathname starting from
root. You can refer to your directory by just saying kumarr. But this is not unambiguous
because there can be another directory called kumarr under some other directory as well. But
no two directories or files on the same UNIX machine can have the same complete or full
pathname. The various components of the path are separated from one another by slashes
(*/'I.
We have not yet talked of what a valid filcname can be. Actually in UNIX there are no
restrictions and ii filename can have any characters upto a maximum of 14. The same rules
apply to directoties as well. In some UNIX implementationsfilenames.can be of any
arbitrary length. In practice it is best to avoid certain characters in filenames because they
have special meaning to the shcll.
UNIX Getting Started I
Check Your Progress 8
1. What would happen if your home directory did not exist and you tried to login?
This gives you a listing of all files in the current directory. If you have just been alloued your
account and are logging in for the first time, you will be in your home directory and that
directory will be empty, that is, there will be no files in it.
1s has several options and it will take you some experimentatiwo understand them all. The
first option we look at is
% Is -a
This is your first taste of UNIX options, so look at the command line carefully. The
command 1s is followed by at least one space after which the hyphen or minus sign
introduces the option letter. The -a option tells UNIX to list all files including those that are
'hidden'. Hidden files are those which start with a '.' character. Unless the -a option is used,
1s never lists such files in its output. The output of 1s is always sorted in some order, the
default order being alphabetical. This sort order can be altered by other options to Is which
we will take up later. This is why the file (actually a directory) '.' is listed before '..' in the
output.
The '.' refers to the current directory and '..' to its parent. These are pronounced dot and dot
'.'
dot respectively. In this case refers to the /usr/kumarr and '..' to Iusr. The directory TI' or
root is its own parent. This output is of course not very interesting because your home
directory is devoid of files and you do not yet know how to create any. So let us look at some
other directory. You can get the listing of any directory by supplying its name as an argument
to 1s. Thus to look at the directory listing of the root directory use the command
% Is/
aardvark
bin
dev
etc
lib
lost+found
ID UnP
UST
We must caution you that it is very un!ikely thnt ycu will see the same listing as shown here.
It is self evident that the listing will depend completely on the machine you are working on.
However there are some files that will surely exist on the root directory of a working
, installation. The directories from bin to usr are such files.
b
I As you have seen the 1s command lists one file per line of output. TOsee several names per
line you can use
t
% Is -x
aardvark bin dev etc lib I ost+found
1
I
tmP usr
I Now the output is sorted from left to right on each line. Another variation is the -Coption
UNIX Operating System-I which sorts down each column
% 1s -C
aardvark dev lib unp usr
bin etc lost+found
You might havc found your output to be in one of these forms the first time itself. This would
have been because your system was configured to make the -x or -C option the default
option for 1s.
From the outputs so far you can get no indication of whether the files shown are ordinary
files or directories. For this you can use the -p option, which appends a '/' to every filename
which is a directory. The '/' is not part of the name, so do not get confused. For example
% 1s *Cp/
akudvmk dev/ lib/. tmp/ usr/
bid etc/ lost+foundl
Anather such Option is -F which also appends a '*' to every filename which is an executable
file, that is, a crommand. Try it out and see whether the result differs from the -p option.
If you have a feally large directory you might want to use an option of Is which gives a very
compact output
% 1s -m/
aardvark, bin, dev, etc, lib, lost+found, unp, usr
This gives yoli the filenames separated by commas.
You can see from the above that the contents of the root directory consist of both directories
and ordinary files. The directories here, or anywhere else, can themselves contain
subdirectories, To see the contents of /usr, you can say
% 1s -xp /usr
bin/ khanz/ kumarrl lib/ unp/
On most systeins you will see the names of user accounts in this directory. The -p or -F
options will show you that they are directories. You must have deduced that you are seeing
the home diretories of the users. You can also see your own home directory here. But wait!
When you logged in and checked the name with
% pwd
you found your home directory specified differently. Why is this so? We have seen in the last
section that the pwd command tells us the full, complete or absolute pathname of the current
working directory. When we look at the contents of /usr, kumarr is merely one of the
directories under it, and is shown as such. To get the complete pathname we must specify the
preceding portian which is /usr. Thus the full or complete pathname is /usr/kumarr.
It will now be easy for you to realise that the bin you saw listed as one of the contents of the
root directory, that is, '/', is different from the bin listed under usr. The former has the full
pathname bin, whereaq the complete pathname of the latter is /usr/bin. You can now look at
the contents of the othcr directories and try specifying their complete pathnames. Yoqncan
also try lookirlg at their contents by providing relative pathnames. We will look at complete
and relative pqhnames again in the next section. You would do well to understand
pathnames, relative and absolute, thoroughly as that will be necessary in navigating around
the directory tree.
But let us no* get back to our friend the 1s command. One of the most useful and often used
options is -1, qhich gives the so called long listing of the directories asked for
% 1s -1 /
-rw$r-xr-x 1 root root 1298 May 14 09:26 aardvark
drwxlr-xr-x 2 bin bin 1248 Jan 01 1970 bin
Now this is a complicated looking output, so let us try and understand the meaning of this
listing. The fiist column of the output tells you whether the file is a directory or not. A '-'
means that it is an ordinary file while a directory has a 'd' in that position. So you now know
anothcr way of telling whcher a file is a directory, apart corn h e -p anb -F oprions you have -
UNIX Ccttlng Startcd I
already lookcd at. Thc o~hcr9 columns in the first field tell you about he permissions on that
file. We will look at hese in detail in section 2.4.6.
The ncxt Gcld in the output is a number indicating the number of links to the file. For a file
this shows h e number of names it has. In UNIX the same physical data may have several
names, although it must have at least one. Each narne is a link to the file. Usually ordinary
files have only one link, but if there are more it does not mean that there are that many copies
of h e data in h e file. There is only one physical copy of the data which can be referenced
using any of its names. In the case of directories the number of links tells you about the
number of subdirectories it has.
The third field of the output shows the owner of the file. Root and bin are names reserved by
UNIX for its use as we have seen earlier. In some cases you might s q a number like 207
instead of h e user name.
The next field is the group name and in certain situations can be a number in the display. The
user is a part of the group shown here.
The fifh field is the size of the file in bytes. You alrcady know that the size of a file in UNIX
has a precise meaning which is unrelated to the amount of data in it. However, do not be
alarmcd because in most cases the intuitive meaning of size does hold good and the figures
you see usually do represent h e number of bytes of data in the file in question.
The ncxt item of information is the date the file was last modified, and in the end the narne of
the filc is shown.
You now know how to find out many useful things about the file. You should now look at the
dirdctory long listing of h e various system and other directories on your machine. In the
coursc of this when you look at /bin you will see many familiar names. For instance, who,
pwd and 1s itself will be found in the /bin directory. Actually /bin is where many of the
binaries or executables of the commands are to be found. There are other commands located
under /usr/bin and /etc as well.
We will now briefly look at three other options to the Is command. When a directory is given
as an argument to 1s you get to see the contents of the directory. But suppose you want to
check the permissions on a directory, say /usr/kumarr. If yoi~try
.
you will see nothing because 1s tries to list the contcntq of the directory and at prcscnt there is
nothing in your home directory. To see the desired output you could say
whereupon kumarr would be one of the entries. But this is awkward. me answer to this is the
-d option
which lish hsr/kumarr as a directory and shows all the information about it,
You have seen that ordinarily subdirectories are shown only as single entries and any files
w
inside thcm arc not shown. To look at the contents of a directory and recursively of all
subdirectories within it, use -R
% 1s -R /usr
l3
I
will show h e contents of /usr and also rccursively of every subdirectory inside it, down to
ordinary files. Thus using
k
i you car1 see every file and directory on your system.
Anc)Ll:t:r option is the reverse option. The -r option rcverses the sort-orderof files displayed
by Is. Ytiu can try this with any option
Operating
tmP
lost+found
lib
dev
bin
aardvark .
So far you have given only directories as arguments to Is, but you can give it an ordinary file
as well. It theh lists only that file if it exists. Moreover you can give any number of files or
direciories as arguments t~ 1s and it will list whichever ones exist.
If you feel out of breath after looking at these options, there are a few more we have not
looked at. You are encouraged to look up the documentation for 1s and experiment with
them. Many UNIX commands have zillions of option* getting used to them all requires
time and effort. But you will find that you soon get to know the options you use often. It is
probably best, when learning a new command, to comntrate on a few useful looking
options onty. As you use them frequently you will get to know them well. Then you can
spend some time deepening your knowledge of thecommand by trying out the other options.
Most beginners get overwhelmed by the large number ofsptions and do not know where to
start or when to stop. You will have to work out a method which suits you. Maybe you are
the type who likes to learn everything about a command at one go. But many people.
including the author, find that building on a solid foundation of already know options is
easiest.
C
..................
r..............................................................................:....................
2. If your system has the -x or -C option set by default how can you get the s m d x d Is
listing?
3. Your terminal most likely has an escape sequence to clear the screen. Find out what the
sequence is and create a file whose name,contains the sequence. Thus if the secluer~ceis
ESCL2.J. youran create a file callid 7aESC['tJbc. Now use 1s to try and look at the
listing of your directory. What do you see? How can you Iook at the listing'!
4. If you see two files abcd and abcd in a dircctory !istir~g,that is, ~tvoiiles wilh apparently
the sarrlc name, what would you conclude? How would ).ou confirm what you sunnise?
. On a system which allows filenames of arbitrary length, would you rather store &ta in WIX - Getting Started I
the filename rather than in the file itself?
I
I I I 1
bin dev etc lib W
\ I 1
lib fmP
I
1
Of course the exact layout of the directory hierarchy on your machine is likely to be
diierent. We will soon be looking at some of the main directories and files on a UNIX
system. For the moment though, just concentrate on learning how to move around. You
already understand what is meant by the current directory. 'lhis is the directory in which you
are located at any given time. If you say Is, it is the filenames in the current directory that are
brought up for you to see. If you have logged in as kumarr, you will probably land up in
/usr/Irumarr when you get your prompt unless it has been arranged otherwise.
Now consider a file in /usr/kumarr/nlp like augcfg.C. Suppose you want to see the size of
this file alone. For this you need to use the 1s command and provide the filename as an.
argument to it. In UNIX you can provide a pathname (relative or absolute) as an argument to
a command wherever you could otherwise provide a bare filename. So that actually gives
you three ways of accomplishing what you want to (we will assume that you have the
required permissions-- this will, in fact, be the usual situation) do.
Let us first use an absolute pathname. So you have to specify the filename starting from root
or '/'.Thus your command needs to be
You have already used this method in the last section. The second way is to use a relative
pathname. where you specify the pathname relative to where are currently. Here you only
needto remember that '..' stands for the parent directory of the current directory '.'. So if you
are at /usr/khanz, you can say
The '..' takes you one level up, that is, to Iusr. From there you continue naming the file as
before. Of course you could have used the following rather convoluted way
This is inefficient because you implicitly move to mot before naming the file. The first '..'
takes you to Jusr and the second '..' takes you one level higher, to '/' or mot itself. Then you
CNIX Operating system-I begiiyour debcent until you reach the file you desire. Here it would have been better to use
an absolute pathname instead of this, for then you would not have had to use two steps to
reach root.
Usually a filehame is specified by the method that results in the shortest possible
specification of the name. This depends on whether the filename is closer to you or to the
root diredtory, Thus if you are located in /usr/khanz and you want to specify a file in the
directory /usrhumarr, it is easier to say ../kumarr rather than /usr/kumarr.
There is a third way of looking at the size of augcfg.C. For this you will have to l e m a new
command cd, which lets you change your current directory. This command can be given an
argument which is your intended destination and it then changes your directory to whzt you
asked, providdd you have the appropriate permissions. An3 how do you specify your desired
destination? Blyspecifying h e pathnnme, of course. The pathnamecan be specified, as you
would have ulldoubtedly guessed, either as a relative pathname or a complete one. So you
can say from /usr/khanz
This really amounts to specifying the filename relative to /usr/kumarr/nlp, the current
directory. In general when you specify a bare filename you are specifying the filename
relative to the current working directory. So the command above is really a shorter way of
saying
--
% Is -1 ./augcfg.C
One form of the cd command can be very convenient if you have wandered far off your
home directory and you want to return there, especially if your home directory happens to be
far away &om the root directory. This is.
without any arguments. It always brings you back to your home directory irrespective of
where you are, even if you were there to start with.
9. Kur: h e rllc coinmar~dan various kinds of files from the various directories you have
,.A" n and see IC ~llcir
-,, lypes are reportcd correctly.
UNIX Operating System-I ......................................................................................................................
2.4 SUMMARY
In this unit we have started at the beginning and looked at many basic UNIX commands.
However thee are many useful commands we have not been able to examine. You must
refer to the manual and learn these. You should now be knowing enough about UNIX to
conduct a session with ease. In the following units we will examine some more commands
and look at some utilities in slight detail.
2. No, there can be only one account under one name. In fact, it is the name of the account
which defines the account
2. You will r~otbe able to get the prompt unless you are able to guess his password. Thus,
your own password should be such that it is not easy to guess.
3. There is no difference in the system's response. This is so that an intruder (who might
not know for sure whether a particular account exists) does not get any information
about the existence of an account unless he is able to loging.
4. Five possible reasons are:
(a) There might not be enough free disk space to let you login.
(b) The system wide limit on the number of processes that can be run concurrently
might have bcen reached.
(c) The per user limit on the number of processes that can bk run might have been
reached.
(d) The limit on the number of concurrent users laid down in the operating system
software licence might have been already mched.
(e) There might be a hardware malfunction.
2. By entering two T characters one after the other ('VY). The first 1'escapes the second,
which thereupon loses its special meaning.
3. No model answer.
4. No model mswer.
5. No model answer. -
UNIX Gctting Startcd I
where mm represents the two digits of the month and yyyy the four digits of the year (in
both cases leading zeroes can be omitted).
2. No model answer.
3. No model answer.
4. The command
% who -b
tells you when the system was booted. To see how many users are loggcd on, say
2. An ordinary user cannot help you if you have forgotten your password because he
cannot look at or change your password unless he knows it alrcady.
No directory
2. No model answer.
3. The Is command is executed and thc files are listed as usual. As soon as the file
7aESC[2Jbc is to come, the screen gets cleared becausc it sees thc sequence to clear h e
screcn. You can say 1s -b or 1s -? to look at the listing without h e characters getting
interpreted. Some terminals might have a way of setting the hardware itsclf so that it
docs not interprct control equcnces and displays them. But if you set your terminal to
that, you will not be able to clear it atpll, bccause the effcct of the hardware setting is
not limited to the duration of the 1s command.
4. This can happen if one or both of the files have non- printable characters embcdded. YO.L
can again us Is -b or 1s -? to look at thc actual names of the two files, and those are
guarante~dto be diffcrcnt.
5. No model answcr.
2. No model answer.