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

Performance_Test_on_Shell_Commands_Solution

This the solution of performance test on shell commands.

Uploaded by

estiaksazid
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)
14 views

Performance_Test_on_Shell_Commands_Solution

This the solution of performance test on shell commands.

Uploaded by

estiaksazid
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 Performance Test Solution: Shell Commands

Task 1: User and Group Management


1. Create two users named ‘user1’ and ‘user2’:

sudo useradd user1


sudo useradd user2

2. Create a group named ‘project_group_x’:

sudo groupadd project_group_x

3. Add both ‘user1’ and ‘user2’ to the ‘project_group_x’:

sudo usermod -aG project_group_x user1


sudo usermod -aG project_group_x user2

Task 2: Project Directory Setup


4. Create a project directory ‘/home/projects/ProjectX’:

sudo mkdir -p /home/projects/ProjectX

5. Change the group ownership of the ‘/home/projects/ProjectX’ directory to


‘project_group_x’:

sudo chown :project_group_x /home/projects/ProjectX

6. Set permissions so only members of ‘project_group_x’ can read, write, and execute
files in ‘/home/projects/ProjectX’:

sudo chmod 770 /home/projects/ProjectX

Task 3: File Creation


7. Switch to ‘user1’ and create a file named ‘report.txt’ in ‘/home/projects/ProjectX’. Add
the text "ProjectX Progress Report" to the file:

su - user1
echo "ProjectX Progress Report" > /home/projects/ProjectX/report.txt

8. Create a text file ‘logs.txt’ in ‘/home/projects/ProjectX’ with the specified content:

cat << EOF > /home/projects/ProjectX/logs.txt


Error: File not found
Warning: Low disk space
Info: System update completed
Error: Connection timed out
EOF

Task 4: Grep Command Application


9. Extract all lines from ‘logs.txt’ that contain the word "Error":

grep "Error" /home/projects/ProjectX/logs.txt

10. Count the total number of lines in ‘logs.txt’ containing the word "Error":

grep -c "Error" /home/projects/ProjectX/logs.txt

You might also like