You can use cat to read a full (log) file, or page it trough
more or
less, or open it in a text editor, or some other way. I prefer pagers. I assume you're talking about console usage here, and not a graphical desktop (for in a graphical desktop you could just open the logfile into a text editor).
Printing a whole file on your screen happens easily like this (note: if it's very long file, you'll only see the end of it):
Code:
cat /var/log/syslog
Actually cat (concatenate) can do much more, but it's a handy tool for reading files also. It can be used to concatenate and copy files, for example..
Logfiles usually reside under /var/log/ in UNIX systems, unless specified some other way. Let's use
less as the pager, as I prefer it to
more. Use whatever you want; if you have
most you could use that as well. For example to read the logfile
messages from
/var/log you would command
Code:
less /var/log/messages
and be able to use arrow keys to scroll trough the logfile. You could type
while in
less and press ENTER to search the next
searchword down the text, or
Code:
?another_searchword
to do a search upward. Press
q to quit.
There are some commands to get "log information" without reading the files yourself, too. One is
dmesg which provides information about what has happened since you booted (for example if you plug an usb stick in, some information pops up here):
you can page that too:
Then there is
for hardware information and so on..also see files under /proc/ if you want information from your kernel. /var/log is your primary place for system logfiles, though, like
messages,
syslog and many others.
You can also use
grep to see lines from a file that have a certain string in them, or only lines that don't have a certain string. For example, a
Code:
grep EE /var/log/Xorg.0.log
would show those lines from Xorg.0.log that contain EE (error lines). Likewise,
Code:
grep -v WW /var/log/Xorg.0.log
would only show lines that don't have WW in them.