Knowee
Questions
Features
Study Tools

In this scenario, you have to locate and analyze the information of certain files located in the /home/analyst directory.Here’s how you’ll do this: First, you’ll get the information of the current working directory you’re in and display the contents of the directory. Second, you’ll navigate to the reports directory and list the subdirectories it contains. Third, you’ll navigate to the users subdirectory and display the contents of the Q1_added_users.txt file. Finally, you’ll navigate to the logs directory and display the first 10 lines of a file it contains.To complete these tasks, you'll need to use commands that you've previously learned in this course. Well, it's time to practice what you’ve learned. Let’s do this!Note: The lab starts with your user account, called analyst, already logged in to the Bash shell. This means you can start with the tasks as soon as you click the Start Lab button.Disclaimer: For optimal performance and compatibility, it is recommended to use either Google Chrome or Mozilla Firefox browsers while accessing the labs.

Question

In this scenario, you have to locate and analyze the information of certain files located in the /home/analyst directory.Here’s how you’ll do this: First, you’ll get the information of the current working directory you’re in and display the contents of the directory. Second, you’ll navigate to the reports directory and list the subdirectories it contains. Third, you’ll navigate to the users subdirectory and display the contents of the Q1_added_users.txt file. Finally, you’ll navigate to the logs directory and display the first 10 lines of a file it contains.To complete these tasks, you'll need to use commands that you've previously learned in this course. Well, it's time to practice what you’ve learned. Let’s do this!Note: The lab starts with your user account, called analyst, already logged in to the Bash shell. This means you can start with the tasks as soon as you click the Start Lab button.Disclaimer: For optimal performance and compatibility, it is recommended to use either Google Chrome or Mozilla Firefox browsers while accessing the labs.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here's how you can complete the tasks mentioned in the scenario:

  1. Get the information of the current working directory and display its contents:

    • Use the pwd command to print the name of the current working directory.
    • Use the ls command to list the contents of the current directory.
  2. Navigate to the reports directory and list the subdirectories it contains:

    • Use the cd /home/analyst/reports command to change the current working directory to the reports directory.
    • Use the ls command to list the subdirectories in the reports directory.
  3. Navigate to the users subdirectory and display the contents of the Q1_added_users.txt file:

    • Use the cd users command to navigate to the users subdirectory.
    • Use the cat Q1_added_users.txt command to display the contents of the Q1_added_users.txt file.
  4. Navigate to the logs directory and display the first 10 lines of a file it contains:

    • Use the cd /home/analyst/logs command to navigate to the logs directory.
    • Use the head -n 10 filename command to display the first 10 lines of a file. Replace 'filename' with the name of the file you want to display.

Remember to replace 'filename' with the actual name of the file you want to display. Also, these commands are case-sensitive, so make sure to enter them exactly as shown.

This problem has been solved

Similar Questions

n 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.Search the Q2_deleted_users.txt file for the username jhill.Search the Q4_added_users.txt file to list the users who were added to the Human Resources department.Note: In order for grep to interpret a string of two or more words correctly, you must enclose it in quotes ("Human Resources").Click Check my progress to verify that you have completed this task correctly.Search more file contents

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.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.Note: Piping sends the standard output of one command to the standard input of another command for further processing. In the example, the output of the grep command is piped to the ls command and the output displayed in the shell.List the files that contain the word access in their names.

assigned to the sales user for the analyst.txt file?ls –l analyst.txt-rwxrw-r-- sales staff 1028 May 28 15:50 analyst.txtread, write, executewrite onlyread onlyread, write

Task 1. Search for error messages in a log fileIn 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.Use grep to filter the server_logs.txt file, and return all lines containing the text string error.Note: If you enter a command incorrectly and it fails to return to the command-line prompt, you can press CTRL+C to stop the process and force the shell to return to the command-line prompt.

Task 1. Check file and directory detailsIn this task, you must explore the permissions of the projects directory and the files it contains. The lab starts with /home/researcher2 as the current working directory. This is because you're changing permissions for files and directories belonging to the researcher2 user.Navigate to the projects directory.List the contents and permissions of the projects directory.The permissions of the files in the projects directory are as follows:Note: The date and time information returned is the same as the date and time when you ran the command. Therefore, it is different from the date and time in the example.As you may recall from the video lesson, a 10-character string begins each entry and indicates how the permissions on the file are set. For instance, a directory with full permissions for all owner types would be drwxrwxrwx:The 1st character indicates the file type. The d indicates it’s a directory. When this character is a hyphen (-), it's a regular file.The 2nd-4th characters indicate the read (r), write (w), and execute (x) permissions for the user. When one of these characters is a hyphen (-) instead, it indicates that this permission is not granted to the user.The 5th-7th characters indicate the read (r), write (w), and execute (x) permissions for the group. When one of these characters is a hyphen (-) instead, it indicates that this permission is not granted for the group.The 8th-10th characters indicate the read (r), write (w), and execute (x) permissions for the owner type of other. This owner type consists of all other users on the system apart from the user and the group. When one of these characters is a hyphen (-) instead, that indicates that this permission is not granted for other.The second block of text in the expanded directory listing is the user who owns the file. The third block of text is the group owner of the file.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.