When I sit down to a Linux system that I have not worked at yet I like to run a variety of commands to gather information about that system. 😎
This post shows each of those commands and provides a Bash script that will run all of them (minus top) and save a summary markdown file. ❣️
Note: The Bash scripts can be found at this repository on GitHub.
Commands
Here's the list of commands for a Debian system check:
cat /etc/os-releasehostnamectluptimeuname -aip -br -c a && ip -c rss -tulnwping -c 3 1.1.1.1systemctl statussystemctl --failedsudo apt-get checksudo dpkg --auditlsblklscpulshw -short- (optional)
lspci -tv topfree -hdf -hdu -sh /* 2>/dev/nulljournalctl -p 3 -xb- (Optional information for users)
whoamiwlast -asudo -l
CentOS modifications
If you want to do this on a CentOS system (or Fedora, RHEL, etc...) then switch out the following commands:
| Category | Debian Command (Current) | CentOS Command (New) | Reason |
|---|---|---|---|
| Package Manager Check | apt-get check |
dnf check (or yum check) |
CentOS uses RPM-based dnf/yum instead of APT. |
| Package Integrity Audit | dpkg --audit |
rpm -Va --nofiles |
Scans all installed packages for dependency errors or conflicts. |
| Service Status | systemctl status |
systemctl status |
No change. Both systems use systemd. |
| Listening Ports | ss -tulnw |
ss -tulpn |
Slight variation. CentOS usually lacks certain defaults, adding -p shows the process name. |
Arch Modifications
If you want to do this on an Arch-based system then switch out the following commands:
| Category | Debian Command | Arch Linux Command | Reason |
|---|---|---|---|
| Package Manager Check | apt-get check |
pacman -Qk |
Checks the integrity of all locally installed packages. |
| Package Integrity Audit | dpkg --audit |
pacman -D --check |
Scans the local package database for consistency errors or broken dependencies. |
| Service Status | systemctl status |
systemctl status |
No change. Arch uses standard systemd. |
| Listening Ports | ss -tulnw |
ss -tulnw |
No change. Standard iproute2 behavior matches Debian. |
Bash script (for Debian)
- See the file
sys_audit_debian.sh - Set permissions:
chmod +x sys_audit_debian.sh - Run it!
./sys_audit_debian.sh
💻
Scripts can be found at this repository on GitHub.
Bash script (for CentOS)
- See the file
sys_audit_centos.sh - Set permissions:
chmod +x sys_audit_centos.sh - Run it!
./sys_audit_centos.sh
Note: Minimal CentOS installations do not always include lshw by default. The script handles this gracefully, but if you notice that section is blank on your CentOS system, you can easily install it by running:sudo dnf install lshw -y
Bash script (for Arch)
- See the file
sys_audit_arch.sh - Set permissions:
chmod +x sys_audit_arch.sh - Run it!
./sys_audit_arch.sh
Note: A fresh Arch installation usually does not include lshw or lspci (part of pciutils) by default. If those sections turn up blank in your report, you can easily install them using:sudo pacman -S lshw pciutils --noconfirm