Linux Journal September 2026

qotd: “f yourself!” – gigi murin

qotd: “f yourself!” – gigi murin

  • grep
    • echo -e “abc\nedf” | grep d -> edf
      • -e for escaping backlash
      • grep return all matching character along with content of their lines
      • | (pipe symbol) will take the output of the previous command and use it as the input for the next command
    • echo -e “abc\ndef” | grep -v d -> abc
      • -v reverse the output meaning rather than returning all the instances where the certain character exist, it’ll give only lines where the a character is not there
    • rather than cat, use grep -> grep “error” /some/path
      • chain with -v -> grep “error” /some/path | grep -v dotnet
      • add wc to count word characters
    • -n flag to add a number line for each result
      • grep “error” /var/log/syslog | grep -n apparmor
    • by default most linux command are case sensitive, add -i to make case insensitive
      • grep “error” /var/log/syslog | grep -ni apparmor
    • using grep with special characters:
      • example: cat /var/log/syslog | grep Can’t update
        • single quote in a string interpreted the character as an opening quote and expected there a closing quote. and even without single quote it will failed because of space
        • simply using double quote cat /var/log/syslog | grep “Can’t”

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *