TIL: logrotate!

Logrotate is a system utility that manages the automatic rotation and compression of log files. 1 2 logrotate --version man logrotate Configuration can be found generally in two places: /etc/logrotate.conf: contain some default settings, sets up rotation for a few logs that are not owned by any system packages. Also uses an include statement to pull in configuration from any file from the logrotate directory. /etc/logrotate.d: files for packages. By default, logrotate.confwill configure weekly log rotations, with log files owned by the root user and the syslog group., with four log files being retained at a time (rotate 4) and new empty log files being created after the current one is rotated (create). ...

May 10, 2023 · Loknath Dhar

TIL: journalctl!

jounralctl is the command line tool that let us interact with the journal logs. Default location of journald logs is /var/log/journal directory. Type journalctl in the terminal, it will show the journal logs in chronological order. journalctl --no-pager will display entire logs directly on the screen. journalctl -n 25: will display most recent 25 lines of the logs. journalctl -f: view logs in real time. jouralctl --utc: display logs in UTC time. journalctl -k: display only kernel logs. All Journal logs Use sudo to see all journal logs. ...

April 30, 2023 · Loknath Dhar

TIL: systemctl!

Service management 1 2 3 4 5 6 7 8 9 10 11 12 13 sudo systemctl start app.service sudo systemctl stop app.service sudo systemctl restart app.service sudo systemctl reload app.service sudo systemctl reload-or-restart app.service sudo systemctl enable app.service sudo systemctl disable app.service Checking status 1 2 3 4 5 6 7 systemctl status app.service systemctl is-active app.service systemctl is-enabled app.service systemctl is-failed app.service System state overview 1 2 3 4 5 6 7 8 9 10 # see a list of active units systemctl list-units systemctl # returns same as above systemctl list-units --all systemctl list-units --all --state=inactive systemctl list-units --type=service To see every available units in the system paths (including those that systemd has not attempted to load): ...

March 20, 2023 · Loknath Dhar

TIL: man pages!

man - display a program’s manual page. 1 man program # program is the name of the command On most Linux systems, man uses less to display manual page. The manual that man displays is broken into sections and covers not only user commands but also system administration commands, programming interfaces, file formats and more. Man page organization: Section Contents 1 user commands 2 programming interfaces for kernel system calls 3 programming interfaces to the C library 4 special files such as device nodes and drivers 5 file formats 6 games and amusements such as screen savers 7 Miscellaneous 8 System administration commands 9 Obscure kernel specs and interfaces 1 2 3 man section search_item man 5 passwd Refer to a specific section of the manual to find what we are looking for. ...

October 13, 2022 · Loknath Dhar