Difference between revisions of "CentOS8 CheatSheet fuer System Administratoren"

From Bitbull Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
 
=SOS Report (Log Bundle)=
 
=SOS Report (Log Bundle)=
 
This collects a log bundle which can be used for later debugging and analyzing. <br>
 
This collects a log bundle which can be used for later debugging and analyzing. <br>
Line 6: Line 5:
 
  sosreport
 
  sosreport
 
  cp -av /var/tmp/sosreport* /root/
 
  cp -av /var/tmp/sosreport* /root/
 +
 +
==Block Devices (Disks)==
 +
* Show block uage of mounted disks
 +
df -hP
 +
 +
* Show inode uage of mounted disks
 +
df -hiP
 +
 +
* show how blockdevices are configured in system
 +
lsblk
 +
 +
* Show memory statistics
 +
free -th
  
 
=Services=
 
=Services=
 
 
* list all service units
 
* list all service units
 
  systemctl list-unit-files
 
  systemctl list-unit-files
Line 28: Line 39:
  
 
=Events=
 
=Events=
 +
 +
==Show last boots==
 +
journalctl --list-boots
 +
last reboot
  
 
==Journal==
 
==Journal==
Line 42: Line 57:
 
  tail -f -n0 /var/log/* /var/log/*/*
 
  tail -f -n0 /var/log/* /var/log/*/*
  
[[Category:Linux]]
 
[[Category:ReferenceCards]]
 
[[Category:Training]]
 
  
 
=CentOS 8 Stream migration=
 
=CentOS 8 Stream migration=
Line 54: Line 66:
 
  reboot
 
  reboot
  
 +
[[Category:Linux]]
 
[[Category:ReferenceCards]]
 
[[Category:ReferenceCards]]
[[Category:Linux]]
 
 
[[Category:Training]]
 
[[Category:Training]]

Revision as of 15:05, 11 December 2020

1 SOS Report (Log Bundle)

This collects a log bundle which can be used for later debugging and analyzing.
Start this BEFORE you try to repair or change something, as well do not forget to snapshot/backup System/Application before debugging.

dnf -y install sos
sosreport
cp -av /var/tmp/sosreport* /root/

1.1 Block Devices (Disks)

  • Show block uage of mounted disks
df -hP
  • Show inode uage of mounted disks
df -hiP
  • show how blockdevices are configured in system
lsblk
  • Show memory statistics
free -th

2 Services

  • list all service units
systemctl list-unit-files
  • show all services in failed state
systemctl --all --state=failed
  • show all running services
systemctl --all --state=running
  • show detailed service status
systemctl start <svc-name>
  • service handing
 systemctl [start|stop|restart|enable|disable|mask] <svc-name>
  • check if service is enabled to autostart after reboot
systemctl is-enabled <svc-name>

3 Events

3.1 Show last boots

journalctl --list-boots
last reboot

3.2 Journal

  • Follow all journal logs
journalctl -af
  • Follow all journal logs with severity error or higher
journalctl --priority err --catalog --boot --follow

3.3 Log Files

  • tail all currently open text files
lsof -F | sed '/^n\//!d;s/^n//;s/ .*//' | sort -u | xargs file | grep ' text$' | cut -d: -f1 | xargs tail -fn0
  • tail all files under /var/log
tail -f -n0 /var/log/* /var/log/*/*


4 CentOS 8 Stream migration

CentOS8 will be discontinued by the Red Hat team. All the effort will go into CentOS Stream operating System which is a rolling release of CentOS.
You can directly migrate a CentOS8 into a CentOS8 Stream in place:

dnf install centos-release-stream
dnf distro-sync
cat /etc/centos-release
reboot