You are on page 1of 22

Linux Assignment Exercise : 1 1. Log on a Linux machine Enter your login (user name) and password at relevant prompts.

2. Enter these commands at the U !" prompt# and try to interpret the output. As$ %uestions and don&t 'e a(raid to experiment (as a normal user you cannot do much harm): echo hello world passwd date hostname arch uname a dmesg ) more (you may need to press % to %uit)

uptime who am i who id last w

top (you may need to press % to %uit)

man *automatic door* man ls (you may need to press % to %uit)

man who (you may need to press % to %uit)

lost clear cal 2+++

cal , 1-.2 (do you notice anything unusual/)

'c l (type %uit or press 0trld to %uit) echo .12 ) 'c l yes please (you may need to press 0trlc to %uit)

history

Exercise : 2 3ry the (ollowing command se%uence: cd pwd ls al cd . pwd (where did that get you/) cd .. pwd ls al cd .. ls al pwd (what happens now) cd 4etc ls al )more cat passwd cd pwd (1) (2)

(5)

2. 0ontinue to explore the (ilesystem tree using cd# ls# pwd and cat. Loo$ in 4'in#

4usr4'in# 4s'in# 4tmp and 4'oot. 6hat do you see/ (1)

(2)

(5) (2)

(.)

(7)

(-)

(8)

(,)

5.0hange to the home directory o( another user directly# using cd 9username.

2. :a$e su'directories called wor$ and play.

.. ;elete the su'directory called wor$.

7. 0opy the (ile 4home4documents into your ;es$top directory.

-. :ove it into the su'directory play.

8. 6hat is the di((erence 'etween listing the contents o( directory play with ls l and ls L/

,. 0reate a (ile called hello.txt that contains the words *hello world*

1+. 0opy hello.txt to any directory. 6hat happens/

11. 6hat is the output o( the command: echo <con#pre=<sent#(er=<s#ed=/ ow# (rom your home directory# copy 4etc4passwd and 4etc4group into your home directory in one command.

12. >till in your home directory# copy the entire directory play to a directory called wor$.

15. ;elete the wor$ directory and its contents with one command.

12. Experiment with the options on the ls command. 6hat do the d# i# ? and @ options do/

1.. Apply these commands and chec$ their output: sort A(ilenameB ) uni%# sort A(ilenameB ) uni% Cc ) sort Cnr.

You might also like