What is grep?

-Utility designed for searching plain-text data sets for lines that match a regular expression. Global regular expression print.

Where is grep? The location of grep can be found using the which command

username@computername ~ % which grep

/usr/bin/grep

What can be done with grep? Grep can filter information from the computer and report back all lines that include the characters that are searched for.

Looking for a Serial Number within System Profiler on a mac:

username@computername ~ % system_profiler | grep "Serial Number"

              Serial Number: H34D1NXKLKKT
          Display Serial Number: FKFG6T2     
      Serial Number (system): C02DP4YSML7H
    | |   |       |       |   |   "USB Serial Number" = "000080300012509A2606402E"
    | |   |       |       |   |     "USB Serial Number" = "000080300012509A2606402E"
    | |   |       |       |   | |   "USB Serial Number" = "000080300012509A2606402E"
    | |   |       |       |   | |   "USB Serial Number" = "000080300012509A2606402E"
    | |   |       |           |   "USB Serial Number" = "T9T1-005-C9829CB"
    | |   |       |           | |   "USB Serial Number" = "T9T1-005-C9829CB"
    | |   |       |       |   |   "USB Serial Number" = "00000000"
    | |   |       |       |   | |   "USB Serial Number" = "00000000"
    | |   |       |       |   | |   "USB Serial Number" = "00000000"
    | |   |       |       |   | |   "USB Serial Number" = "00000000"
    | |   |       |       |   | |   "USB Serial Number" = "00000000"
    | |   |               |   |   "USB Serial Number" = "0800086914F9"
    | |   |               |   | |   |   "USB Serial Number" = "0800086914F9"
    | |   |               |   | |   | |   "USB Serial Number" = "0800086914F9"
    | |   |               |   | |   "USB Serial Number" = "0800086914F9"
    | |   |   |   |   "USB Serial Number" = "00008101000349113468001E"
    | |   |   |   |     "USB Serial Number" = "00008101000349113468001E"
    | |   |   |   | |   "USB Serial Number" = "00008101000349113468001E"
    | |   |   |   | |   "USB Serial Number" = "00008101000349113468001E"
    | |   |   |   | |   "USB Serial Number" = "00008101000349113468001E"
    | |   |   |   |   "Serial Number" = "C020456007RP9KC13"
    | |   |   |     |   "Device Characteristics" = {"Serial Number"="C020456007RP9KC13","Medium Type"="Solid State","Product Name"="APPLE SSD AP0512N","Vendor Name"="","Product Revision Level"="1274.40."}
    | |   |   |   | |   |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |     |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   |   "USB Serial Number" = "CC203826CMNJ3Y373"
    | |   |   |   | |   | |   "USB Serial Number" = "CC203826CMNJ3Y373"
    | |   |   |   | |     |   "USB Serial Number" = "CC203826CMNJ3Y373"
    | |   |   |   | |   |   "USB Serial Number" = "000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "000000000000"
    | |   |   |   | |   |   "USB Serial Number" = "000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "000000000000"
    | |   |   |   | |   |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   | |   | |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   | |   | |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   | |   | |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   | |   | |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   | |     |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   | |   |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "0000000000000000"
    | |   |   |   | |   | |   "USB Serial Number" = "0000000000000000"
    | |   | | |   "USB Serial Number" = "CC203826CMNJ3Y373"
    | |   | | |   "USB Serial Number" = "000000000000"
    | |   | | |   "USB Serial Number" = "0000000000000000"
    | |   | | |   "USB Serial Number" = "000000000000"
    | |   | | |   "USB Serial Number" = "0000000000000000"
    | |   | | |   "USB Serial Number" = "0000000000000000"
    | |   |   |   "USB Serial Number" = "FM704250ABBN1R0BB+ENT"
    | |   |   |   "USB Serial Number" = "00008101000349113468001E"
    | |   | | |   "USB Serial Number" = "0800086914F9"
    | |   |   |   "USB Serial Number" = "0800086914F9"
    | |   |   |   "USB Serial Number" = "00000000"
    | |   |   |   "USB Serial Number" = "T9T1-005-C9829CB"
    | |       |   "USB Serial Number" = "000080300012509A2606402E"
          Serial Number: -
          Serial Number: -
          Serial Number: C020456007RP9KC13

Looking for a list of all Kernel Extensions currently loaded on a mac:

username@computername ~ % kmutil showloaded

