Unix tutorial for beginners with examples

The article about unix tutorial for beginners with examples. This is my second session on unix commands, in this session I am going to share my knowledge with all of you.

Unix tutorial for beginners with examples


  1. The directories . and ..

Still in the unixstuff directory, type

% ls -a

Here you can see, in the unixstuff directory (and in all other directories), there are two special directories called (.) and (..)

In UNIX, (.) means the current directory, so typing

% cd .

NOTE: there is a space between cd and the dot

It means stay where you are (the unixstuff directory).

This may not seem very useful at first, but using (.) as the name of the current directory will save or stored a lot of typing.

(..) means the parent of the current directory, so type

% cd ..

Will take you one directory up the hierarchy (back to your home directory)

NOTE: typing cd with no argument always returns you to your home directory. This is very useful if you are lost in the file system.

I am trying to give you more information in details, as you need to understand thoroughly.

  1. Pathnames

 pwd (print working directory)

Pathnames enable you to work out where you are in relation to the whole file-system. Type cd to get back to your home-directory and then type

% pwd

The full pathname will look something like this


It means that ee91ab (your home directory) is in the directory eebeng99 (the group directory), which is located on the fservb file-server.

NOTE: /a/fservb/fservb/fservb22/eebeng99/ee91ab

can be shortened to


  1. More about home directories and pathnames

Understanding pathnames

First type cd to get back to your home-directory, then type

% ls unixstuff

to list the conents of your unixstuff directory

Now type

% ls backups

Message will be displayed like this – backups: No such file or directory

The Backups is not in your current working directory. To use a command on a file (or directory) not in the current working directory (the directory you are currently in), you must either cd to the correct directory, or specify its full pathname. To list the contents of your backup directory, type

% ls unixstuff/backups

~ (your home directory)

Home directories can also be referred to by the tilde ~ character. It can be used to specify paths starting at your home directory. So type

% ls ~/unixstuff

List the contents of your unixstuff directory, no compulsory where you currently are in the file system.

What do you think

% ls ~

would list?

I have explained everything in details which was required you for understanding.


Share This Post

One Comment - Write a Comment

Post Comment