0% found this document useful (0 votes)
39 views

Lab 3-Linux Basic Commands Combination

This document outlines 4 exercises for a Linux command line lab: 1. Navigating directories and creating/copying files and folders in a nested structure. 2. Explaining the purpose of common Linux commands like dpkg, free, ifconfig, sudo, and running them. 3. Practicing basic directory navigation and file listing/sorting commands. 4. Creating a text file of usernames, displaying and sorting the contents, counting the number of users. Screenshots of command outputs must be captured and included.
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)
39 views

Lab 3-Linux Basic Commands Combination

This document outlines 4 exercises for a Linux command line lab: 1. Navigating directories and creating/copying files and folders in a nested structure. 2. Explaining the purpose of common Linux commands like dpkg, free, ifconfig, sudo, and running them. 3. Practicing basic directory navigation and file listing/sorting commands. 4. Creating a text file of usernames, displaying and sorting the contents, counting the number of users. Screenshots of command outputs must be captured and included.
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/ 2

LAB 03 – Command line in Linux

Exercise 1:

1. Go to user directory with the command: cd ~


2. Create a directory naming by your name, for example: anhtuan, thanhvan, …
3. In your directory, create a subdirectory naming by your subject: OS_N, then in the OS_N
directory continuously create two subdirectories with the name: OS and N.
4. In OS directory, you create the follows.
a. A subdirectory naming HW
b. A file naming test1 with the content as “He dieu hanh”
5. In N directory, you create the following directories and files:
a. HW directory
b. Assgn directory
c. An empty test5 file
6. Copy test1 file to N directory with the name is test4
7. Delete test1 file in OS directory
8. Add more content into test5 file
9. Back to root directory

Exercise 2:

Explain the meaning of the following commands in Linux, and try to run them in your console.

1. dpkg
2. free
3. hostname
4. ifconfig
5. sudo
6. cat /proc/cpuinfo
7. free –m
8. fdisk –l

Exercise 3:

1. Display your current working directory: ....................................................................................... 2.


Change to new directory /tmp:.....................................................................................................
3. Go back to HOME directory: ........................................................................................................
4. List detail of your directory content (included hidden files): .......................................................
5. Do list and redirect the result of the list command on content /usr directory to usr.txt file: .....

......................................................................................................................................................
6. Sort on data input is the usr.txt file in the reverse order: ............................................................

7. show content of /usr/bin directory and pause on each screen: ..................................................

8. Search recursive on the /etc directory for all files in which contain ‘log’ word: .........................

9. What is command to count on number of lines in /etc/profile file: ............................................

10. How many number of lines in the /etc/profile file: .....................................................................

Answer above questions & capture screen of you comand-line executed!

Exercise 4:

- Create a file named user.txt. Then, you add n usernames (each in one line, n>=5).
- Display the content of file user.txt
- Display list of n sorted usernames in your file and store that sorted list into a new file named
suser.txt

Count the number of users in your file and display it.

Submission:
You should capture the result screen of each exercise and include in your completed document
file.Create the directory with a name like <class>-<name><roll number>-Lab-01, e.g. SE0905-
QuangTV-SE03456-Lab01
Copy all your exercise files to that folder.
Compress the folder to .zip/.rar file (with the same name) and upload to LMS.

You might also like