Reading Larger Files

The cat command reads small files nicely. But as you learned in Redirecting Streams of Text, some files are too large to read with cat because they scroll off the screen, so you can use the more command to display a file one page at a time. Let’s review that command to explore the contents of the system log, the log that holds messages from various applications and operating system processes.

On Ubuntu, you’ll find this in /var/log/syslog:

 $ ​​more​​ ​​/var/log/syslog

On macOS, the system log is located at /var/log/system.log instead:

 $ ​​more​​ ​​/var/log/system.log

The first page of the file will display on the screen. Press the Enter key to see the next line of the file, and the Spacebar key to jump to the next ...

Get Small, Sharp Software Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.