Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
42 views

Lab 3 - Exercise (Terminal Commands)

This document contains instructions for a lab assignment on Linux terminal commands. Students are asked to complete several problems exploring basic commands like date, hostname, uname, cd, ls, pwd and man. They also have to explore key directories like /etc, /dev, /proc and their home directory. Students are instructed to submit a Word file with screenshots of command outputs and descriptions of each command. Plagiarism is prohibited.

Uploaded by

Hassan Imtiaz
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Lab 3 - Exercise (Terminal Commands)

This document contains instructions for a lab assignment on Linux terminal commands. Students are asked to complete several problems exploring basic commands like date, hostname, uname, cd, ls, pwd and man. They also have to explore key directories like /etc, /dev, /proc and their home directory. Students are instructed to submit a Word file with screenshots of command outputs and descriptions of each command. Plagiarism is prohibited.

Uploaded by

Hassan Imtiaz
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

National University of Computer & Emerging Sciences

Department of Computer Science


CL 205 Operating Systems Lab
Lab # 2
Terminal Commands

Instructions:
1. Make a word document with the convention “SECTION_ROLLNO _LAB-NO”. and
paste all of your work done at the LINUX prompt.
2. You have to submit a Word File including the command name, description of the
command and the screen shot of your output when you are done with your work.
3. Plagiarism is strictly prohibited, negative marks would be given to students who cheat.

Objectives:
 Linux Commands
 Practice Problems

Tasks:
Problem 1: Enter the following commands on LINUX prompt, and try to interpret the output. Give
description of each command in at least one line.
 echo hello world
 passwd
 date
 hostname
 arch
 uname -a
 uptime
 who am i
 who
 id
 last
 w
 top (you may need to press q to quit)
 echo $SHELL
 man ls (you may need to press q to quit)
 man who (you may need to press q to quit)
 clear
 cal 2000
 cal 9 1759
 echo 5+4 | bc -l
 yes please (you may need to press Ctrl-c to quit)
 time sleep 5
 history
 sudo apt-get install nasm
Problem 2: Try the following Command sequence and describe them in a single line.
 cd
 pwd
 ls -al
 cd .
 pwd (where did that get you?)
 cd ..
 pwd
 ls -al
 cd ..
 pwd
 ls -al
 cd ..
 pwd (what happens now)
 cd /etc
 ls -al | more
 cat passwd
 cd -
 pwd

Problem 3: Answer the following Questions.


 Continue to explore the filesystem tree using cd, ls, pwd and cat. Look in /bin, /usr/bin,
/sbin, /tmp and /boot. What do you see?
 Explore /dev. Can you identify what devices are available? Which are character-oriented and which are
block-oriented? Can you identify your tty (terminal) device (typing who am i might help); who is the
owner of your tty (use ls -l)?
 Explore /proc. Display the contents of the files interrupts, devices, cpuinfo, meminfo
and uptime using cat. Can you see why we say /proc is a pseudo- filesystem which allows access to
kernel data structures?
 Change to the home directory of another user directly, using cd ~username.
 Change back into your home directory.
 Make subdirectories called work and play.
 Delete the subdirectory called work.
 Copy the file /etc/passwd into your home directory.
 Move it into the subdirectory play.
 Change into subdirectory play and create a symbolic link called terminal that points to your tty device.
What happens if you try to make a hard link to the tty device?
 What is the difference between listing the contents of directory play with ls -l and ls -L?
 Create a file called hello.txt that contains the words "hello world". Can you use "cp" using
"terminal" as the source file to achieve the same effect?
 Copy hello.txt to terminal. What happens?
 Imagine you were working on a system and someone accidentally deleted the ls command (/bin/ls).
How could you get a list of the files in the current directory? Try it.
 How would you create and then delete a file called "$SHELL"? Try it.
 How would you create and then delete a file that begins with the symbol #? Try it.
 How would you create and then delete a file that begins with the symbol -? Try it.
 Still in your home directory, copy the entire directory play to a directory called work, preserving the
symbolic link.
 Delete the work directory and its contents with one command. Accept no complaints or queries.
 Change into a directory that does not belong to you and try to delete all the files (avoid / proc or /dev,
just in case!)
 Experiment with the options on the ls command. What do the d, i, R and F options do?

You are done with your exercise, Submit on GOOGLE CLASSROOM at given time.

You might also like