How to Delete Old Journal Logs in Ubuntu
If you’re running Ubuntu, you might accumulate a large amount of journal logs over time. These logs can take up valuable disk space. Fortunately, you can easily delete old journal logs to free up space on your system. Here’s how you can do it using the journalctl
command with the --vacuum-time
option.
Deleting Old Journal Logs
To delete old journal logs in Ubuntu, follow these steps:
-
Open a terminal window. You can do this by pressing
Ctrl+Alt+T
or searching for “Terminal” in the application menu. -
In the terminal, use the
journalctl
command with the--vacuum-time
option to specify the time period for which you want to keep the logs. For example, to delete journal logs older than 30 days, you can run the following command:1
sudo journalctl --vacuum-time=30d
The
30d
parameter specifies that logs older than 30 days should be deleted. You can adjust the number of days to your preference. -
You will be prompted to confirm the action. Type
y
and press Enter to proceed with the deletion. -
The command will clean up the old journal logs, and you’ll see a summary of how much disk space was freed.
Checking Disk Space Usage
If you want to check how much disk space your journal logs are currently occupying before and after the cleanup, you can use the journalctl
command with the --disk-usage
option:
|
|
This command will display the current disk usage of your journal logs.
That’s it! You’ve successfully deleted old journal logs on your Ubuntu system, freeing up disk space in the process. Regularly cleaning up old logs can help keep your system running smoothly and prevent unnecessary disk space usage.