MISSION 389

File Inspection

Towards the end of the Getting Help and Reading Documentation, we used less to have the command line read through the contents of a text file. This can be helpful for times when you want to quickly glance at a text file. With all things, there is more than one way to do something; the command line is definitely no exception to this.

In this mission, you will learn how to preview text files using the head and tail commands, as well as pretty-printing. You may be familiar with the head and tail dataframe attributes in pandas, and these commands act the same exact way. You’ll be able to apply them in the terminal in much the same way you might when writing pandas code. 

When learning about head and tail, you will also learn about option-arguments, options that are passed as arguments to a command or commands. These arguments are also mentioned in Introduction to Command Line, but you will get a more in-depth explanation and further practice in this mission.

You will also learn how to extract random lines from a file using the shuf command. This can be helpful especially if the file is large, which is often the case in data science, since you may be manipulating files containing massive datasets.

What You'll Learn

  • How to see the contents of files
  • Different file types
  • Options-arguements

Mission Outline

1. Text Files
2. Head or Tail
3. Option-arguments
4. Counting Lines
5. Pretty Printing
6. File Sample
7. Types of File
8. Next Steps
9. Takeaways

text-processing-cli

Course Info:

Intermediate

The median completion time for this course is 4 hours. View Details

This course requires a basic subscription and has five mission. It is the tenth course in the Data Analyst in Python path and Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside