我是否可以在运行Linux的二手笔记本电脑或PC上使用任何命令来告诉我系统是否有问题?如果是的话,他们是什么?
例如,电池寿命/状态、硬盘空间、坏扇区、RAM、总线速度、视频/音频硬件和驱动器规格、局域网卡规格等。
发布于 2016-03-02 05:31:18
让我们从头到下,这个指南不是发行版特定的(大多数这些命令将在大多数发行版上可用,要么是开箱即用,要么是通过软件包存储库),首先您可能想要得到硬件规范的大致布局。为此,您有几个选项:
所有的选择都是一样的:
inxi --admin --verbosity=7 --filter --width #<- Lists your complete system specs
lshw #<- Lists your complete system specs, sudo recommended
hwinfo > hwinfo.txt #<-Writes your hardware info in extreme detail to hwinfo.txt
所有的GUI选项都是这样的:
hardinfo #<- A pretty good GUI system information utility, also offers benchmarks.
i-nex #<- Similar to CPU-Z on windows
lshw-gtk <- GUI for lshw
有针对性的选择:
cat /sys/devices/virtual/dmi/id/board_{vendor,name,version} #<- Lists your motherboard details.
lspci -Q #<- Lists all your internal hardware and checks online for missing/updated names.
lspci -v | grep "VGA controller" #<- Displays your currently active graphics card. Very useful on laptops with hybrid/switchable graphics. (Typically this is the integrated card unless you have configured it otherwise)
lspci -v | grep "3D controller" #<- Displays your Nvidia Dedicated GPU. For laptops with hybrid/switchable graphics.
lspci -v | grep "Display controller" #<- Displays your ATI/AMD Dedicated GPU. For laptops with hybrid/switchable graphics.
lsusb #<- Lists all your USB hardware.
lscpu #<- Lists detailed processor info (alternative: cat /proc/cpuinfo )
fdisk -l #<- Lists your hard drives and partitions (may requires sudo access).
free -h --si #<- Lists your memory information, total is your total, available is your total free memory.
cat /proc/meminfo #<- Much more detailed info on your memory
ip link #<- lists your network devices and their status
让我们快速检查一下内核错误:
cat /proc/kmsg | grep -i Error #<-Lists errors detected by the kernel (often hardware related ones), probably requires sudo access.
现在我们已经知道了我们正在使用的是什么,我们将检查热辐射,大多数发行版默认没有安装lm_sensors
,lm_sensors通常是包名,但有时它可以是传感器。
它的引用方式如下:
sensors-detect #<-Detect sensors on your pc; you only need to do this once. Requires sudo.
sensors #<-Display current values for known sensors on your pc
在此之后,如果希望GUI实用程序监视这些传感器,则可以使用psensor
如果您想查看Nvidia GPU的临时程序或其他信息,并且安装了它的专有驱动程序,请运行nvidia-smi
。
接下来,我们将进行硬盘诊断,fsck在大多数linux发行版的引导下运行(它非常标准,运行在Linux上),以检查和修复硬盘错误和坏扇区,所以您几乎不需要这样做。fsck无法在挂载驱动器上运行,因此,如果您想进一步诊断硬盘驱动器,您将不得不从系统中启动,并使用第三方实用程序,如系统救援光盘(或另一个live /usb)或最终引导光盘。此外,smartmontools的SMART can可以用于运行智能测试,比如fsck,越深入的测试就不能在当前安装的驱动器上运行(但许多驱动器确实支持在脱机时自动运行这些测试)。无论如何,还有一些事情可以通过您的运行系统来完成。hdparm可用于分析和调整硬盘驱动器。
dd if=/dev/zero of=$HOME/testfile bs=1G count=1 conv=fdatasync oflag=direct #<- Measures throughput of your hard drive (whichever one has your home folder on it).
hdparm -Tt /dev/sdx #<- Gives read speed information on hard drive sdx. I won't cover this in more detail, but you can look for guides on it.
smartctl -Hic /dev/sdx #<- Gives basic info of hard drive sdx and runs an overall health assesment. (If the assessment fails either the drive has failed or is in the process of failing) it then lists the drives SMART capabilities.
smartctl -t short /dev/sdx #<- Runs a short SMART test (cannot be run on a mounted drive (some drives support offline data collection and can automatically run the test on shutdown))
为了更彻底地使用fio进行hdd基准测试,使用类似于windows用户可能熟悉的晶体磁盘标记( 见这个答案或使用kdiskmark
)的格式。
在内存测试中,要进行完整的内存测试,您很可能需要引导到内存测试实用程序(比如memtest86+,通常嵌入livecd,您也可以安装它并更新grub以显示它),但是在运行的linux环境中,您可以使用memtester。
memtester 1024 5 #<- Sets aside 1GB(1024MB) free memory, and runs tests on it 5 times, then displays results.
正确诊断LAN设备性能的最佳方法是不简单地测试它向另一个设备发送或接收数据的速度(和多大)。但要做到这一点,您可以使用iperf或netcat (nc)与dd (我们之前曾用于测试硬盘)结合使用。请注意,您实际上可以通过将服务器托管在您的计算机上,然后使用地址本地主机或127.0.0.1连接到您自己的网卡。
iperf -s #<- Starts iperf server (run this on the device you want to connect to, yes, as I said you need another computer for this)
iperf -c <address of server computer> #<- Connects and displays transfer rate information.
nc -vvlnp 12345 >/dev/null #<- Starts a netcat server (requires open firewall port for port 12345 if you have a strict firewall)
dd if=/dev/zero bs=1M count=1K | nc -vvn <server IP address> 12345
电池测试有两种选择。gnome-电池工作台(图形)或acpi (终端)或upower (终端)这些是示例命令:
acpi -ib #<- Lists battery status, basic specs and gives an idea of it's health (shows it's charge level last time it was "full")
upower -i /org/freedesktop/UPower/devices/battery_BAT0 #<- Should provide detailed battery information.
进行声音测试。我不知道你为什么要这么做,如果声音能工作,如果它不能工作,它不能工作,但是让我们用ALSA来做这件事(这样它就可以在所有的发行版上工作)。你需要一些有用的东西。
speaker-test -c 6 -t wav #<- Runs test sound on 6 speaker channels (for 5.1 speaker setup, you can use -c 2 for stereo speakers), just to see what happens.
speaker-test -r 96000 -f S32LE #<- Test stereo wav sound at 32-bit on 96khz frequencies. You can use this to test the maximum supported format and frequency (for example, while you sepcify 32-bit format, it may set to 16-bit format, if it does this then it will say so so read the output)
aplay -l #<- Lists sound output devices.
speaker-test -D hw:0,0 -c 4 -r 48000 -t wav #<- Test on specific hard ware device 0,0 at 4 channels with 48khz rate.
arecord -l #<- Lists recording devices.
arecord -f dat -d 20 -D hw:0,0 test.wav #<- Test specific recording device by outputting to a file in basic DAT quality
aplay -f dat test.wav #<- Play the recorded test file.
任何进一步的测试(CPU和GPU性能)都需要专门的基准测试/压力测试程序,或者启动到专门的测试环境中。下面是我建议的基准工具清单,除了前面提到的那些工具。与往常一样,对于图形基准测试,您希望确保禁用VSync。
最后,但同样重要的是,不要忘记,为了在测试中非常彻底,您将希望启动像终极启动CD这样的硬件测试引导cd,因为有很多事情不能从运行中的操作系统(至少不是有效的)完成。
https://unix.stackexchange.com/questions/266963
复制相似问题