| File | Contents |
|---|---|
boot.log | Messages generated as services are started during the startup of the system. |
cron | Messages generated by the crond daemon for jobs to be executed on a recurring basis. |
dmesg | Messages generated by the Linux kernel. |
maillog | Messages produced by the mail daemon for e-mail messages sent or received. |
messages | Messages from the kernel and other processes that don’t belong elsewhere. Sometimes named syslog instead of messages after the daemon that writes this file. |
secure | Messages from processes that required authorization or authentication (such as the login process). |
journal | Messages from the default configuration of the systemd-journald.service; can be configured in the /etc/journald.conf file amongst other places. |
Xorg.0.log | Messages from the X Windows (GUI) server. |
Log file management
Rotating a log file means renaming the current log file to <logfile>.1 or something similar and then creating a new, empty log file in its place. This keeps a single log file from becoming too large to easily read.
| Command | Purpose | Usage |
|---|---|---|
| last | Reads /var/log/wtmp and lists the last few users to log in or out | last |
| lastb | Reads /var/log/btmp and lists the last few failed logins. Requires root permissions. | sudo lastb |
| top | Task Manager for the Linux terminal. | top |
| htop | top but better. | htop |
| jobs | Lists background jobs in the current terminal session. | jobs |
| Ctrl+z | Pauses the current program and sends it to the background, making it a job. | |
| bg | Un-pauses a program that was paused by jobs and runs it in the background. | bg to background the last program paused by Ctrl+zbg %1 to background job #1 |
| fg | Brings a program paused by jobs to the foreground and runs it. | Same as bg |
| ps | Shows running processes. By default, ps only shows processing running in the current terminal session. | psps -ef or ps aux to list all processes |
Process management
Every running process in Linux has a process ID or PID assigned to it. The first process to be started by the kernel, usually SystemD, is given a PID of 1.
Job control
Ctrl+z stops a program and sends it to the background.
Running bg makes that program keep running in the background.
Running fg brings that program to the foreground.
Running the jobs command lists all background programs in the current terminal.