0% found this document useful (0 votes)
47 views2 pages

Lab 02

The document outlines 13 tasks to complete on a Linux system. The tasks include finding the kernel version, changing the hostname, using man pages and commands like cat, grep, and alias to view and search files and directories. Additional tasks create directories, copy files, and use commands to view portions of files like services and passwd. The final tasks use pipes and options to view, sort, and count lines in specific files.

Uploaded by

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

Lab 02

The document outlines 13 tasks to complete on a Linux system. The tasks include finding the kernel version, changing the hostname, using man pages and commands like cat, grep, and alias to view and search files and directories. Additional tasks create directories, copy files, and use commands to view portions of files like services and passwd. The final tasks use pipes and options to view, sort, and count lines in specific files.

Uploaded by

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

LAB 02

Part 1
Time: 90 min
Task 01:
Find which version of kernel your system is using. (LF-L2-1)

Task 02:
Use man and related resources to find out how to change the hostname of your computer. (LF-L2-2)

Task 03:
a) Locate man page that shows how to set a password. (R-L2-1)
b) Display the man page of mount system call. (LB-C3-10)

Task 04:
Use the cat command to list the contents of the /etc/services file. (LB-C3-6)

Task 05:
Using variables, find out what your hostname, username, shell, and home directories are currently set
to. (LB-C3-8)

Task 06:
Create an alias called mypass that displays the contents of the /etc/passwd file on your screen. (LB-C3-
9)

Task 07:
a) Use grep to show the names of all files in /etc that have lines starting with text ‘root’. (LF-L4-4)
b) Use grep to show all lines from all files in /etc that have contains exactly 3 characters. (LF-L4-5)
(R-L4-5)
c) Use grep to find all files that contain string “alex”, but make sure that “alexander” is not in the
result. (LF-L4-6) (R-L4-6)

Task 08:
Find files under the /usr/share/doc directory that have not been modified in more than 30 days. (LB-C5-
6)

Task 9:
Create a /tmp/FILES directory. Find all files under the /usr/share directory that are more than 5MB and
less than 10MB and copy them to the /tmp/FILES directory. (LB-C5-7)

Task 10:
There are two terminals and I want to write from one to terminal to another terminal. Can you find out
a command that helps me writing something to another terminal? (Hint: take help from man and man
-k)

Task 11:
a) Write a single shell command to list all the files in your pwd including hidden files, but not
implied ‘.’ and ‘..’?
b) Write a single shell command that display all the files within a pwd, sorted alphabetically by file
name and show associated last status change time information of each file/directory.

Task 12:
a) Write a single command to display the first 12 lines of /etc/services.
b) Write a single command to display only the last line of /etc/passwd.
Task 13:
Write a single command to count the number of lines in /etc/passwd.

You might also like