
1、cat /proc/cpuinfo查看linux系统的CPU型号、类型以及大小,如下图所示。
2、通过greap命令根据Physical Processor ID筛选出多核CPU的信息。
3、cat /proc/meminfo查看linux系统内存大小的详细信息,可以查看总内存,剩余内存、可使用内存等信息。
4、df -h查看linux系统各分区的使用情况,要明确linux系统和windows系统分区的不同。
在大多数Linux套件中,硬件识别最常用的两个工具是Lspci和Lsusb。 Lspci工具可以显示所有PCI总线信息,并列出与它们相连的硬件设备。Lspci对于集成声卡和显卡的X86主板尤其有用,因为它可以识别使用在主板PCI电路中的确切芯片。 Lsusb工具可提供USB总线和连接设备的同类信息。 USB设备一般表示为 /dev/sda 或/dev/hda1 等等 如果是USB存储器,像硬盘分区那样直接挂载即可 mount /dev/sda /mnt/sdalinux下怎么查找usb对应的设备,比如鼠标....#include <stdio.h>#include <stdlib.h>#include <linux/input.h>#include <fcntl.h>#include <sys/time.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>int main(int argc,char **argv) { int fd, retvalchar buf[6]fd_set readfdsstruct timeval tv// 打开鼠标设备 fd = open( "/dev/input/mice", O_RDONLY )// 判断是否打开成功 if(fd<0) { printf("Failed to open \"/dev/input/mice\".\n")exit(1)} else { printf("open \"/dev/input/mice\" successfuly.\n")} while(1) { // 设置最长等待时间 tv.tv_sec = 5tv.tv_usec = 0FD_ZERO( &readfds )FD_SET( fd, &readfds )retval = select( fd+1, &readfds, NULL, NULL, &tv )if(retval==0) { printf( "Time out!\n" )} if(FD_ISSET(fd,&readfds)) { // 读取鼠标设备中的数据 if(read(fd, buf, 6) <= 0) { continue} // 打印出从鼠标设备中读取到的数据 printf("Button type = %d, X = %d, Y = %d, Z = %d\n", (buf[0] &0x07), buf[1], buf[2], buf[3])} } close(fd)return 0}欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)