Day 8 - Logs and Text Processing in Linux

On Day 8, I explored the powerful world of Linux log files and text processing commands. These are essential for DevOps, sysadmin tasks, debugging, and automation.

๐Ÿ” What I Learned Today

๐Ÿ”น Working with Logs

  • Viewed and followed log output:

        tail -f /var/log/messages
        tail -f /var/log/yum.log
        less +F yum.log
    
  • Navigated configuration files:

      grep -i firewall anaconda-ks.cfg
      grep -R SELINUX /etc/*
      vim /etc/selinux/config
    

    Text Exploration Tools

  • Viewers: cat, less, more, head, tail

  • Search & Filter:

grep -i firewall anaconda-ks.cfg
grep -R selinux /etc/
  • Field Extraction:

      cut -d: -f1 /etc/passwd   # usernames
      cut -d: -f3 /etc/passwd   # UIDs
      awk -F':' '{print $1}' /etc/passwd
    

    Text Manipulation with sed

    • Edited files inline:

        sed -i 's/coronavirus/covid19/g' samplefile.txt
        sed -i 's/covid19/nothing/g' samplefile.txt
      

      Key Learnings

      • How to monitor live log output (tail -f)

      • Use cut, awk, and grep to extract structured text

      • Automate bulk text replacements with sed

      • Investigated system config files (/etc/passwd, anaconda-ks.cfg, SELinux configs)


๐Ÿง  This knowledge will help in:

  • Reading audit logs

  • Debugging boot issues

  • Managing users and services

  • Automating file edits in pipelines

0
Subscribe to my newsletter

Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shaharyar Shakir
Shaharyar Shakir