Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for grep

March 6, 2019

Lastlog

Lastlog displays the latest login information of all users in the system. You can’t view the lastlog file since it’s not an ascii file. You’ll need to run the actual command to view what’s in it. The program will spit out a list that may be longer than your terminal buffer. In that case, it’s best to pipe the output to “more” or better yet, use the “grep” command to isolate the user.

lastlog | more
lastlog | grep johndoe

lastlog | more lastlog | grep johndoe

March 1, 2019

Checking Last Patch

You can check when the system was last patch using the following.

# check RPM when the last updates were ran.
rpm -qa --last | grep kernel
# this is a bit of a stretch, but typically a reboot is performed after an upgrade.
uptime

# check RPM when the last updates were ran. rpm -qa --last | grep kernel # this is a bit of a stretch, but typically a reboot is performed after an upgrade. uptime

March 1, 2019

Scan for Error, Warning and Panic

Here’s a command to scan for any errors, warnings and panics on the system. If the file is too large, pipe it to more.

sudo grep -E -i -r 'error|warning|panic' /var/log
sudo grep -E -i -r 'error|warning|panic' /var/log >error-warning-panic.log
cat error-warning-panic.log | more

sudo grep -E -i -r 'error|warning|panic' /var/log sudo grep -E -i -r 'error|warning|panic' /var/log >error-warning-panic.log cat error-warning-panic.log | more

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021