0% found this document useful (0 votes)
50 views7 pages

QT Lab 08 by 17-16TL20

This document provides instructions for 40 commands related to navigating directories, listing files, copying and moving files, finding and searching files, and performing basic operations in the Linux terminal. It includes commands for changing directories, listing contents, creating and removing directories, renaming files, copying files between locations, displaying file information, and viewing file contents. The document tests the reader's knowledge of these Linux terminal commands by providing examples and asking the reader to answer questions by running the commands.

Uploaded by

Saad Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views7 pages

QT Lab 08 by 17-16TL20

This document provides instructions for 40 commands related to navigating directories, listing files, copying and moving files, finding and searching files, and performing basic operations in the Linux terminal. It includes commands for changing directories, listing contents, creating and removing directories, renaming files, copying files between locations, displaying file information, and viewing file contents. The document tests the reader's knowledge of these Linux terminal commands by providing examples and asking the reader to answer questions by running the commands.

Uploaded by

Saad Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Queueing Theory

Lab# 08 
Exercise
1. The command to display your current directory is pwd .
2. The command to change to the /etc directory is .cd/ etc
3. The command to go to the parent directory of the current directory is .cd ..
4. The command to go to the root directory is cd /
5. The command to list the contents of the root directory is ls /
6. The command to list the contents of /etc directory is ls
7. The command to list all the files (including hidden files) in your home directory is-a
8. The command to list the files in /boot in a human readable format is ls -h.
9. The command to change to the /etc directory, stay here and create a directory newdir in your
home directory is mkdirnewdir
10. To create in one command the directories /dir1/dir2/dir3 (dir3 is a subdirectory from dir2,
and dir2 is a subdirectory from dir1) would be mkdir -p~/ dir1/dir2/dir3
11. The command to display the type of file of /bin/cat, /etc/passwd and /usr/bin/passwd is file
/bin/car- /etc/passwd /usr/bin/passwd
12. The command to rename filename.jpg to filename.pdf is .ren b:jpg*.* b:*.pdf
13. The command to create a directory /touched and enter it is mkdir -/touched ; cd -/touched
14. To create the files today.txt and yesterday.txt using touch command is touch today. t,xt,
yest.erday . txt
15. The command to create a directory called /testbackup and copy all files from /touched into it
is mkdir -/testbackup ; cp -r -/touched -/testbackup/
16. Use one command to remove the directory /testbackup and all files into it is .rm -rf -
/testbackup
 
 
 
 
 

Submitted by Saad Khan 
Roll No. 17‐16TL20 
Queueing Theory
Lab# 08 
17: Create a directory /etcbackup and copy all *.conf files from /etc into it. Did you include
all subdirectories of /etc ? Display the snapshot as a proof.
Ans: 

Proof: 
 

Submitted by Saad Khan 
Roll No. 17‐16TL20 
Queueing Theory
Lab# 08 

 
 

18. Display the first 12 lines of /etc/services

Ans: head -12 /etc/services

19. Display the last line of /etc/passwd

Ans: tail -1 /etc/passwd

20: Use cat to create a file named count.txt that looks like this:

Ans: cat > count.txt


One
Two
Three
Four
Five (followed by Ctrl-d)

Submitted by Saad Khan 
Roll No. 17‐16TL20 
Queueing Theory
Lab# 08 
21. Use cp to make a backup of this file to cnt.txt

Ans: cp count.txt cnt.txt

22. Use cat to make a backup of this file to catcnt.txt.

Ans: cat count.txt > catcnt.txt

23. Display catcnt.txt, but with all lines in reverse order (the last line first)

Ans: tac catcnt.txt

24. Use more command to display /etc/services.

Ans: more /etc/services

25. Display the readable character strings from the /usr/bin/passwd command.

Ans: strings /usr/bin/passwd

26. Use ls to find the biggest file /etc

Ans: ls -lrS /etc

27. Use cat to create a file name tailing.txt that contains the contents of trailing.txt followed
by the contents of /etc/passwd.

Ans: cat /etc/passwd >> tailing.txt

Submitted by Saad Khan 
Roll No. 17‐16TL20 
Queueing Theory
Lab# 08 
28. What is the size of the Linux kernel file(s) (vmlinu*) in /boot?

Ans: ls ‐lh /boot/vm*

29. Display /proc/cpuinfo. On what architecture is your Linux running?

Ans: The file should contain at least one line with Intel or other cpu.

30. Use cal command to quickly view a calendar on terminal in Linux. Try it and show the
display.
Ans:

31. Is it true that date command on Linux terminal would display current Time. Try it and
show the display.
Ans:

Submitted by Saad Khan 
Roll No. 17‐16TL20 
Queueing Theory
Lab# 08 
32. bc (Basic Calculator) is a command line utility that offers everything you expect from a
simple scientific or financial calculator. Explain the output of the following command.
Ans:

33. egrep is an acronym for Extended Global Regular Expressions Print. It is a program
which scans a specified file line by line, returning lines that con-tain a pattern matching a
given regular expression. Describe the use of egrep in the following examples.
Ans:
34. find command can be used to find files and direct-ories and perform subsequent
operations on them. It supports searching by file, folder, name, cre-ation date, modification
date, owner and permis-sions. Describe the use of find in the following examples.
Ans:
35. Ctrl R command in terminal is used to search for any command in command history. In
the terminal, hold down Ctrl and press R to invoke reverse-i-search and type a letter to get
a match for the most recent command in your history that starts with that letter. Keep
typing to narrow your match. How to cycle through other previously typed matching
commands?
Ans:
36. Display the last 5 commands you typed.

Submitted by Saad Khan 
Roll No. 17‐16TL20 
Queueing Theory
Lab# 08 
37. Show how to create multiple directories using ter-minal. Lets say 100 directories.

Ans: saad@ubuntu:~$ mkdir ‐p {dir1,dir2,dir3,dir4, ..., dir100}

38. Show how to move a folder containing files and sub-folders to another folder using
terminal.

Ans: cp -r /home/saad/Pictures/ /home/saad/etcbackup

39. Try rename command and show how to rename multiple files and directories.
Ans:
40. Show how to open an image from the linux terminal.

Ans: saad@ubuntu:~$ display /home/saad/Pictures/1.png

Submitted by Saad Khan 
Roll No. 17‐16TL20 

You might also like