There are multiple ways to view a log file using the Mac Terminal. Let's take a look at a few of them.
Option 1: Using cat command
cat /var/log/system.log
Sep 5 00:29:28 C2cs-MacBook-Air syslogd[121]: ASL Sender Statistics
...
...
This will display the content of the entire log file at once and if the file is huge, it is less convenient.
Option 2: Using less command
less /var/log/system.log
Sep 5 00:29:28 C2cs-MacBook-Air syslogd[121]: ASL Sender Statistics
...
...
You will see the contents of the file, one page at a time, and press the spacebar to view more.
Option 3: Using the tail command
tail -30 20230901_server.logs
If you are interested in what was added to the log file recently, then it is better to make use of the tail command with the number of lines that you want to display on the console.
Best Option: Follow the logs in real-time
Most of the time the use-case is to observe the logs in real-time to see what is happening on the server's end, in such case you can follow the logs using the tail command with a -f flag.
tail -f -30 20230901_server.logs

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!