Anda di halaman 1dari 3

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI

WORK INTEGRATED LEARNING PROGRAMMES DIVISION


I Semester, 2016-17
Systems Programming
Lab Exercise 1

Intended Learning Outcome:


Students should
be able to understand the basic use of Linux Command Line interface.
be able to use basic Linux commands including cal, date, man, adduser, su,
cat, ls, cd, cp, ed, pwd, and mkdir.
Prerequisite:
Students should go through the recorded lectures RL1.1, RL 1.2 and RL 3.3

Lab exercise:
1. Write a command which displays
a. the calendar of current month
b. the month you were born
2. What is the result of the following commands?
Command Observe and analyze
$cal -1
$cal -3
$cal h
$ date

3. Create 4 users sim1, sim2, wase1 and wase2.


Hint:
use adduser command
Only root can add a user or group to the system
In order to switch to root, use su command
To logout from root, use exit command
Use <ctrl> + <Alt> + <Fn> switches screens. By default, <F1> through <F6> are text
mode shell prompt screens whereas <F7> is the graphical desktop screen.
Which command is used to remove the user? Explore.
4. Assume that you have just started the machine. Login using sim1 credentials. Perform
following tasks:
a. Open the CLI (Command Line Interface terminal)
b. Type the following command
$ who
$whoami
Observe the output and understand various fields. Find out why there are two rows of
entries in the output.
c. Press <ctrl> + <Alt> + <F1> and observe the screen. Login using sim2 credentials.
Type the following command:
$ who
$whoami
Observe the output. Find out why there are three rows of entries in the output?
d. Press <ctrl> + <Alt> + <F7>
Type the following command in CLI.
$ who
$whoami
Observe the output.
5. How to find out whether you are working in text mode or graphical mode?
6. Assume that only wase1 and sim2 user are logged in. wase1 wants to send a mail to sim2
with CC to wase2.
Procedure:
Login using wase1 credentials [use text mode shell prompt screen F2 and login]
Use mail command at the command prompt.
To check the mail, you are required login in to sim2 and wase2 [use appropriate text
mode shell prompt screens]
7. Assume that only sim1 and sim2 user are logged in. Try write command to
a. Send a message from sim1 to sim2
b. Send a message from sim1 to wase1
What is your observation in both the cases?
8. Assume that you have logged in as sim1. Execute the following commands at the command
prompt.
$who aH
$mesg n
$write sim2
Will sim1 is able to send message to sim2? If no, why and how you can make sim1 to send
message to sim2 using write command?
9. Assume that you are in home directory. Type the following commands and observe the
results.
$ls
$ls l
$ls a
$ls ..
$ls .
$ls ~
$ls ../.
$ls ./..
$ls lt
$ls ls
$ls lh
$ls al
10. Construct the following directory structure:
11. Assume that your present working directory is /home/sim1/BITS/Pilani/ Create a file
student_id.doc under WASE directory using relative path
12. Assume that your present working directory is /home/sim1/BITS/Pilani/ Execute following
command:
$mkdir ./../newdir
Find out where newdir folder is created.
13. Create a file letter.doc in folder std1 using ed command.
14. Create a new document file stu_final.doc under wipro directory whose contents should be
the contents of file student.doc under WASE directory followed by contents of file
student.doc under SIM directory. Use absolute path
15. Display the contents of stu_final.doc under wipro directory using
a. cat command
b. pr command
16. Assume that your present working directory is /home/sim1/BITS/ . User wishes to update
the contents of file info.txt under WIBangalore using relative path. He tries to use the
following:
$ cat > /WIBangalore/info.txt
$ cat > ~/WIBangalore/info.txt
$ cat >> ~/WIBangalore/info.txt
Identify the correct command.
17. Assume that your present working directory is /home/sim1/BITS/Goa/ . Store the result of
command ls lai into a file ls_result.txt
18. Assume that your present working directory is /home/sim1/BITS/Goa . Perform the
following:
a. copy file paper.doc under Goa directory into /home/sim1/WIBangalore/std1. Use
relative path with ~
b. What happens when you repeat part(a) one more time?
c. Repeat part(a) with option i
19. Assume that your present working directory is /home/sim1/ . Copy entire wipro directory
into std2 directory.
Hint: Try cp command with options P, -r, -R, -f, -n and I and observe the difference.

Anda mungkin juga menyukai