Journalctl Tricks

journalctl command

vacuum / clean

journalctl --disk-usage
journalctl --vacuum-size=1G
--vacuum-size=BYTES   Reduce disk usage below specified size
--vacuum-files=INT    Leave only the specified number of journal files
--vacuum-time=TIME    Remove journal files older than specified time

read old journal

journcalctl --file /var/log/.../dsdsdsdsdsdsdsds.journal~

goto end of log

sudo journalctl -e
journalctl -e -u certbot.service
journalctl -xeu redis-server.service

list old boots

journalctl --list-boots

Alle Meldungen mit Kennzeichnung error, critical, alert oder emergency anzeigen

journalctl -p err -b

kernel messages only

journalctl -k -e
systemctl list-unit-files
systemctl --failed
# or
systemctl list-units --state=failed
journalctl -xb

Fish shell Add a directory to the path, but only if it exists

Add a directory to the path, but only if it exists.

function add_path_maybe -d "Add a directory to the path, but only if it exists"
    # If the path exists...
    if test -d $argv[1]
        # ...and if it's not already in the PATH...
        if not contains $argv[1] $PATH
            # ...push it to the start of the path.
            set PATH $argv[1] $PATH
        end
    end
end

journalctl uses a lot of space on my disk

The aswer is you can check the used size and you can shrink the used space.

journalctl --disk-usage
journalctl --vacuum-size=1G

Other Options are

--vacuum-size=BYTES   Reduce disk usage below specified size
--vacuum-files=INT    Leave only the specified number of journal files
--vacuum-time=TIME    Remove journal files older than specified time

Archive for category linux

Archives by Month: