Viewing the Contents of Text Files
To see a text file at once use: cat
To see a text file one screen at a time use: less
Examples:
cat list.txt
cat *.txt
less long_file
These commands only work properly with plain text files! For images and
documents created by programs like Word, Excel, etc. you have to some
other application to see them. In most cases giving the filename as an
argument to the open
command will open the file in an
appropriate application.
Tasks:
- When
would you want to dump a file all at once vs. a screen-at-a-time?
Tips:
- Use the head command to see the beginning of a file.
- Use the tail command to see just the end of a file.
- Use tail -f to 'follow' a file as it grows - goof for log files.