Friday, March 24, 2017

Getting installed services in RHEL

Today I was asked how you could discover those services that are installed on a system.

For packages installed today;
rpm -ql $(rpm -qa --last | 
grep "$(date +'%a %d %b %Y')" | 
awk '{print $1}') | 
grep systemd | 
grep service | 
awk -F"/" '{print $NF}' | 
grep -v '@'

From the beginning of time;
rpm -ql $(rpm -qa --last | 
awk '{print $1}') | 
grep systemd | 
grep service | 
awk -F"/" '{print $NF}' | 
grep -v '@'

From using these you can then ask which are enabled on start up;

systemctl list-unit-files --type=service |
grep enabled |
egrep $(
  rpm -ql $(rpm -qa --last | 
  grep "$(date +'%a %d %b %Y')" | 
  awk '{print $1}') | 
  grep systemd | 
  grep service | 
  awk -F"/" '{print $NF}' | 
  grep -v '@' | 
  tr '\n' '|' | 
  sed 's/|$//'
)

No comments:

Post a Comment