Artificial Intelligence (AI) & Machine Learning Course for ManagersEnroll Now
To see what is inside a text file, you can use either cat, tail, head.
Using cat you can see the whole content of the file:
Do not use this command to look inside a huge file. For the huge file, you can use the more command which would display the content of a file in a paginated way:
tail shows you the last few lines of a file
By default tail shows you only last 10 lines, you can change it using command line option. For example, to see last 20 lines, you can use
tail -20 myfirstfile_copy.txt
If you want to chase a file - continuously print newlines appended to the file - use the command:
tail -f myfirstfile_copy.txt
If you are interested in first few lines, you can use head. By default By default head shows you only first 10 lines, you can change it using command line option. For example, to see first 20 lines, you can use
head -20 myfirstfile_copy.txt
Taking you to the next exercise in seconds...