WK3 Ungraded exemplar (Filerting) Flashcards
1
Q
Task 1
A
In this task, you must navigate to the /home/analyst/logs directory and report on the error messages in the server_logs.txt file. You’ll do this by using grep to search the file and output only the entries that are for errors.
- Navigate to the /home/analyst/logs directory.
The command to complete this step:
cd logs - Use grep to filter the server_logs.txt file, and return all lines containing the text string error.
grep error server_logs.txt
2
Q
Task 2
A
Task 2. Find files containing specific strings
In this task, you must navigate to the /home/analyst/reports/users directory and use the correct Linux commands and arguments to search for user data files that contain a specific string in their names.
- Navigate to the /home/analyst/reports/users directory.
The command to complete this step:
cd /home/analyst/reports/users - Using the pipe character (|), pipe the output of the ls command to the grep command to list only the files containing the string Q1 in their names.
The command to complete this step:
ls | grep Q1 - List the files that contain the word access in their names.
The command to complete this step:
ls | grep access
3
Q
Task 3
A
Task 3. Search more file contents
In this task, you must search for information contained in user files and report on users that were added and deleted from the system.
- Display the files in the /home/analyst/reports/users directory.
The command to complete this step:
ls - Search the Q4_added_users.txt file to list the users who were added to the Human Resources department.
The command to complete this step:
grep “Human Resources” Q4_added_users.txt - Search the Q4_added_users.txt file to list the users who were added to the Human Resources department.
The command to complete this step:
grep “Human Resources” Q4_added_users.txt