Linux (ubuntu) view hardware device command

linux view device command

system

# uname -a               # 查看内核/操作系统/CPU信息
 # head -n 1 /etc/issue   # 查看操作系统版本 
# cat /proc/cpuinfo      # 查看CPU信息
 # hostname               # 查看计算机名 
# lspci -tv              # 列出所有PCI设备
 # lsusb -tv              # 列出所有USB设备 
# lsmod                  # 列出加载的内核模块
 # env                    # 查看环境变量

resource

# free -m                # 查看内存使用量和交换区使用量 
# df -h                  # 查看各分区使用情况 
# du -sh <目录名>        # 查看指定目录的大小 
# grep MemTotal /proc/meminfo   # 查看内存总量
 # grep MemFree /proc/meminfo    # 查看空闲内存量
# uptime                 # 查看系统运行时间、用户数、负载 
# cat /proc/loadavg      # 查看系统负载
磁盘和分区

# mount | column -t      # 查看挂接的分区状态 
# fdisk -l               # 查看所有分区 
# swapon -s              # 查看所有交换分区
 # hdparm -i /dev/hda     # 查看磁盘参数(仅适用于IDE设备) 
# dmesg | grep IDE       # 查看启动时IDE设备检测状况

The internet

# ifconfig               # 查看所有网络接口的属性
 # iptables -L            # 查看防火墙设置 
# route -n               # 查看路由表 
# netstat -lntp          # 查看所有监听端口 
# netstat -antp          # 查看所有已经建立的连接
 # netstat -s             # 查看网络统计信息
进程

# ps -ef                 # 查看所有进程 
# top                    # 实时显示进程状态

user

# w                      # 查看活动用户 
# id <用户名>            # 查看指定用户信息 
# last                   # 查看用户登录日志 
# cut -d: -f1 /etc/passwd   # 查看系统所有用户 
# cut -d: -f1 /etc/group    # 查看系统所有组 
# crontab -l             # 查看当前用户的计划任务
服务

# chkconfig --list       # 列出所有系统服务 
# chkconfig --list | grep on    # 列出所有启动的系统服务

program

# rpm -qa                # 查看所有安装的软件包

Common commands are organized as follows:

Check the serial number of the motherboard: dmidecode | grep -i 'serial number'

Use the hardware detection program kuduz to detect new hardware: service kudzu start ( or restart)

View CPU information: cat /proc/cpuinfo [dmesg | grep -i 'cpu'][dmidecode -t
processor]

View memory information: cat /proc/meminfo [free -m][vmstat]

View board information: cat /proc/pci

View video/sound card information: lspci |grep -i 'VGA'[dmesg | grep -i 'VGA']

View NIC information: dmesg | grep -i 'eth'[cat /etc/sysconfig/hwconf | grep -i
eth][lspci | grep -i 'eth'] View PCI information: lspci (more than cat
/proc/pci intuitive)

View USB devices: cat /proc/bus/usb/devices

View keyboard and mouse: cat /proc/bus/input/devices

View system hard disk information and usage: fdisk & disk – l & df

View the interrupt request (IRQ) of each device: cat /proc/interrupts

View system architecture: uname -a

View and boot the system in 32-bit or 64-bit kernel mode: isalist –v [isainfo –v][isainfo –b]

dmidecode View hardware information, including bios, cpu, memory and other information

Determine the current monitor refresh rate: /usr/sbin/ffbconfig –rev \?

View system configuration: /usr/platform/sun4u/sbin/prtdiag –v

View the patches that have been applied in the current system: showrev -p

Display the current runlevel: who –rH

View the current bind version information: nslookup –class=chaos –q=txt version.bind

dmesg | more View hardware information lspci Display peripheral information, such as usb, network card and other information lsnod View loaded drivers lshw
psrinfo -v View the type and speed of the current processor (frequency) prtconf -v Print the current OBP version number iostat –E
View the physical information of the hard disk (vendor, RPM, Capacity) prtvtoc /dev/rdsk/c0t0d0s
View the geometric parameters and partition information of the disk df –F ufs –oi Display the number of used and unused i-nodes isalist –v

For the files in "/proc", you can use the file view command to browse their contents. The files contain system-specific information:
Cpuinfo host CPU information
Dma host DMA channel information
Filesystems file system information
Interrupts host interrupt information
Ioprots host I/O port number information
Meninfo host Memory Information
Version Linux memory version information

Remarks: proc – process information pseudo-filesystem process information fake file system

RPM

在Linux 操作系统中,有一个系统软件包,它的功能类似于Windows里面的“添加/删除程序”,但是功能又比“添加/删除程序”强很多,它就是 Red Hat Package Manager(简称RPM)。此工具包最先是由Red Hat公司推出的,后来被其他Linux开发商所借用。由于它为Linux使用者省去了很多时间,所以被广泛应用于在Linux下安装、删除软件。下面就 给大家介绍一下它的具体使用方法。

1. We get a new software. Before installation, we generally need to check what is in this package. Suppose this file is: Linux-1.4-6.i368.rpm, we can use this command to check:

rpm -qpi Linux-1.4-6.i368.rpm

The system will list the details of the package, including how many files it contains, the names of each file, file size, creation time, compilation date and other information.

2. All the files listed above are not necessarily all installed during installation. Just like the installation methods of programs under Windows are divided into typical, complete, and custom, Linux will also let you choose the installation method. At this time, we can use the following command to see which parts of the package will be installed on the system to facilitate our selection:

rpm -qpl Linux-1.4-6.i368.rpm

  1. After selecting the installation method, start the installation. We can install this software with the rpm-ivh Linux-1.4-6.i368.rpm command. During the installation process, if the system prompts that the software has been installed or cannot continue the installation for other reasons, but if we really want to execute the installation command, we can add a parameter "-replacepkgs" after -ivh:

rpm -ivh -replacepkgs Linux-1.4-6.i368.rpm

4. Sometimes we uninstall an installed software, just execute the rpm-e <file name>; command.

5. Upgrading low-level software is a good way to improve its functions, which saves us the trouble of uninstalling and then installing new software. To upgrade a software, just execute the following command: rpm -uvh <file name>; , Note: The file name at this time must be the upgrade patch of the software to be upgraded

  1. Another method of installing software can be described as a unique feature of Linux, and also a manifestation of the powerful function of RMP: install software directly online through an FTP site. When you find a site that contains the software you need and connect to this site, execute the following command to implement online installation. For example, to install Linux-1.4-6.i368.rpm online, you can use the command:

rpm -i ftp://ftp.pht.com/pub/linux/redhat/…-1.4-6.i368.rpm

  1. In the process of using the computer, it is inevitable that there will be misoperations. If we delete several files by mistake and affect the performance of the system, how to find out which files are missing? The RPM package provides a function to find damaged files. Execute this command: rpm -Va and Linux will list all corrupt files for you. You can fix it from the Linux installation CD.

8. There are many files in the Linux system. During use, it is inevitable to encounter files that we do not know. In Windows, we can use the "Start/Find" menu to quickly determine which folder a file belongs to. In Linux, the following This command line can help us quickly determine which package a file belongs to:

rpm -qf <filename>;

9. After each software package is installed in the Linux system, the installation files will be "registered" in the RPM database. Therefore, when we want to query the properties of an installed software, we only need to search in this database. Note: The query command at this time is different from the query introduced in 1 and 8. This method only works for installed packages! Command format:

rpm -parameter <filename>;

APT-GET

apt-get update - run this command after modifying /etc/apt/sources.list or /etc/apt/preferences. Also you need to run this command periodically to make sure your package list is up to date.
apt-get install packagename - install a new package (see aptitude below)
apt-get remove packagename - uninstall an installed package (keep configuration files)
apt-get --purge remove packagename - uninstall an installed package package (remove configuration files)
dpkg --force-all --purge packagename Some software is difficult to uninstall, and it also prevents the application of other software, you can use this, but it is a bit risky.
apt-get autoclean apt will back up the installed or uninstalled software on the hard disk, so if you need space, you can use this command to delete the software you have deleted
apt-get clean This command will restore the installed software The backup is also deleted, but this will not affect the use of the software.
apt-get upgrade -- update all installed packages
apt-get dist-upgrade -- upgrade the system to a new version
apt-cache search string -- search the package list for the string
dpkg -l package-name-pattern - List all packages matching the pattern. If you don't know the full name of the package, you can use " package-name-pattern ".
aptitude - View installed or available packages in detail. Similar to apt-get, aptitude can be invoked from the command line, but only with certain commands - the most common being install and uninstall commands. Since aptitude knows more than apt-get, it's arguably better for installing and uninstalling.
apt-cache showpkg pkgs - Show package information.
apt-cache dumpavail - prints a list of available packages.
apt-cache show pkgs - Show package records, similar to dpkg --print-avail.
apt-cache pkgnames - prints the names of all packages in the package list.
dpkg -S file - which installed package this file belongs to.
dpkg -L package - List all files in a package.
apt-file search filename - Finds packages (not necessarily installed) containing specific files with the specified string in the filename. apt-file is a standalone package. You must first install it with apt-get install, then run apt-file update. If apt-file search filename outputs too much, you can try apt-file search filename | grep -w filename (to display only those filenames where the specified string appears as a complete word) or similar, for example: apt-file search filename | grep /bin/ (only shows files located in folders such as /bin or /usr/bin, this is helpful if you are looking for a specific executable) .

Ubuntu version command
method Method 1:
Execute the following command in the terminal: cat /etc/issue
Method 2:
You can also use the lsb_release command to check the version number of Ubuntu. Compared with method 1, the content is more detailed.
The execution instructions are as follows: sudo lsb_release -a
Method 3:
Open the "System Monitor", select "System"
Ubuntu view version command
1. lshw The lshw
command displays detailed hardware information.
If you want to display it in a summary way, you can add the short parameter: lshw-short
To display the specified hardware information, add the class (or C) parameter: lshw -classmemory
2. sysstat
is a set of tools for monitoring system performance and efficiency. These tools are for We collect system performance data
such as CPU usage, hard disk and network throughput data.
3. lspci -v (more intuitive than cat/proc/pci) to
view PCI information, lspci is to read the hwdata database.
4. uname -a to
view the system architecture.
5. dmidecode
to view hardware information, including bios, cpu, memory and other information
6. dmesg
to display the kernel buffer system control information, such as system startup information will be written to /var/log/.
Note: The dmesg tool is not a tool specifically used to view the identification of the hardware chipset, but this tool allows us to know some parameters of the hardware in the machine; because the system will write some hardware-related logs to /var
when it starts up
/log/message* or /var/log/boot* files.
7. lshal and hal-device-manager
8. View /proc
For files in "/proc", you can use the file view command to browse their contents, the files contain system-specific information:
Cpuinfo Host CPU information
Dma Host DMA channel information
Filesystems File system information
Interrupts Host interrupt information
Ioprots Host I/O port number information
Meninfo Host memory information
Version Linux memory version information
View CPU information: cat /proc/cpuinfo View board information: cat /proc/pci View memory information: cat/proc/meminfo View USB device: cat /proc/bus/usb/devices View keyboard and mouse: cat /proc/bus/input/devices View interrupt request (IRQ) of each device: cat /proc/interrupts
Mainboard information:
sudo demidecode | grep -i 'serial number'

CPU信息:
cat /proc/cpuinfo
dmesg | grep -i ‘cpu’
sudo dmidecode -t processor

Hard disk information:
View partition status:
sudo fdisk -l

Check the size:
df -h

Check usage:
du -h
sudo hdparm -I /dev/sda
dmesg | grep sda

Memory info:
cat /proc/meminfo
dmesg | grep mem
free -m
vmstat
sudo dmidecode | grep -i mem

NIC info:
dmesg | grep -i 'eth'
lspci | grep -i 'eth'

ethtool -i eht0
ethhool -k eth0
ethtool -g eth0

View mouse and keyboard:
cat /proc/bus/input/devices

View the interrupt request (IRQ) of each device:
cat /proc/interrupts

Graphics card info:
lspci | grep -i 'VGA'
dmesg | grep -i 'VGA'

Sound card information:
Check the sound card model:
lspci | grep -i audio

Check the sound card driver module for model ac97:
modprobe -l | grep ac97

View sound card information:
cat /proc/asound/cards

Check out alsa-utils:
alsactl -v

Check the kernel alsa version:
cat /proc/asound/version

Sound card info:
aplay -l

Sound card for hardware information:
sudo lshw -C sound

Sound of module status:
lsmod | grep -i snd

alsa audio configuration:
alsamixer

Other commands:
dmesg
lspci
mpstat (install sysstat first: sudo spt-get install sysstat)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324929210&siteId=291194637