Let's learn: logrotate!

Logrotate is a system utility that manages the automatic rotation and compression of log files. 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....

May 10, 2023 · 2 min · 287 words · by Loknath

Let's learn: 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....

April 30, 2023 · 3 min · 452 words · by Loknath

Let's learn: systemctl!

Service management 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 systemctl status app.service systemctl is-active app.service systemctl is-enabled app.service systemctl is-failed app.service System state overview # 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 · 3 min · 446 words · by Loknath

Let's learn: Vim/NeoVim!

Syntax: vim filename. Movement Navigating h /j/k/l : C-U/C-D : half-page up/down. C-B/C-F : page up/down. H : move to top of the screen. M : move to middle of the screen. L : move to bottom of the screen. Words b/w : previous/next word. ge/e : previous/next end of word. gj : move cursor down (multi-line text). gk : move cursor up (multi-line text). Line $ : to the end of the line (including last character)....

February 8, 2023 · 3 min · 443 words · by Loknath

Let's learn: Wildcards!

Wildcards (also known as globbing) allows us to select filenames based on patterns of characters. Wildcard Meaning * matches any character ? matches any single character [characters] matches any character that is a member of the set characters [!characters] matches any character that is not a member of the set characters [[:class:]] matches any character that is a member of the specified class Commonly used character classes: Character class meaning [:alnum:] matches any alphanumeric character [:alpha:] matches any alphabetic character [:digit:] matches any numeral [:lower:] matches any lowercase letter [:upper:] matches any UPPERCASE letter Examples [[:upper:]]* : Any file beginning with an uppercase letter....

January 18, 2023 · 1 min · 146 words · by Loknath

Let's learn: grep!

grep: Global Regular Expression print. grep is a powerful program used to find text patterns within files. It uses regular expressions (shortly regex) to match the pattern. When grep encounters a pattern in the file, it prints out the lines containing it. If no file is given, it will search recursively search the given pattern in the files in current directory. grep pattern [file...] grep <search-pattern> file.txt To show the line number in the output, use -n option: grep -n <search-pattern> file....

December 13, 2022 · 1 min · 198 words · by Loknath

Let's learn: less!

The less command is a program to view text files. Example: less filename less /etc/passwd Some action commands for less: Command Action Page Up or b Scroll back one page Page Down or space Scroll forward one page Up Arrow Scroll up one line Down Arrow Scroll down one line G Move to the end of the text file g or 1G Move to the beginning of the text file /characters search forward to the next occurrence of characters n search for the next occurrence of the previous search h display help screen q quit less less is more

November 13, 2022 · 1 min · 99 words · by Loknath

Let's learn: man pages!

man - display a program’s manual page. 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 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 · 1 min · 166 words · by Loknath