• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

grep

Lastlog

March 6, 2019

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

Filed Under: Linux Tagged With: grep, info, lastlog, login, more

Checking Last Patch

March 1, 2019

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

Filed Under: Linux Tagged With: grep, kernel, rpm, uptime

Scan for Error, Warning and Panic

March 1, 2019

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

Filed Under: Linux Tagged With: errors, grep, more, panics, var log, warnings

  • Home
  • About
  • Search

Copyright © 2023