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
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
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
1. Text Files
2. Head or Tail
4. Counting Lines
5. Pretty Printing
6. File Sample
7. Types of File
8. Next Steps