IMPORTANT:AttackDefense Labs is included with a Pentester Academy subscription! Upgrade Now to access over 1800+ Labs.

Already a Pentester Academy student? Your access will continue uninterrupted. Please use the same Google account to login here.

Not a Pentester Academy student? Try our Free Communitiy Labs

Text File Analysis

linux-security-linux-basics-basics | Level: Easy  | Total Lab Runs: 0 | Premium Lab

Lab Scoreboard

Lab Walkthrough Video:


Text-based files are used widely in the OS for storing data, configuration etc. For a typical Linux user analysis and manipulation of such files is daily work.


Objective: Learn about text file analysis and manipulation by doing the following activities on apache_access.log file. The file is present in the home directory of the student user.

  1. Check the contents of the file.

  2. Print first 10 lines of the file

  3. Print last 10 lines of the file

  4. Print the lines containing the text string “jp_hotel". 

  5. How many lines contains the text string “jp_hotel"? 

  6. How many lines doesn’t contain the text string “css"?

  7. Print only the first column for the last 5 lines using cut utility.

  8. Print timestamp column for last 5 lines using cut utility.

  9. Print only IPs from the file using awk utility.

  10. Print only sorted IPs (ascending order) from the file.

  11. Print only unique IPs from the file.

  12. Print the last 5 lines and replace the space character (' ') with underscore character ('_') using tr utility.

  13. Create a CSV file from the log file using tr utility.

  14. Replace all occurrences of string 'iPad' with 'Apple iPad' in the file using sed utility. 

The following activities are strictly prohibited on this website unless otherwise explicitly stated as allowed in the mission statement:

  • Using automated scanners
  • Using brute force attacks
  • Denial of Service attacks
  • Attacking other student machines in challenges where you might achieve a shell on the vulnerable system
  • Attacking the lab infrastructure

Users violating the above will be either temporarily or permanently banned from the website. 

If you are unsure about an activity, then please contact support to confirm that it is allowed on our website.

Technical Support for this Lab:

There is a reason we provide unlimited lab time: you can take as much time as you need to solve a lab. However, we realize that sometimes hints might be necessary to keep you motivated!

We currently provide technical support limited to:

  • Giving hints for a lab exercise
  • In rare circumstances, if you have totally given up (NO!!!) then tell you how to solve it. This will be limited to sharing the solution video or lab report
  • A lab exercise fails to load or has errors in it

If you need technical support, please email  attackdefense@pentesteracademy.com  clearly mention the name and link of the lab exercise and other essential details. The more descriptive you are, the faster we can help you. We will get back to you within 24 hours or less. 

For adminitrative queries, billing, enterprise accounts etc. please email feedback@binarysecuritysolutions.com