-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsysinfo-archive
103 lines (80 loc) · 2.29 KB
/
sysinfo-archive
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Description: This script collects information, including hardware, software,
# network, and configuration details, and creates a compressed archive
# for analysis and troubleshooting.
# Dependency: tar
# Check if the script is executed with sudo because we are dealing with root files
if [[ $EUID -ne 0 ]]; then
echo "This script requires root privileges. Please run with sudo."
exit 1
fi
# Create a temporary directory
tmpdir="sysinfo-$(date +'%Y%m%d-%H%M%S-%Z')"
mkdir "$tmpdir" || exit $?
# Define a function to gather information and save it to a file
gather() {
file=$1
shift
bash -c "$*" >> "$tmpdir/$file.txt" 2>&1 || true
}
echo
echo -n "Gathering statistics ..."
# Gather system information using various commands
gather uname uname -a
gather uptime uptime
gather selinux sestatus
gather dmesg dmesg -T
# Partition information
gather df df -h
gather mount mount
gather fdisk fdisk -lu
gather fstab cat /etc/fstab
gather ps ps faux
gather sysctl sysctl -A
# GPU information
gather glxinfo glxinfo
gather nvidia-smi nvidia-smi -a
gather aticonfig aticonfig --odgt
# CPU information
#gather cpuinfo cat /proc/cpuinfo
gather cpuinfo lscpu lscpu
# Memory information
gather meminfo cat /proc/meminfo
# PCIe, USB, SCSI information
gather lspci lspci -v
gather lsusb lsusb -v
gather lsscsi lsscsi -s
gather grubline cat /proc/cmdline
gather lsmod lsmod
gather lshw lshw
gather dmidecode dmidecode
gather chkconfig chkconfig --list
# Blacklist information
gather blacklist cat /etc/modprobe.d/blacklist.conf
# Network information
gather netstat netstat -npl
gather ip-rules ip rule show
gather ip-routes ip route show
gather ifconfig ifconfig -a
gather route route -n
# Package information
gather dpkg-packages dpkg -l
gather rpm-packages rpm -qa
gather arch-packages-all pacman -Q
gather arch-packages-installed pacman -Qe
gather arch-packages-yay pacman -Qm
gather flatpak list
gather snap list
gather pip3 pip3 list
gather npm npm list -g --depth=0
gather brew brew list
echo "Done"
# Remove empty files
find . -type f -empty -delete
# Create a compressed archive of the system information
XZ_OPT=-e9 tar cJf "${tmpdir}.tar.xz" "$tmpdir"
# Remove the temporary directory
rm -rf "$tmpdir"
echo
echo "System information archive has been created: ${tmpdir}.tar.xz"
echo