Linux is a very reliable operating system that helps the users to quickly take care of all the system issues. As Linux maintains system logs in the log directory. Also, these logs are stored in the same directory and categorized accordingly. It is very easy to access the system logs in the terminal. You will need to find out the files individually with quick and easy navigation.
Use Terminal to Access System Logs
All you need is to navigate to the log directory and view all the files inside the log directory. Logs are easily accessible by all the users. No matter if you are a simple user or have root access. Log files are placed in the /var/log/ directory.
To navigate the log files, launch the terminal window using Ctrl + Alt + T or Ctrl + Shift + T hotkeys. Now in command line window, make use of cd command to open a directory from the home directory i.e.
Once you are in the log directory, use ls (LS) command to view the subdirectories inside the files. It will print the entire list of files and folders in the logs
Once you’ve made it into the log directory on the system, you’ll need to make use of the LS command to view all of the individual sub-directories and files in /var/log/.
From the list, you need to choose the file to view and take note of the filename. Use the cat command and get a look at the contents of the log files
sudo cat error_log
error_log is the name of the log file you want to open.
In case you want to view a log file in the subdirectory then you must open the folder for a specific application.
cd application_folder_name ls sudo cat error_log
You can easily copy the files for using them outside the terminal using the cp command.
To save the log files, create a new folder in the documents i.e.
mkdir -p ~/Documents/system-logs/
Copy the log files of the log file
cp error_log ~/Documents/
It is also possible to copy the log folders using /var/log/ using the cp command and the r (recursive) switch.
Access Log files using GUI
If you are using the Linux with the GUI, you can access the logs in a more easy and quick way. Accessing logs from GUI is even more quick, easy and reliable. It feels more comfortable when sorting error logs by the category i.e. application, hardware, and security. Also, you can export the logs to a file as well as search from the log entries.
Installing Gnome Logs
For installing the Gnome Logs, open terminal using Ctrl + Alt + T or Ctrl + Shift + T hotkeys. Now follow the instructions according to the Linux version:
Gnome Logs for Debian
sudo apt-get install gnome-logs
Gnome Logs for Ubuntu
sudo apt install gnome-logs
Gnome Logs for Arch Linux
sudo pacman -S gnome-logs
Gnome Logs for Fedora
sudo dnf install gnome-logs
Gnome Logs for OpenSUSE
sudo zypper install gnome-logs
Viewing the Error Messages in Gnome
Gnome Logs are very easy to use and simple enough to be understandable by all the users. The application opens and provides support for the latest error log file. It will view the older log files, click on the arrow button and use the menu to view the older error logs.
View Category Logs
Gnome Logs provides complete support for sorting the log files according to the category. The searching feature enables you to quickly access the log you need. Just write the search query in the search field from the magnifier glass.
Exporting the Error Logs to a File
Exporting the error logs to the file is very easy, here is how you can do it:
- Choose the log file you want to view.
- Click the Export button to on the side of the magnifying glass icon.
- Use the file browser to save the log file to the system