No variant specified, falling back to release
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
    1  138 0                  0          0          com.apple.kpi.bsd (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    2   12 0                  0          0          com.apple.kpi.dsep (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    3  176 0                  0          0          com.apple.kpi.iokit (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    4    0 0                  0          0          com.apple.kpi.kasan (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    5    0 0                  0          0          com.apple.kpi.kcov (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    6  181 0                  0          0          com.apple.kpi.libkern (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    7  162 0                  0          0          com.apple.kpi.mach (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    8  108 0                  0          0          com.apple.kpi.private (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
    9  109 0                  0          0          com.apple.kpi.unsupported (21.1.0) 19BD4E1B-0268-3EE0-BC66-91F035BC9429 <>
   10   14 0xffffff800364e000 0x81000    0x81000    com.apple.kec.corecrypto (12.0) E7543F6D-F9E1-3C2C-881B-B353159F7C3C <9 8 7 6 3 1>
   11    0 0xffffff800178f000 0x3000     0x3000     com.apple.kec.AppleEncryptedArchive (1) 392DF4EE-4C54-3C09-AC93-63DE3249C02E <10 8 7 6>
   12    2 0xffffff8003417000 0xe000     0xe000     com.apple.kec.Libm (1) F8E2CEA2-AFDA-35F1-A733-A9FD6947CC45 <6>
   13    0 0xffffff80036f1000 0x7000     0x7000     com.apple.kec.pthread (1) 0C15A79A-A366-3A7C-9D52-C627BFD9AD69 <9 8 7 6 3 1>
   14    1 0xffffff8003705000 0x3000     0x3000     com.apple.driver.watchdog (1) D8D49004-8AE1-3589-A538-FE74937F8838 <9 8 7 6 3 1>
   15   31 0xffffff8002948000 0x2000     0x2000     com.apple.iokit.IOACPIFamily (1.4) 7EF77A11-B2B8-3CCF-9188-597E1279EDAC <9 8 6 3>
   16   40 0xffffff8002dee000 0x2b000    0x2b000    com.apple.iokit.IOPCIFamily (2.9) 5E1B0BE0-4B73-35F5-9126-EB05FBB8BAF5 <9 8 7 6 3>
   17   13 0xffffff8001a2c000 0x19000    0x19000    com.apple.driver.AppleSMC (3.1.9) 06C65E2A-865E-3A8B-916E-1DF59209CCE7 <16 15 14 9 8 7 6 3 1>
   18    2 0xffffff8001329000 0x78000    0x78000    com.apple.driver.AppleACPIPlatform (6.1) 4D05B97A-E9DA-3014-BD4D-7C970B860955 <17 16 15 9 8 7 6 3 1>
   19    5 0xffffff8002f25000 0x2000     0x2000     com.apple.driver.IOSlaveProcessor (1) FC0375B5-2F1D-381D-8498-F1F9CEB4B511 <8 7 6 3>
   20    3 0xffffff8001a12000 0xe000     0xe000     com.apple.driver.AppleSEPManager (1.0.1) 1C53C013-2663-343F-9C67-6BFBFC15EBED <19 16 10 9 8 7 6 3 1>
   21    1 0xffffff8001695000 0x4000     0x4000     com.apple.driver.AppleBusPowerController (1.0) AAF39F78-FFD9-33E9-A0C5-F561B454C57C <17 15 8 7 6 3>
   22   13 0xffffff8001b9e000 0x4000     0x4000     com.apple.driver.usb.AppleUSBCommon (1.0) CD8B5DC1-C745-361A-8430-8E8330566D83 <7 6 3 1>
   23    4 0xffffff800326c000 0x1000     0x1000     com.apple.driver.AppleUSBHostMergeProperties (1.2) A302C831-5D15-3FF0-BD04-2ED1A24B4293 <6 3 1>
   24   23 0xffffff8003168000 0x92000    0x92000    com.apple.iokit.IOUSBHostFamily (1.2) 20BC89E4-DBD7-326C-AB45-AC96777920F6 <23 22 21 17 15 9 8 7 6 3 1>
   25    3 0xffffff80033ff000 0xf000     0xf000     com.apple.driver.KernelRelayHost (1) 8FD972C9-56DB-3744-A3B8-EB05CA1904E5 <24 7 6 3>
   26    1 0xffffff8001706000 0x5b000    0x5b000    com.apple.driver.AppleCredentialManager (1.0) 982DE861-AD8E-379C-BDCA-36E54A5986E1 <25 20 19 10 9 8 7 6 3 1>
   27    3 0xffffff8001783000 0x6000     0x6000     com.apple.driver.AppleEffaceableStorage (1.0) A8E7A6DB-3506-39CE-9663-71FF38503BFB <9 7 6 3 1>
   28    0 0xffffff8001793000 0x6000     0x6000     com.apple.driver.AppleFDEKeyStore (28.30) FC4D0D98-6505-36E6-BA3C-0C79B998954A <27 10 9 8 7 6 3 1>
   29    3 0xffffff8001d6c000 0x9000     0x9000     com.apple.kext.CoreTrust (1) DB8BE3C4-0E7B-3E0D-AB42-8490BA8D3066 <10 8 6>
   30    2 0xffffff8001809000 0x19000    0x19000    com.apple.security.AppleImage4 (4.1.0) 80268C05-7DAB-3F92-8C4B-61D068DCAF57 <29 10 9 8 7 6 3 1>
   31    9 0xffffff800196f000 0x22000    0x22000    com.apple.driver.AppleMobileFileIntegrity (1.0.5) BB7769F7-6389-3ABC-A6CF-2BC079FA7BF8 <30 29 10 9 8 7 6 3 2 1>
   32    3 0xffffff8002e30000 0x14000    0x14000    com.apple.iokit.IOSCSIArchitectureModelFamily (452.30.4) ED3899F4-5A0C-38A2-9C4F-D9FE3A2F9DE8 <8 7 6 3 1>
   33   10 0xffffff8002f2f000 0x17000    0x17000    com.apple.iokit.IOStorageFamily (2.1) 6637C48D-A128-3A23-A8F4-96CD5CA12779 <9 8 7 6 3 1>
   34    1 0xffffff8002e56000 0xf000     0xf000     com.apple.iokit.IOSCSIBlockCommandsDevice (452.30.4) A67619C7-4239-360B-8F1D-BA529491E0A9 <33 32 8 7 6 3 1>
   35    1 0xffffff80033da000 0x1a000    0x1a000    com.apple.iokit.IOUSBMassStorageDriver (209.40.6) 47BC205B-6B74-30DA-9A8A-A8A5ABDED7DC <33 32 24 16 8 7 6 3 1>
   36    2 0xffffff8001a94000 0x8000     0x8000     com.apple.driver.AppleUSBTDM (532.40.7) ACA0F9AD-E7BA-317D-8EFD-65F08210B1ED <35 34 33 32 31 24 9 8 7 6 3 1>
   37    0 0xffffff80018ac000 0x99000    0x99000    com.apple.driver.AppleKeyStore (2) 3B176D1C-0B8C-301A-8B77-99781DCFE063 <36 31 29 26 25 20 19 10 9 8 7 6 3 1>
   38    0 0xffffff8001a4f000 0x9000     0x9000     com.apple.driver.AppleSSE (1.0) 2BFC2CDF-7F72-3045-A185-06705B1B58AD <25 20 19 9 8 7 6 3 1>
   39    5 0xffffff8001c90000 0x8000     0x8000     com.apple.iokit.CoreAnalyticsFamily (1) C6E5663C-0CF2-3415-BDCA-5771DA3C3DF2 <9 8 7 6 3 1>
   40    0 0xffffff8001d77000 0x3000     0x3000     com.apple.Dont_Steal_Mac_OS_X (7.0.0) 8DE63107-1955-3525-97C2-B873B7B2AFF6 <17 10 9 8 6 3 1>
   41    2 0xffffff800196b000 0x3000     0x3000     com.apple.kext.AppleMatch (1.0.0d1) C4579F6A-A535-384E-A754-E8D725E4AB24 <6 1>
   42    3 0xffffff800344a000 0x4c000    0x4c000    com.apple.security.sandbox (300.0) F849DBF4-44D6-37B7-AF25-E558CF33DB31 <41 33 31 9 8 7 6 3 2 1>
   43    2 0xffffff8003441000 0x8000     0x8000     com.apple.security.quarantine (4) CA182057-9926-3053-BA5F-96D331293C7E <42 41 9 8 7 6 3 2 1>
   44    0 0xffffff8001d7d000 0x56000    0x56000    com.apple.iokit.EndpointSecurity (1) 614AE7CF-1ED2-3BFE-9F82-C077A8E699F6 <43 31 9 8 7 6 3 2 1>
   45   10 0xffffff8002e2a000 0x3000     0x3000     com.apple.iokit.IOReportFamily (47) 81D7D4E0-A39C-332D-A4A4-AEBB70A9B6FF <8 7 6 3>
   46    2 0xffffff80029bd000 0x39000    0x39000    com.apple.iokit.IOBluetoothFamily (9.0.0) 6B904BF8-F71F-34C6-8033-607910B8C67E <45 24 15 9 8 7 6 3 1>
   47    0 0xffffff8002a3b000 0xc000     0xc000     com.apple.driver.DiskImages (493.0.0) 94EA9FD5-3803-35AB-A7D1-6EDE0847BDCA <33 9 8 7 6 3 1>
   48    0 0xffffff8002b1a000 0x1000     0x1000     com.apple.iokit.IOKitRegistryCompatibility (1) 09758CE7-1933-3D75-80E8-5EEB1A7FE189 <6 3>
   49   16 0xffffff8002b54000 0x17000    0x17000    com.apple.iokit.IONetworkingFamily (3.4) C5A3978F-162A-34CE-AD97-641D3D8ED066 <9 8 7 6 3 1>
   50    3 0xffffff800308c000 0x1d000    0x1d000    com.apple.iokit.IOTimeSyncFamily (1000.11) DBE1AC82-38CB-3E4E-8ABD-16002993A1E4 <49 8 7 6 3 1>
   51    0 0xffffff8001320000 0x8000     0x8000     com.apple.nke.applicationfirewall (402) B95CC3D6-19EA-35D1-9D27-E8D3D2822ACC <9 8 7 6 3 1>
   52    0 0xffffff8001ab6000 0xe000     0xe000     com.apple.AppleSystemPolicy (2.0.0) BC1E9E74-F25E-3FE8-9AFE-95AFF4B8F9BD <43 42 31 9 8 7 6 3 2 1>
   53    0 0xffffff80013d1000 0x2000     0x2000     com.apple.driver.AppleAPIC (1.7) 61069043-0F2A-3ECE-AF29-4E443E70331D <16 6 3>
   54   10 0xffffff8002a85000 0x5e000    0x5e000    com.apple.iokit.IOHIDFamily (2.0.0) C7BE43F0-F4BB-320A-865D-89DE08938189 <45 9 8 7 6 3 2 1>
   55    3 0xffffff8002eb8000 0x2000     0x2000     com.apple.iokit.IOSMBusFamily (1.1) FBCF7261-2104-3F79-ADCD-C3DDD5B63986 <7 6 3>
   56    0 0xffffff80013b7000 0x6000     0x6000     com.apple.driver.AppleACPIEC (6.1) 20782CAB-2EF8-33D9-842C-47D9F0A8FF5A <55 54 45 18 15 9 8 7 6 3 1>
   57    0 0xffffff8001a27000 0x3000     0x3000     com.apple.driver.AppleSMBIOS (2.1) D2161105-0DDE-309A-9CD4-0BAD572300F5 <9 6 3>
   58    0 0xffffff8001a49000 0x4000     0x4000     com.apple.driver.AppleSMCRTC (1.0) 27486EEF-D998-396C-A34B-369DBF01ECD9 <17 15 9 7 6 3 1>
   59    1 0xffffff8001769000 0x2000     0x2000     com.apple.driver.AppleEFIRuntime (2.1) 27B4E61E-46C4-3F1E-A370-22CE4FB14D7C <9 8 7 6 3>
   60    0 0xffffff80013b0000 0x3000     0x3000     com.apple.driver.AppleACPIButtons (6.1) 033AB2A0-44E2-3F21-B6CE-8EFD3FD8B8B2 <54 45 18 15 9 8 7 6 3 1>
   61    1 0xffffff800176d000 0xa000     0xa000     com.apple.driver.AppleEFINVRAM (2.1) 9A6CA1AA-FF62-32FD-8618-92C5A57068E2 <59 9 8 7 6 3 1>
   62    0 0xffffff8001a5b000 0x12000    0x12000    com.apple.driver.AppleSmartBatteryManager (161.0.0) 4F7D7356-19AE-3CFE-8B0F-C474E4B1DE9F <55 17 15 7 6 3 1>
   63    0 0xffffff8003413000 0x1000     0x1000     com.apple.private.KextAudit (1.0) E6DFB592-493E-37BC-8152-00F529EFED70 <17 9 8 7 6 3>
   64    1 0xffffff8003317000 0x4f000    0x4f000    com.apple.driver.usb.AppleUSBXHCI (1.2) 27E979DE-ABB7-39DF-A185-B8CBD537E66D <24 22 15 9 8 7 6 3 1>
   65    0 0xffffff8003370000 0x29000    0x29000    com.apple.driver.usb.AppleUSBXHCIPCI (1.2) DC3FA49E-006F-31CA-837F-3F709CCB0046 <64 24 22 16 15 9 8 7 6 3 1>
   66    8 0xffffff8002f80000 0xe2000    0xe2000    com.apple.iokit.IOThunderboltFamily (9.3.2) B45AE4FB-5CB3-373B-AB52-8F4AF592ECB8 <17 7 6 3 1>
   67    0 0xffffff8001b14000 0x30000    0x30000    com.apple.driver.AppleThunderboltNHI (7.2.8) F6BE77FF-D545-3A02-852B-0080C5A46E7C <66 16 15 8 7 6 3 1>
   68    0 0xffffff80030ba000 0x66000    0x66000    com.apple.iokit.IOUSBFamily (900.4.2) 559F9E31-26CB-3FB2-83CD-13C8433AF40C <24 22 16 9 7 6 3 1>
   69    0 0xffffff800326f000 0x3000     0x3000     com.apple.driver.usb.AppleUSBHostPacketFilter (1.0) 711F86F3-7300-374E-AF01-7FFAEC997EB1 <24 22 9 8 7 6 3 1>
   70    3 0xffffff8002de7000 0x5000     0x5000     com.apple.driver.mDNSOffloadUserClient (1.0.1b8) FE25B64E-CA8C-3F63-BE98-A356EF4F1034 <49 6 3 1>
   71    2 0xffffff8002dd0000 0x2000     0x2000     com.apple.iokit.IOEthernetAVBController (1.1.0) A555F1B1-5D55-302C-91DD-FEB2297F1B9C <49 7 6 3 1>
   72    0 0xffffff8002db0000 0x15000    0x15000    com.apple.driver.AppleIntelI210Ethernet (2.3.1) 3FC3E104-F00A-36C4-B89A-389B5F3F855F <71 70 49 16 7 6 3 1>
   73   10 0xffffff8003628000 0x1a000    0x1a000    com.apple.driver.corecapture (1.0.4) 72A74BCE-3DE9-36B1-81BC-3BDD9B0281BA <9 8 7 6 3 1>
   74    2 0xffffff80019bc000 0xa000     0xa000     com.apple.driver.AppleOLYHALMac (1) 199A93DF-84CA-301A-B93A-F00DEB9151CA <73 16 9 8 7 6 3 1>
   75    7 0xffffff8002b03000 0x12000    0x12000    com.apple.driver.IOImageLoader (1.0.0) 0C13D12B-CBBB-34CC-B85A-73A175BD713C <73 10 9 8 7 6 3 1>
   76    6 0xffffff8002ecd000 0x48000    0x48000    com.apple.iokit.IOSkywalkFamily (1.0) F2791A9B-9265-3832-9133-BA6D58A60CEF <70 49 9 8 7 6 3 1>
   77    2 0xffffff8001e42000 0x194000   0x194000   com.apple.iokit.IO80211Family (1200.12.2b1) C5D1EB31-EB5B-3922-AAC5-9D1F72CC7C3B <76 73 49 39 31 10 9 8 7 6 3 1>
   78    5 0xffffff8002ebc000 0x6000     0x6000     com.apple.iokit.IOSerialFamily (11) B5429B6D-AAA9-393E-8DB1-90FD1E8B2D5E <9 8 7 6 3 1>
   79    1 0xffffff8001445000 0x203000   0x203000   com.apple.driver.AppleBCMWLANCoreMac (1.0.0) 3CD965E3-9F6D-32E9-B4D0-6B9C6B3B0137 <78 77 76 75 74 73 70 50 49 39 31 16 10 9 8 7 6 3 1>
   80    0 0xffffff80013e0000 0x59000    0x59000    com.apple.driver.AppleBCMWLANBusInterfacePCIeMac (1) 70688944-8887-3C2B-856C-0FEADAA7CDAC <79 77 76 75 74 73 49 39 16 9 8 7 6 3 1>
   81    0 0xffffff8002b1d000 0x2d000    0x2d000    com.apple.iokit.IONVMeFamily (2.1.0) 5D151865-3739-3750-ABC7-3F081504A6A6 <45 33 31 16 9 8 7 6 3 1>
   82    6 0xffffff8002a1e000 0x7000     0x7000     com.apple.iokit.IOBufferCopyEngineFamily (1) 2B284125-8053-33A2-BDAA-FD179846B49E <7 6 3 1>
   83    0 0xffffff8002a18000 0x3000     0x3000     com.apple.iokit.IOBufferCopyController (1.1.0) 7ADDFDAC-F8CA-3629-9A74-B58B10968CC7 <82 16 9 8 7 6 3 1>
   84    0 0xffffff800177a000 0x5000     0x5000     com.apple.driver.AppleEffaceableNOR (1.0) FFE5D6C7-402B-33D0-A931-8A290709EA20 <82 36 27 9 7 6 3 1>
   85    3 0xffffff8001ba4000 0x6000     0x6000     com.apple.driver.usb.AppleUSBVHCICommon (1.0) 56304A5B-D590-3D35-AE6E-5556ECE55A4B <24 22 9 7 6 3 1>
   86    1 0xffffff80032f0000 0x1d000    0x1d000    com.apple.driver.usb.AppleUSBVHCI (1.2) 4103BD4E-160D-3F8C-A4E9-5EBFBD434CBA <85 24 22 9 8 7 6 3 1>
   87    1 0xffffff8001bac000 0xb000     0xb000     com.apple.driver.usb.AppleUSBVHCICommonBCE (1.0) FF45651E-8986-32D8-ABD9-00AE61CA9813 <85 82 22 9 7 6 3 1>
   88    0 0xffffff8003313000 0x2000     0x2000     com.apple.driver.usb.AppleUSBVHCIBCE (1.2) 1D8AC0FB-F496-3473-9343-81ED104178C3 <87 86 85 82 24 22 15 9 8 7 6 3 1>
   89    0 0xffffff8001c36000 0x3000     0x3000     com.apple.driver.AppleXsanScheme (3) CAF0DE16-5491-3A56-8D47-B7E727CE7259 <33 7 6 3 1>
   90    1 0xffffff80034b0000 0x16c000   0x16c000   com.apple.filesystems.apfs (1933.41.2) 529247AB-A224-35F9-9621-2660209B3F7B <61 39 33 30 27 10 9 8 7 6 3 2 1>
   91    0 0xffffff800179c000 0x2000     0x2000     com.apple.AppleFSCompression.AppleFSCompressionTypeDataless (1.0.0d1) 590F8FEF-DB9B-34E0-BD88-B570AB57075F <9 8 6 3 2 1>
   92    0 0xffffff80017a0000 0x11000    0x11000    com.apple.AppleFSCompression.AppleFSCompressionTypeZlib (1.0.0) FC4AD2FE-B691-3399-B012-27C9D91E85C9 <8 6 3 2 1>
   93    0 0xffffff8001c80000 0xd000     0xd000     com.apple.BootCache (40) 53280F43-3789-35C0-8EAA-F8A04AC227BC <9 8 7 6 3 1>
   94    1 0xffffff8001e3e000 0x2000     0x2000     com.apple.filesystems.hfs.encodings.kext (1) 00B0534F-5D50-346F-B534-76F44AFA8A45 <9 8 7 6 3 1>
   95    0 0xffffff8001ddc000 0x5f000    0x5f000    com.apple.filesystems.hfs.kext (582.40.4) E7AF5E99-15EC-3832-8989-1F4EF858CB2B <94 9 8 7 6 3 1>
   96    2 0xffffff8002f5d000 0x1d000    0x1d000    com.apple.iokit.IOSurface (302.9) F42646DD-8963-3EA4-BAC3-2D0F36CDA224 <9 8 7 6 3 1>
   97    0 0xffffff80036da000 0x13000    0x13000    com.apple.filesystems.lifs (1) 71F076FD-484B-3CAF-A90B-76BDDBC8D7F1 <9 8 7 6 3 1>
   98    0 0xffffff800166c000 0x1000     0x1000     com.apple.driver.AppleBSDKextStarter (3) 8891FC50-6ADE-3C35-A61D-B5E8CE2B6DDC <6 3>
   99    0 0xffffff80036f9000 0xa000     0xa000     com.apple.filesystems.tmpfs (1) 590AD8A4-633A-39B1-B9E5-E6A9E422257A <9 8 7 6 3 1>
  100    0 0xffffff80017b5000 0x2000     0x2000     com.apple.driver.AppleFileSystemDriver (3.0.1) 4229CD72-2112-3895-AA37-F05681B936E5 <33 6 3>
  101    1 0xffffff800186c000 0x5000     0x5000     com.apple.driver.AppleIntelLpssDmac (3.0.60) 0948B191-C9D0-3219-9C28-73C4EC51D295 <16 15 7 6 3>
  102    1 0xffffff800187e000 0x7000     0x7000     com.apple.driver.AppleIntelLpssI2C (3.0.60) 7A5BC8D1-2818-3FD0-AAE4-01FAAD37F59A <16 15 9 7 6 3>
  103    1 0xffffff8001887000 0xe000     0xe000     com.apple.driver.AppleIntelLpssI2CController (3.0.60) B84FFF37-A645-3672-AE67-4A71D83F6504 <102 101 15 9 7 6 3>
  104    0 0xffffff80017d8000 0x8000     0x8000     com.apple.driver.AppleHPM (3.4.4) F21D109E-555B-3EA5-BE5E-DE15D81D8FA8 <103 66 15 7 6 3 1>
  105    2 0xffffff8001ac8000 0x17000    0x17000    com.apple.driver.AppleThunderboltDPAdapterFamily (8.5.0) 6A38055F-450A-34D9-BA54-88EAA8A9AEFC <66 7 6 3 1>
  106    0 0xffffff8001ae2000 0xa000     0xa000     com.apple.driver.AppleThunderboltDPInAdapter (8.5.0) 291A356F-8FF2-38D0-87A3-4357CBF66A4B <105 66 15 7 6 3 1>
  107    0 0xffffff8001c4e000 0x2000     0x2000     com.apple.driver.BCMWLANFirmware4355.Hashstore (1) C010B3D7-29D0-311B-A89E-69FB15074995 <75 73 7 6 3 1>
  108    0 0xffffff8001c52000 0x7000     0x7000     com.apple.driver.BCMWLANFirmware4364.Hashstore (1) CDF12761-E602-3461-BE19-3F3D15AABDB5 <75 73 7 6 3 1>
  109    1 0xffffff8001b4f000 0x4000     0x4000     com.apple.driver.AppleThunderboltPCIDownAdapter (4.1.1) 8C85B75E-37B3-36DA-B543-65BBC521A5E6 <66 16 7 6 3 1>
  110    0 0xffffff8001c5f000 0x4000     0x4000     com.apple.driver.BCMWLANFirmware4377.Hashstore (1) B6CBF03A-6245-3B15-ADFD-116F6A67CD0A <75 73 7 6 3 1>
  111    0 0xffffff8001c67000 0x5000     0x5000     com.apple.driver.BCMWLANFirmware4378.Hashstore (1) 1CC52F9E-2A28-30A9-AED0-D0CCBFD60760 <75 73 7 6 3 1>
  112    0 0xffffff8001c71000 0x8000     0x8000     com.apple.driver.BCMWLANFirmware4387.Hashstore (1) 61A57F47-CFD3-387F-85AE-B3AA6C9ED7FD <75 73 7 6 3 1>
  113    3 0xffffff8003265000 0x4000     0x4000     com.apple.driver.usb.AppleUSBHostCompositeDevice (1.2) E176D17C-D233-36B7-B9C4-37897FB11C0F <24 22 8 7 6 3 1>
  114    3 0xffffff8001bf0000 0x2000     0x2000     com.apple.driver.usb.networking (5.0.0) A7AD0866-6149-34A8-B98F-3AE27127A5BF <24 8 7 6 3 1>
  115    2 0xffffff8001b99000 0x2000     0x2000     com.apple.driver.usb.cdc (5.0.0) 1C92F983-E035-3AA0-AE18-B2A8608F8455 <114 113 24 7 6 3 1>
  116    0 0xffffff8001be5000 0x8000     0x8000     com.apple.driver.usb.cdc.ncm (5.0.0) 4D4E5BAD-394F-3F12-A484-0832E8D0BA5E <115 114 113 49 45 24 8 7 6 3 1>
  117    0 0xffffff8001bbd000 0x4000     0x4000     com.apple.driver.usb.cdc.ecm (5.0.0) F1BBD1B6-AC7D-33E3-BE89-7255F8CD634C <115 114 49 24 23 7 6 3 1>
  118    0 0xffffff80033cd000 0xa000     0xa000     com.apple.driver.usb.IOUSBHostHIDDevice (1.2) 1A124217-7EA5-3B40-9EAB-12DC36107FBE <54 24 22 7 6 3 1>
  119    0 0xffffff8001aef000 0x21000    0x21000    com.apple.driver.AppleThunderboltDPOutAdapter (8.5.0) C365E4FC-1B02-3767-A3DE-DC708E0145B9 <105 66 15 7 6 3 1>
  120    0 0xffffff8001b55000 0x14000    0x14000    com.apple.driver.AppleThunderboltPCIUpAdapter (4.1.1) F4EF3116-CB55-37E3-9666-650BF83ADEF4 <109 66 16 7 6 3 1>
  121    0 0xffffff8003274000 0x2a000    0x2a000    com.apple.driver.usb.AppleUSBHub (1.2) AE74F58B-073A-3FC3-BC04-842092604D9E <24 22 15 7 6 3 1>
  122    0 0xffffff80032aa000 0x1000     0x1000     com.apple.driver.AppleUSBMergeNub (900.4.2) 8D056186-7486-304B-8E6F-49518A5E9C82 <23 6 3 1>
  123    0 0xffffff7f96d0d000 0x3000     0x3000     com.apple.driver.AppleAVEBridge (6.1) 99A6ADBC-9C0D-3B3C-B9E4-71BD727F6E92 <82 7 6 3>
  124    0 0xffffff7f984cb000 0xa000     0xa000     com.apple.driver.BridgeAudioCommunication (200.8) 9A9C3FC6-04B4-354F-8947-9F244250F4E3 <82 9 7 6 3 1>
  128    4 0xffffff7f987a8000 0x4000     0x4000     com.apple.driver.IOPlatformPluginFamily (6.0.0d8) DF80C4F5-605D-35EF-894F-CC480AA7E9ED <15 9 8 7 6 3>
  129    0 0xffffff7f97fd7000 0x3000     0x3000     com.apple.driver.AppleIntelPCHPMC (2.0.1) 7F2AF8A0-4741-3604-A17E-33912FFADD42 <128 17 16 15 6 3>
  130    1 0xffffff7f987d5000 0x13000    0x13000    com.apple.driver.X86PlatformPlugin (1.0.0) 5C50C42E-7048-30AD-B219-C9C7900D4EF2 <128 24 17 15 9 8 7 6 3 1>
  133    1 0xffffff7f98395000 0x7000     0x7000     com.apple.driver.AppleSMBusController (1.0.18d1) 0EF599FA-71DA-31C3-8173-27100CCF0529 <55 16 15 7 6 3>
  134   14 0xffffff7f98754000 0x2f000    0x2f000    com.apple.iokit.IOGraphicsFamily (593) D7EBF011-CEEF-3DF8-BD85-6CCE427455B7 <16 9 7 6 3 1>
  135    0 0xffffff7f9833f000 0xb000     0xb000     com.apple.driver.AppleMCCSControl (1.14) FE2260DB-65DE-3597-A479-B8069E2CF621 <134 133 17 16 15 9 7 6 3 1>
  137    4 0xffffff7f9879c000 0x9000     0x9000     com.apple.iokit.IONDRVSupport (593) 0F63C5B1-1467-3487-97D4-B9A8844F2526 <134 16 9 7 6 3>
  138    1 0xffffff7f96d29000 0x2000     0x2000     com.apple.driver.AppleBacklightExpert (1.1.0) ACDE78B2-0776-3BD6-8120-A2A5FB164BF2 <137 134 17 16 7 6 3>
  139    0 0xffffff7f96d23000 0x3000     0x3000     com.apple.driver.AppleBacklight (180.3) 694DF69D-A5FE-3AE3-8AE6-CC98B96AFBF4 <138 137 134 16 7 6 3>
  140    5 0xffffff7f96f32000 0x4000     0x4000     com.apple.AppleGraphicsDeviceControl (6.4.9) 33635226-9D8B-3D6A-8C34-1B8F1A081770 <134 16 9 8 7 6 3 1>
  141    2 0xffffff7f985c7000 0x6a000    0x6a000    com.apple.iokit.IOAcceleratorFamily2 (462.4) 37BACF45-3C71-3411-97DB-E9AA07F37D0E <134 96 45 31 16 9 8 7 6 3 1>
  142    0 0xffffff7f979b3000 0xeb000    0xeb000    com.apple.driver.AppleIntelICLLPGraphicsFramebuffer (18.0.2) 444A9CCD-2351-352C-8E89-F35F7BEA4D9D <141 140 134 45 16 15 9 8 7 6 3 1>
  145    0 0xffffff7f983ec000 0x3d000    0x3d000    com.apple.driver.AppleThunderboltIP (4.0.3) 58587CB7-1F40-30A7-81E7-C994A98C3E74 <66 49 16 7 6 3 1>
  146    1 0xffffff8002f2b000 0x2000     0x2000     com.apple.iokit.IOSlowAdaptiveClockingFamily (1.0.0) 3742C627-9158-3412-B54F-DA4426DB0207 <9 8 7 6 3 1>
  147    0 0xffffff7f98338000 0x1000     0x1000     com.apple.driver.AppleIntelSlowAdaptiveClocking (4.0.0) 38710452-7EC8-3479-B331-2D8FD1E46197 <146 6 3>
  148    0 0xffffff7f96f27000 0x7000     0x7000     com.apple.AppleGPUWrangler (6.4.9) 6B66C033-CD71-37AC-A3B1-2AA80CA2C780 <140 134 16 9 8 7 6 3 1>
  149    1 0xffffff7f98c05000 0xc1000    0xc1000    com.apple.vecLib.kext (1.2.0) 47F8853C-5136-3BA0-A0A5-3F89CDA55C8E <12 9 8 7 6 3>
  150    3 0xffffff7f9864a000 0x1e000    0x1e000    com.apple.iokit.IOAudioFamily (300.10) 23F34A50-2E02-3271-8F88-A5F822F64EF7 <149 7 6 3 1>
  151    0 0xffffff7f96ea1000 0x60000    0x60000    com.apple.driver.AppleGFXHDA (100.1.434) BCAEF42E-2E59-3A42-9E36-AEA8A369492D <150 137 134 16 9 8 7 6 3 1>
  154    0 0xffffff7f97868000 0xcb000    0xcb000    com.apple.driver.AppleIntelICLGraphics (18.0.2) 3352D228-0D43-3708-AEC3-5EF69644F719 <141 134 96 16 9 8 7 6 3 1>
  155    0 0xffffff7f96de8000 0xc000     0xc000     com.apple.driver.AppleDiskImages2 (126.40.1) 5B854A2C-33B8-3F1D-A834-0BEB352629D1 <33 7 6 3 1>
  156    0 0xffffff7f971ae000 0x14000    0x14000    com.apple.driver.AppleHV (1) 60430299-45E9-381E-9ADF-03324D5D0D67 <42 9 8 7 6 3 1>
  157    0 0xffffff7f971c6000 0x4000     0x4000     com.apple.driver.AppleIPAppender (1.0) 9F877953-C07E-39C8-94C3-848DA644F7D4 <76 49 9 8 7 6 3 1>
  158    0 0xffffff7f984e7000 0x1000     0x1000     com.apple.iokit.BroadcomBluetooth20703USBTransport (9.0.0) CF1B6A00-2059-3407-9758-E85EB2018B6E <9 8 7 6 3>
  159    0 0xffffff7f984ea000 0x1000     0x1000     com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport (9.0.0) EA2F67E3-CAB6-3CD0-97E1-4361D97F1CF0 <9 8 7 6 3>
  160    0 0xffffff7f984ed000 0x1000     0x1000     com.apple.iokit.CSRBluetoothHostControllerUSBTransport (9.0.0) B5320EB9-C650-36D3-B33A-67D371164724 <9 8 7 6 3>
  161    1 0xffffff7f9880d000 0x6d000    0x6d000    com.apple.plugin.IOgPTPPlugin (1000.11) B4827400-3125-3568-AF1E-9A81E26C59E7 <76 54 50 49 12 8 7 6 3 1>
  162    0 0xffffff7f98550000 0x13000    0x13000    com.apple.iokit.IOAVBFamily (1010.2) EF59D76D-58A4-3623-85F2-684D6D11B15F <161 71 50 49 8 7 6 3 1>
  163    0 0xffffff7f98672000 0x1000     0x1000     com.apple.driver.IOBluetoothHostControllerPCIeTransport (9.0.0) 63F9EE81-4154-3B6C-87F9-8BB808BE5886 <9 8 7 6 3>
  166    0 0xffffff7f98675000 0x1000     0x1000     com.apple.iokit.IOBluetoothHostControllerTransport (9.0.0) 08D8A847-99F6-34E6-A999-92C5BD209582 <9 8 7 6 3>
  167    0 0xffffff7f98678000 0x1000     0x1000     com.apple.iokit.IOBluetoothHostControllerUARTTransport (9.0.0) B4F3AA0D-7FEA-376A-9C20-70F18A20766A <9 8 7 6 3>
  168    0 0xffffff7f9867b000 0x1000     0x1000     com.apple.iokit.IOBluetoothHostControllerUSBTransport (9.0.0) 380C0A17-371D-3733-8B84-A68D2887D105 <9 8 7 6 3>
  169    0 0xffffff7f9867e000 0x1000     0x1000     com.apple.iokit.IOBluetoothPacketLogger (9.0.0) 18B0E4EC-F6BB-3143-9BB5-7CEE62F0BB7A <9 8 7 6 3>
  170    0 0xffffff7f98681000 0x1000     0x1000     com.apple.iokit.IOBluetoothSerialManager (9.0.0) 79B4C006-2FFF-349E-93D8-78F339D8AECA <9 8 7 6 3>
  171    2 0xffffff7f98354000 0x10000    0x10000    com.apple.driver.AppleOnboardSerial (1.0) E72D5DE0-CC9D-3D1E-B81E-E3D94D55B8CD <78 76 9 7 6 3 1>
  172    1 0xffffff7f97fba000 0x2000     0x2000     com.apple.driver.AppleIntelLpssUARTCommon (3.0.60) 74BD1DC7-5C5D-320C-9DC8-1347E2F62D9B <171 78 16 15 9 7 6 3 1>
  173    0 0xffffff7f97fc1000 0x1000     0x1000     com.apple.driver.AppleIntelLpssUARTv1 (3.0.60) A0A094FF-1B22-367A-BC1C-13BE907D26D4 <172 171 78 16 15 9 7 6 3 1>
  174    1 0xffffff7f96d21000 0x1000     0x1000     com.apple.driver.AppleAudioClockLibs (100.9.1) EA193BEA-B3B2-35F4-91DF-69F9A8B57549 <9 7 6 3 1>
  177    0 0xffffff7f988a6000 0x1c000    0x1c000    com.apple.driver.usb.AppleUSBUserHCI (1) 59B25F32-2A0D-315B-8339-4B3172A383BA <24 22 7 6 3 1>
  178    0 0xffffff7f988c9000 0x4000     0x4000     com.apple.iokit.IOUserEthernet (1.0.1) AA385635-CB18-3902-A933-DD968B39F44B <49 8 7 6 3 1>
  179    0 0xffffff7f98b32000 0x9000     0x9000     com.apple.driver.pmtelemetry (1) 650C9D0A-0BB8-36AE-BBAF-E148F1ADB256 <9 8 7 6 3 1>
  181    0 0xffffff7f984d9000 0xa000     0xa000     com.apple.driver.AppleBridgeAudioController (200.8) EDC95E5A-A73D-3C77-B03F-04A73BED484B <16 9 8 7 6 3 1>
  182    0 0xffffff7f96f23000 0x2000     0x2000     com.apple.AGDCPluginDisplayMetrics (6.4.9) 4B9E89A2-CDDC-350A-96F5-9481563F27B8 <140 9 8 7 6 3 1>
  183    1 0xffffff7f96f1a000 0x1000     0x1000     com.apple.driver.AppleGraphicsControl (6.4.9) 627B7CC8-BD7E-35A5-97AC-3EF3B53567DB <9 7 6 3 1>
  184    0 0xffffff7f96f3b000 0x18000    0x18000    com.apple.driver.AppleGraphicsDevicePolicy (6.4.9) 4B2F628F-4F16-323D-9772-AFE6E398AA06 <183 140 134 16 15 9 8 7 6 3 1>
  185    0 0xffffff7f984b6000 0x3000     0x3000     com.apple.driver.AppleUpstreamUserClient (3.6.8) 7726AFB8-3070-31C0-AEEF-33FEF77817F4 <134 16 15 9 7 6 3 1>
  186    0 0xffffff80017b9000 0x1000     0x1000     com.apple.driver.AppleHIDALSService (1) 06AD2553-0579-3560-85B6-FCC29223963F <24 6 3>
  187    0 0xffffff80017bc000 0x5000     0x5000     com.apple.driver.AppleHIDKeyboard (228) 15AE4D23-303B-3592-9D4F-CF101850F913 <54 8 7 6 3>
  188    2 0xffffff8001829000 0xe000     0xe000     com.apple.driver.AppleInputDeviceSupport (5400.30) 8482523D-7A44-3B6A-BD6A-8FC3346F4E03 <39 19 7 6 3 1>
  189    2 0xffffff80019a1000 0x14000    0x14000    com.apple.driver.AppleMultitouchDriver (5400.25) 47242754-78E2-3D33-A4EB-3F50D460CBF6 <188 54 45 9 8 7 6 3 1>
  190    0 0xffffff80013d5000 0x7000     0x7000     com.apple.driver.AppleActuatorDriver (5400.25) 3214B78F-84D2-344E-B487-1F115827201C <189 188 54 45 9 8 7 6 3 1>
  191    1 0xffffff8002a00000 0x14000    0x14000    com.apple.driver.IOBluetoothHIDDriver (9.0.0) 84D005C2-706C-39AB-809F-843430C6D89A <54 46 7 6 3>
  192    1 0xffffff8001b7e000 0x7000     0x7000     com.apple.driver.AppleHSBluetoothDriver (5010.1) DDD71D0C-B9D4-3C16-BD9D-7EEB568A6C37 <191 54 46 8 7 6 3 1>
  193    0 0xffffff8001b89000 0x8000     0x8000     com.apple.driver.AppleTopCaseHIDEventDriver (5010.1) 476FD41C-7117-3ED4-93E7-056C30FC0600 <192 189 54 8 7 6 3 1>
  195    0 0xffffff7f984f0000 0x4000     0x4000     com.apple.fsplaceholder (1.14.1) 7E3ABB02-6016-3D62-8E57-30AB9F9F53B1 <9 7 6 2 1>
  196    0 0xffffff7f96e82000 0x18000    0x18000    com.apple.fileutil (20.036.15) B4DE9F9B-1456-3B65-8EAC-08761FEE9500 <7 6 3 2 1>
  197    2 0xffffff7f98bca000 0x3000     0x3000     com.apple.kext.triggers (1.0) 2C2FCBB2-5DFD-379A-AEE3-91C7E346D5EF <9 8 7 6 3 1>
  198    0 0xffffff7f98a97000 0x8000     0x8000     com.apple.filesystems.autofs (3.0) F631C82C-ADFF-30DC-BEE0-3B3574D9F839 <197 9 8 7 6 3 2 1>
  199    0 0xffffff7f98390000 0x2000     0x2000     com.apple.driver.ApplePlatformEnabler (2.7.0d0) 9663BE68-1E21-38B6-9BAA-02E87FF785E2 <9 7 6 3>
  200    1 0xffffff7f987ea000 0x6000     0x6000     com.apple.driver.X86PlatformShim (1.0.0) FC3676DD-50D6-3D48-84B0-949CF88A0367 <130 128 17 9 6 3>
  201    0 0xffffff7f96fa0000 0x1e000    0x1e000    com.apple.driver.AGPM (125) 780F5FAB-394B-33D4-A198-404F7320DD42 <140 137 134 128 16 8 7 6 3 1>
  202    0 0xffffff7f988d1000 0x7000     0x7000     com.apple.driver.driverkit.serial (6.0.0) 773DE62B-672A-396C-A36A-6DACFF3BAF39 <78 7 6 3 1>
  204    0 0xffffff7f98b4f000 0x76000    0x76000    com.apple.filesystems.smbfs (4.0) 4C41B075-F3FF-3DA3-BEC1-9DD7C5855172 <197 10 9 8 7 6 3 1>
  244    0 0xffffff7f98435000 0x59000    0x59000    com.apple.driver.AppleUSBAudio (412.8) 67C20E53-6219-3B4E-BB95-F5E6D054EA44 <174 150 113 24 23 16 8 7 6 3 1>
  246    0 0xffffff7f984c5000 0x3000     0x3000     com.apple.driver.AudioAUUC (1.70) ADCDE7F7-7E73-30B6-AC90-ABA444F2A2D5 <150 134 16 15 9 7 6 3 1>
  249    0 0xffffff7f984a4000 0x4000     0x4000     com.apple.macos.driver.AppleUSBEthernetHost (8.1.1) 98E7ED62-1607-3C44-8238-B9A3B41DE225 <49 24 7 6 3 1>

That’s a-lot of information to look through, grep can help filter some of this out. With ‘grep’ we are looking for that have matching characters that we define. We can also use grep to filter out content that is not desired. With the KEXT results above, there may not be a concern with what Apple has running as a Kernel Extension, but a list of 3rd party KEXTS may want to be retrieved. With a -v flag, grep will be looking for the invert match. Selected lines are those not matching any of the specified patterns.

username@computername ~ % kmutil showloaded | grep -v com.apple 

No variant specified, falling back to release
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
username@computername ~ %

No 3rd party kernel extensions currently loaded. Good to know.

For more grep usage:

username@computername ~ % man grep

NAME
     grep, egrep, fgrep, rgrep, bzgrep, bzegrep, bzfgrep, zgrep, zegrep, zfgrep
     – file pattern searcher

SYNOPSIS
     grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
          [-e pattern] [-f file] [--binary-files=value] [--color[=when]]
          [--colour[=when]] [--context[=num]] [--label] [--line-buffered]
          [--null] [pattern] [file ...]

DESCRIPTION
     The grep utility searches any given input files, selecting lines that match
     one or more patterns.  By default, a pattern matches an input line if the
     regular expression (RE) in the pattern matches the input line without its
     trailing newline.  An empty expression matches every line.  Each input line
     that matches at least one of the patterns is written to the standard
     output.

     grep is used for simple patterns and basic regular expressions (BREs);
     egrep can handle extended regular expressions (EREs).  See re_format(7) for
     more information on regular expressions.  fgrep is quicker than both grep
     and egrep, but can only handle fixed patterns (i.e., it does not interpret
     regular expressions).  Patterns may consist of one or more lines, allowing
     any of the pattern lines to match a portion of the input.

     zgrep, zegrep, and zfgrep act like grep, egrep, and fgrep, respectively,
     but accept input files compressed with the compress(1) or gzip(1)
     compression utilities.  bzgrep, bzegrep, and bzfgrep act like grep, egrep,
     and fgrep, respectively, but accept input files compressed with the
     bzip2(1) compression utility.

     The following options are available:

     -A num, --after-context=num
             Print num lines of trailing context after each match.  See also the
             -B and -C options.

     -a, --text
             Treat all files as ASCII text.  Normally grep will simply print
             “Binary file ... matches” if files contain binary characters.  Use
             of this option forces grep to output lines matching the specified
             pattern.

     -B num, --before-context=num
             Print num lines of leading context before each match.  See also the
             -A and -C options.

     -b, --byte-offset
             The offset in bytes of a matched pattern is displayed in front of
             the respective matched line.

     -C[num], --context[=num]
             Print num lines of leading and trailing context surrounding each
             match.  The default value of num is “2” and is equivalent to “-A 2
             -B 2”.  Note: no whitespace may be given between the option and its
             argument.

     -c, --count
             Only a count of selected lines is written to standard output.

     --colour=[when], --color=[when]
             Mark up the matching text with the expression stored in the
             GREP_COLOR environment variable.  The possible values of when are
             “never”, “always” and “auto”.

     -D action, --devices=action
             Specify the demanded action for devices, FIFOs and sockets.  The
             default action is “read”, which means, that they are read as if
             they were normal files.  If the action is set to “skip”, devices
             are silently skipped.

     -d action, --directories=action
             Specify the demanded action for directories.  It is “read” by
             default, which means that the directories are read in the same
             manner as normal files.  Other possible values are “skip” to
             silently ignore the directories, and “recurse” to read them
             recursively, which has the same effect as the -R and -r option.

     -E, --extended-regexp
             Interpret pattern as an extended regular expression (i.e., force
             grep to behave as egrep).

     -e pattern, --regexp=pattern
             Specify a pattern used during the search of the input: an input
             line is selected if it matches any of the specified patterns.  This
             option is most useful when multiple -e options are used to specify
             multiple patterns, or when a pattern begins with a dash (‘-’).

     --exclude pattern
             If specified, it excludes files matching the given filename pattern
             from the search.  Note that --exclude and --include patterns are
             processed in the order given.  If a name matches multiple patterns,
             the latest matching rule wins.  If no --include pattern is
             specified, all files are searched that are not excluded.  Patterns
             are matched to the full path specified, not only to the filename
             component.

     --exclude-dir pattern
             If -R is specified, it excludes directories matching the given
             filename pattern from the search.  Note that --exclude-dir and
             --include-dir patterns are processed in the order given.  If a name
             matches multiple patterns, the latest matching rule wins.  If no
             --include-dir pattern is specified, all directories are searched
             that are not excluded.

     -F, --fixed-strings
             Interpret pattern as a set of fixed strings (i.e., force grep to
             behave as fgrep).

     -f file, --file=file
             Read one or more newline separated patterns from file.  Empty
             pattern lines match every input line.  Newlines are not considered
             part of a pattern.  If file is empty, nothing is matched.

     -G, --basic-regexp
             Interpret pattern as a basic regular expression (i.e., force grep
             to behave as traditional grep).

     -H      Always print filename headers with output lines.

     -h, --no-filename
             Never print filename headers (i.e., filenames) with output lines.

     --help  Print a brief help message.

     -I      Ignore binary files.  This option is equivalent to the
             “--binary-file=without-match” option.

     -i, --ignore-case
             Perform case insensitive matching.  By default, grep is case
             sensitive.

     --include pattern
             If specified, only files matching the given filename pattern are
             searched.  Note that --include and --exclude patterns are processed
             in the order given.  If a name matches multiple patterns, the
             latest matching rule wins.  Patterns are matched to the full path
             specified, not only to the filename component.

     --include-dir pattern
             If -R is specified, only directories matching the given filename
             pattern are searched.  Note that --include-dir and --exclude-dir
             patterns are processed in the order given.  If a name matches
             multiple patterns, the latest matching rule wins.

     -J, --bz2decompress
             Decompress the bzip2(1) compressed file before looking for the
             text.

     -L, --files-without-match
             Only the names of files not containing selected lines are written
             to standard output.  Pathnames are listed once per file searched.
             If the standard input is searched, the string “(standard input)” is
             written unless a --label is specified.

     -l, --files-with-matches
             Only the names of files containing selected lines are written to
             standard output.  grep will only search a file until a match has
             been found, making searches potentially less expensive.  Pathnames
             are listed once per file searched.  If the standard input is
             searched, the string “(standard input)” is written unless a --label
             is specified.

     --label
             Label to use in place of “(standard input)” for a file name where a
             file name would normally be printed.  This option applies to -H,
             -L, and -l.

     --mmap  Use mmap(2) instead of read(2) to read input, which can result in
             better performance under some circumstances but can cause undefined
             behaviour.

     -M, --lzma
             Decompress the LZMA compressed file before looking for the text.

     -m num, --max-count=num
             Stop reading the file after num matches.

     -n, --line-number
             Each output line is preceded by its relative line number in the
             file, starting at line 1.  The line number counter is reset for
             each file processed.  This option is ignored if -c, -L, -l, or -q
             is specified.

     --null  Prints a zero-byte after the file name.

     -O      If -R is specified, follow symbolic links only if they were
             explicitly listed on the command line.  The default is not to
             follow symbolic links.

     -o, --only-matching
             Prints only the matching part of the lines.

     -p      If -R is specified, no symbolic links are followed.  This is the
             default.

     -q, --quiet, --silent
             Quiet mode: suppress normal output.  grep will only search a file
             until a match has been found, making searches potentially less
             expensive.

     -R, -r, --recursive
             Recursively search subdirectories listed.  (i.e., force grep to
             behave as rgrep).

     -S      If -R is specified, all symbolic links are followed.  The default
             is not to follow symbolic links.

     -s, --no-messages
             Silent mode.  Nonexistent and unreadable files are ignored (i.e.,
             their error messages are suppressed).

     -U, --binary
             Search binary files, but do not attempt to print them.

     -u      This option has no effect and is provided only for compatibility
             with GNU grep.

     -V, --version
             Display version information and exit.

     -v, --invert-match
             Selected lines are those not matching any of the specified
             patterns.

     -w, --word-regexp
             The expression is searched for as a word (as if surrounded by
             ‘[[:<:]]’ and ‘[[:>:]]’; see re_format(7)).  This option has no
             effect if -x is also specified.

     -x, --line-regexp
             Only input lines selected against an entire fixed string or regular
             expression are considered to be matching lines.

     -y      Equivalent to -i.  Obsoleted.

     -z, --null-data
             Treat input and output data as sequences of lines terminated by a
             zero-byte instead of a newline.

     -X, --xz
             Decompress the xz(1) compressed file before looking for the text.

     -Z, --decompress
             Force grep to behave as zgrep.

     --binary-files=value
             Controls searching and printing of binary files.  Options are:
             binary (default)  Search binary files but do not print them.
             without-match     Do not search binary files.
             text              Treat all files as text.

     --line-buffered
             Force output to be line buffered.  By default, output is line
             buffered when standard output is a terminal and block buffered
             otherwise.

     If no file arguments are specified, the standard input is used.
     Additionally, “-” may be used in place of a file name, anywhere that a file
     name is accepted, to read from standard input.  This includes both -f and
     file arguments.

ENVIRONMENT
     GREP_OPTIONS  May be used to specify default options that will be placed at
                   the beginning of the argument list.  Backslash-escaping is
                   not supported, unlike the behavior in GNU grep.

EXIT STATUS
     The grep utility exits with one of the following values:

     0     One or more lines were selected.
     1     No lines were selected.
     >1    An error occurred.

EXAMPLES
     -   Find all occurrences of the pattern ‘patricia’ in a file:

               $ grep 'patricia' myfile

     -   Same as above but looking only for complete words:

               $ grep -w 'patricia' myfile

     -   Count occurrences of the exact pattern ‘FOO’ :

               $ grep -c FOO myfile

     -   Same as above but ignoring case:

               $ grep -c -i FOO myfile

     -   Find all occurrences of the pattern ‘.Pp’ at the beginning of a line:

               $ grep '^\.Pp' myfile

         The apostrophes ensure the entire expression is evaluated by grep
         instead of by the user's shell.  The caret ‘^’ matches the null string
         at the beginning of a line, and the ‘\’ escapes the ‘.’, which would
         otherwise match any character.

     -   Find all lines in a file which do not contain the words ‘foo’ or ‘bar’:

               $ grep -v -e 'foo' -e 'bar' myfile

     -   Peruse the file ‘calendar’ looking for either 19, 20, or 25 using
         extended regular expressions:

               $ egrep '19|20|25' calendar

     -   Show matching lines and the name of the ‘*.h’ files which contain the
         pattern ‘FIXME’.  Do the search recursively from the /usr/src/sys/arm
         directory

               $ grep -H -R FIXME --include=*.h /usr/src/sys/arm/

     -   Same as above but show only the name of the matching file:

               $ grep -l -R FIXME --include=*.h /usr/src/sys/arm/

     -   Show lines containing the text ‘foo’.  The matching part of the output
         is colored and every line is prefixed with the line number and the
         offset in the file for those lines that matched.

               $ grep -b --colour -n foo myfile

     -   Show lines that match the extended regular expression patterns read
         from the standard input:

               $ echo -e 'Free\nBSD\nAll.*reserved' | grep -E -f - myfile

     -   Show lines from the output of the pciconf(8) command matching the
         specified extended regular expression along with three lines of leading
         context and one line of trailing context:

               $ pciconf -lv | grep -B3 -A1 -E 'class.*=.*storage'

     -   Suppress any output and use the exit status to show an appropriate
         message:

               $ grep -q foo myfile && echo File matches

SEE ALSO
     bzip2(1), compress(1), ed(1), ex(1), gzip(1), sed(1), xz(1), zgrep(1),
     re_format(7)

STANDARDS
     The grep utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”)
     specification.

     The flags [-AaBbCDdGHhILmoPRSUVw] are extensions to that specification, and
     the behaviour of the -f flag when used with an empty pattern file is left
     undefined.

     All long options are provided for compatibility with GNU versions of this
     utility.

     Historic versions of the grep utility also supported the flags [-ruy].
     This implementation supports those options; however, their use is strongly
     discouraged.

HISTORY
     The grep command first appeared in Version 6 AT&T UNIX.

BUGS
     The grep utility does not normalize Unicode input, so a pattern containing
     composed characters will not match decomposed input, and vice versa.

Leave a Reply

Blog at WordPress.com.

%d bloggers like this: