Lspci | Grep-i FileName

Source: Internet
Author: User
Tags joins readable regular expression
$ Lspci |grep VGA

00:02.0 VGA compatible Controller:intel Corporation 4th Gen Core Processor Integrated Graphics Controller (Rev 06)

function : The command function: The output of the LSPCI as input, from which to find the line containing the VGA


Add:

PCI is the abbreviation for peripheral Component Interconnect (peripheral interconnect) and is commonly used as a peripheral bus on desktops and larger computers. The PCI architecture is designed as a replacement for the ISA standard, with three main goals: better performance when transferring data between computers and peripherals, as platform-agnostic as possible, and simplifying the task of adding and removing peripherals to the system.

LSPCI Command:

Lspci is a tool used to display all PCI bus devices in the system or all devices connected to the bus.

Option-N: Displays PCI vendor and device code numerically;-T: Displays hierarchical relationships of PCI devices in a tree structure, including all buses, bridges, devices, and joins between them;-B: A bus-centric view;-D: Displays information only for a given vendor and device;-S: Displays only the specified bus, The function block information on the device and device on the slot;-I: Specifies the PCI numbered list file instead of the default file;-M: Displays the PCI device information in a machine-readable manner.

From: Http://man.linuxde.net/lspci option-N: Displays the PCI vendor and device code numerically;-T: a tree-like hierarchy of PCI devices, including all buses, bridges, devices, and joins between them;-B: Bus-centric view ;-D: Displays information only for a given vendor and device;-S: Displays only the function block information on the specified bus, the device on the slot, and the device;-I: Specifies the PCI numbered list file instead of the default file;-M: Displays the PCI device information in a machine-readable manner.

From: Http://man.linuxde.net/lspci option-N: Displays the PCI vendor and device code numerically;-T: a tree-like hierarchy of PCI devices, including all buses, bridges, devices, and joins between them;-B: Bus-centric view ;-D: Displays information only for a given vendor and device;-S: Displays only the function block information on the specified bus, the device on the slot, and the device;-I: Specifies the PCI numbered list file instead of the default file;-M: Displays the PCI device information in a machine-readable manner.

From: http://man.linuxde.net/lspci-n: Digital display of PCI vendor and device code;-T: Displays hierarchical relationships of PCI devices in a tree structure, including all buses, bridges, devices, and joins between them;-B: A bus-centric view; D: Display only information for a given manufacturer and device;-S: Displays only the function block information on the specified bus, the device on the slot, and the device;-I: Specifies the PCI numbered list file instead of the default file;-M: Displays the PCI device information in a machine-readable manner.

From: http://man.linuxde.net/lspci-n: Digital display of PCI vendor and device code;-T: Displays hierarchical relationships of PCI devices in a tree structure, including all buses, bridges, devices, and joins between them;-B: A bus-centric view; D: Display only information for a given manufacturer and device;-S: Displays only the function block information on the specified bus, the device on the slot, and the device;-I: Specifies the PCI numbered list file instead of the default file;-M: Displays the PCI device information in a machine-readable manner.

From: http://man.linuxde.net/lspci-n: Digital display of PCI vendor and device code;-T: Displays hierarchical relationships of PCI devices in a tree structure, including all buses, bridges, devices, and joins between them;-B: A bus-centric view; D: Display only information for a given manufacturer and device;-S: Displays only the function block information on the specified bus, the device on the slot, and the device;-I: Specifies the PCI numbered list file instead of the default file;-M: Displays the PCI device information in a machine-readable manner.

From: Http://man.linuxde.net/lspciOptions


Example:

1. Do not add any options, you can display the current hardware equipment;

2. View general Details: lspci-v

3. View NIC Details: Lspci-s 03:02.0-vv//-s is followed by the bus, slot, and correlation function functions of each device (-VV is two v)

4. LSPCI |grep Ethernet View NIC model


grep command:

The grep command in a Linux system is a powerful text Search tool that uses regular expressions to search for text and print matching lines . The grep full name is global Regular expression Print, which represents the globally regular expression version, and its use rights are for all users.

Format
grep [Options]

Main parameters
[Options] Main parameters:
-C: Outputs only the count of matching rows.
-I: Case insensitive (only for single-character).
-H: The file name is not displayed when querying multiple files.
-L: only file names that contain matching characters are output when querying multiple files .
-N: Displays matching lines and line numbers.
-S: does not display error messages that do not exist or have no matching text.
-V: Displays all lines that do not contain matching text.

Pattern Regular Expression Main parameters:
\: Ignores the original meaning of special characters in regular expressions.
^: matches the start line of the regular expression.
$: Matches the end line of the regular expression.
\<: Starts from the line that matches the regular expression.
\>: End of line to match regular expression.
[]: A single character, such as [a], a meets the requirements.
[-]: range, such as [A-z], i.e. A, B, C to Z all meet the requirements.
。 : all the individual characters.
*: There are characters, the length can be 0.


The grep command uses a simple instance
$ grep ' test ' d*
Displays all rows that contain test in a file that begins with D.

$ grep ' test ' AA bb cc
Displays the line that matches test in the aa,bb,cc file.
$ grep ' [a-z]\{5\} ' AA
Displays all rows that contain a string of at least 5 consecutive lowercase characters for each string.
$ grep ' w\ (es\) T.*\1′aa
If West is matched, es is stored in memory, labeled 1, and then searched for any character (. *) followed by another ES (\1), which is found to display the row. If you use Egrep or GREP-E, you do not have "\" number to escape, directly written as ' W (es) t.*\1′ on it.


Here are some interesting command-line arguments:
Grep-i pattern Files: Search by case-insensitive. The default case is case-sensitive,
Grep-l pattern Files: Lists only the matching file names,
Grep-l pattern Files: Lists mismatched file names,
Grep-w pattern files: matches only the entire word, not part of the string (such as matching ' magic ', not ' magical '),
Grep-c number pattern files: matching contexts display [number] lines, respectively,
grep pattern1 | PATTERN2 files: Displays rows that match pattern1 or pattern2.
grep pattern1 Files | grep pattern2: Displays rows that match both PATTERN1 and pattern2.

Grep-n pattern files to display line number information

Grep-c pattern files to find total rows


Reference documents:

Http://www.cnblogs.com/end/archive/2012/02/21/2360965.html (grep)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.