Professional Documents
Culture Documents
COMP 83
LINUX 1
LAB 1
Date: 11-02-2022
2
Contents
Section 1................................................................................................................................................................................3
Section 2.............................................................................................................................................................................. 27
Section 3.............................................................................................................................................................................. 40
Section 4.............................................................................................................................................................................. 50
3
Section 1
/
Budget
root
Payroll
Finance
Staf
HR
Data
Figure 1
i. Starting with Payroll as your present working directory, change the directory to
Staff using absolute path
6
x. From Budget, change directory to the root user directory using relative path
15
xi. From the root user directory, Change directory to the root of the Linux directory
d) Display the contents of the Data directory using the following ls commands and notice
the difference:
i. Ls
18
ii. ls -a
iii. ls -l
iv. ls -i
v. ls -al
19
vi. ls -il
20
vii. ls -ail
21
g) Delete data1.txt
23
i) Move .info2 to Finance directory and rename the file .Rec2. Do this using a single
command.
25
Section 2
n) In the /root directory, create a directory myLabXXX (where XXX is the last 3 digit of
your student ID)
o) In the myLab directory create the following files using the vi editor:
cl
aa)Sort the third column of fileA.txt in ascending order (lowest number first)
bb) Sort the third column of fileA.txt in descending order (highest number first)
38
Section 3
mkdir1. Using the vi editor, create the file budget.txt with the following content, then using an appropriate command
display the content of the file on the display. [5]
Using the snipping tool paste the command you used and the output below.
2. Using the vi editor, create the file budgetB.txt with the following content, then using an appropriate command display
the content of the file on the display. [5]
42
Using the snipping tool paste the command you used and the output below.
3. Using the two files you created, apply the appropriate command to obtain the following output. [5]
43
Using the snipping tool paste the command you used and the output below.
4. Using the two files you created, apply the appropriate command to obtain the following output [5]
44
Using the snipping tool paste the command you used and the output below.
5. Using the vi editor, create the file Sales.txt with the following content, then using an appropriate command display the
content of the file on the display. [5]
Using the snipping tool paste the command you used and the output below.
45
6. Combine budget.txt and Sales.txt to obtain the following output using the appropriate command [5]
Using the snipping tool paste the command you used and the output below.
46
7. Combine budget.txt and Sales.txt just as you did above but this time write the output to a file data3.txt, Below is an
example of what data3.txt should look like when displayed with the cat command. [3]
Using the snipping tool paste the command you used and the output below.
47
8. Sort data3.txt and write the output to a file data4.txt. then display the content of data4.txt to obtain the following output.
[3]
Using the snipping tool paste the command you used and the output below.
48
9. Sort the budgetB.txt file you created earlier to obtain the following output. [2]
Using the snipping tool paste the command you used and the output below.
49
10. Use the appropriate command to change the value 19500 to 28500 in the Sales.txt file, such that Sales.txt will be
updated as follows. [2]
Using the snipping tool paste the command you used and the output below.
50
51
Section 4
Use the appropriate command to display the last five users you have just created on the screen.
52
2. Display all contents (including hidden files) in Carter home directory. [5]
53
___________________________
4. Create a password for Jillian (use this password Pa$$word) and display the encrypted password on the screen using the
appropriate command and Linux file. [5]
54
5. Add a comment for Patrick to show Developer and configure his user account expiry date to 2019-01-01. Display the
change of Patrick user account attributes on the screen. [5]
55
7. Delete Carter user account and display the content of the appropriate file to verify that the account no longer exists. [5]
57
8. Lock Jillian user account and display the last five lines of the /etc/passwd file on the screen. [5]
58
9. What symbol in the /etc/passwd file indicates that Jillian account is locked? [5]
_______________!!____________________
~End of Lab~