Automic VaultAutomic Vault

brew

使用 Homebrew, apk, chocolatey, apt, dnf, MacPorts, pacman, zypper, scoop 安装 grep

查看 grep 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

安装

其他安装命令

macOS

Homebrew已验证 · 100%
brew install grep

local Homebrew formula metadata

MacPorts已验证 · 94%
sudo port install grep

MacPorts ports tree · sysutils/grep/Portfile · 来源: api.github.com

Linux

Alpine Linux apk已验证 · 92%
sudo apk add grep

Alpine Linux edge package indexes · grep · 来源: dl-cdn.alpinelinux.org

Debian apt已验证 · 92%
sudo apt install grep

Debian stable package indexes · grep · 来源: deb.debian.org

Fedora dnf已验证 · 92%
sudo dnf install grep

Fedora Rawhide package metadata · grep · 来源: dl.fedoraproject.org

Arch Linux pacman已验证 · 92%
sudo pacman -S grep

Arch Linux sync databases · grep · 来源: geo.mirror.pkgbuild.com

openSUSE zypper已验证 · 92%
sudo zypper install grep

openSUSE Tumbleweed package metadata · grep · 来源: download.opensuse.org

概览

软件包摘要

GNU grep, egrep and fgrep

命令和别名

  • egrep
  • fgrep
  • grep

历史

项目历史与用法

GNU grep is the GNU Project's implementation of grep, the Unix text-search utility whose name comes from the ed command pattern g/re/p. As a package, it is one of the canonical command-line tools: tiny at the interface, deep in implementation, and present in nearly every Unix-like software collection.

The original grep came from early Unix culture at Bell Labs; GNU grep belongs to the later free-software lineage that reimplemented core Unix utilities for the GNU operating system and for portable Unix-like environments. Package managers care about both stories: grep is a standard shell verb, while GNU grep brings GNU options, performance engineering, and portability.

项目历史

The Unix oral-history account attributes the original grep idea to Doug McIlroy asking Ken Thompson to lift the regular-expression recognizer out of the editor into a one-pass program. That origin explains the enduring shape of grep: read input sequentially, match a pattern, and print selected lines.

GNU grep's source distribution credits Mike Haertel with the main program and the DFA and kwset matchers, Isamu Hasegawa and others with the POSIX regular-expression matcher, James Woods with early Boyer-Moore-style filtering ideas, and later maintainers including Alain Magloire, Bernhard Rosenkranzer, Stepan Kasal, Tony Abou-Assaleh, Jim Meyering, and Paolo Bonzini.

GNU grep's implementation history is unusually important for such a familiar command. The README describes a lazy-state deterministic matcher combined with Boyer-Moore and Aho-Corasick fixed-string searches, allowing the program to reject impossible input before invoking the full regular-expression matcher. That performance lineage is why GNU grep is discussed not only as a utility but also as an example of practical string-search engineering.

采用历史

grep became part of the ordinary Unix vocabulary because it solves a primitive shell need: find matching text in streams and files. GNU grep extended that role across GNU/Linux systems and other Unix-like package sets, while Homebrew and other macOS package managers package it for users who want GNU behavior alongside or instead of platform grep.

The GNU project page documents stable source releases on GNU download servers, Git development through Savannah, bug and commit mailing lists, translation infrastructure, and the manual. That is the classic GNU adoption model: tarball releases, public development, man/info documentation, and downstream distribution through operating-system packages.

使用方式

At the interface, GNU grep searches one or more input files for lines matching one or more patterns and prints matching lines by default. Its ordinary forms cover basic regular expressions, extended regular expressions through grep -E, fixed strings through grep -F, pattern files through -f, recursive search, context lines, filename and line-number prefixes, binary-file behavior, and optional color highlighting.

GNU grep also carries decades of compatibility decisions. The manual marks POSIX-specified options, labels GNU long options as extensions, and documents behavior across encodings, binary data, directories, and performance-sensitive pattern sets. That combination makes it both a user command and a portability boundary for shell scripts.

为什么软件包爱好者会关心

GNU grep is package-nerd significant because it sits in the base-toolchain layer. Scripts, build systems, test harnesses, log pipelines, and interactive shell sessions assume some grep-like command exists, but exact behavior can differ between GNU, BSD, BusyBox, and other implementations.

The egrep and fgrep names show the packaging tension clearly. GNU grep 2.5.3 deprecated those separate commands in 2007, and GNU grep 3.8 began warning that they are obsolescent in favor of grep -E and grep -F. Package maintainers still have to decide how to ship compatibility links while nudging users toward the POSIX-style option forms.

For macOS package users, GNU grep is also a namespace package: Homebrew installs GNU utilities in ways that avoid silently replacing system tools unless users opt into GNU-prefixed commands or path changes.

时间线

  • 1973: The original grep entered early Unix culture as a standalone regular-expression search command.
  • 1992: GNU grep source files carry Free Software Foundation copyright years beginning in 1992.
  • 2007: GNU grep 2.5.3 deprecated the egrep and fgrep command names in favor of grep -E and grep -F.
  • 2012: GNU grep 2.12 adjusted recursive symlink behavior and added the --dereference-recursive alias for -R.
  • 2014: GNU grep 2.21 made GREP_OPTIONS obsolescent with diagnostics.
  • 2020: GNU grep 3.6 removed GREP_OPTIONS behavior.
  • 2022: GNU grep 3.8 switched -P from PCRE to PCRE2 and began warning for obsolescent egrep and fgrep invocations.
  • 2025: GNU grep 3.12 removed the long-obsolete --unix-byte-offsets option and included portability fixes for large directories and some Unicode cases.

Related projects

  • ed is the editor whose g/re/p command gave grep its name.
  • egrep and fgrep survive as historically separate entry points but map conceptually to grep -E and grep -F.
  • GNU sed, GNU awk, find, xargs, ripgrep, The Silver Searcher, ack, git grep, and BusyBox grep all live near GNU grep in the practical text-search ecosystem.
  • PCRE and PCRE2 matter because GNU grep's -P mode uses Perl-compatible regular-expression support when built with it.

安全态势

风险级别:绿色

narrow executable package without higher-risk signals.

风险分类器

绿色 风险 · 低 置信度 · appliance

原因

  • narrow executable package without higher-risk signals

信号

  • metadata:no-higher-risk-signals

安装行为

  • formula 元数据中未记录 Homebrew post-install 钩子。
  • Homebrew bottle 元数据适用于 8 个平台目标。
  • 安装时包含 1 个运行时依赖。
  • 构建元数据列出 1 个构建依赖。

建议审查

在无人值守的代理使用前,请检查该工具是否读取明文凭据、写入远程状态、发布制品或调用插件。

可执行文件

已安装的可执行文件

命令类型暴露范围备注
egrepcli全局可执行文件
fgrepcli全局可执行文件
grepcli全局可执行文件

新鲜度

版本和新鲜度

这些信号区分页生成时间、软件包管理器活动和上游发布比较。只有存在证据 URL 和可比较版本时,才会提示版本落后。

页面生成时间2026-07-10
管理器版本3.12
管理器更新时间
本地数据OK
上游not checked
检测到的最新版本未检测到

https://www.gnu.org/software/grep/

  • 信息No package-manager update timestamp was available.低 置信度
  • 信息Release/tag comparison is only available for GitHub repositories.https://www.gnu.org/software/grep/none 置信度

安装元数据

软件包元数据

软件包键brew:grep
版本3.12
软件包管理器Homebrew
软件包管理器页面https://formulae.brew.sh/formula/grep
主页https://www.gnu.org/software/grep/
仓库https://git.savannah.gnu.org/git/grep.git
上游文档https://www.gnu.org/software/grep/manual
许可证GPL-3.0-or-later
源码归档https://ftpmirror.gnu.org/gnu/grep/grep-3.12.tar.xz
依赖pcre2
构建依赖pkgconf
Bottle可用 (于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux)
Homebrew post-install未定义
服务未声明
注意事项All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc like: PATH="$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$PATH"

注册表事实

源数据库详情

Source DatabaseHomebrew formula API
Taphomebrew/core
Full Namegrep
Version Scheme0
Revision0
Head VersionHEAD
Bottle Stable Root URLhttps://ghcr.io/v2/homebrew/core
Deprecatedno
Disabledno
Keg Onlyno
URL Keys
  • head
  • stable

源数据库匹配

其他软件包管理器记录

匹配项来自外部软件包管理器索引,并与本地 Automic Vault 软件包链接分开显示。

Debian apt95%

grep 3.11-4

GNU grep, egrep and fgrep

https://www.gnu.org/software/grep/

sudo apt install grep
  • Section: utils
  • Architecture: amd64
  • 1 提供
  • normalized package name match
  • 匹配方式:Grep
Debian stable package indexes · deb.debian.org · Debian stable package indexes: grep from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz
Ubuntu apt95%

grep 3.11-4build1

GNU grep, egrep and fgrep

https://www.gnu.org/software/grep/

sudo apt install grep
  • Section: utils
  • Architecture: amd64
  • 1 提供
  • normalized package name match
  • 匹配方式:Grep
Ubuntu 24.04 LTS package indexes · archive.ubuntu.com · Ubuntu 24.04 LTS package indexes: grep from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz
apk95%

grep 3.12-r0

Searches input files for lines containing a match to a specified pattern

https://www.gnu.org/software/grep/grep.html

sudo apk add grep
  • License: GPL-3.0-or-later
  • Architecture: x86_64
  • Source Package: grep
  • 1 依赖
  • 1 提供
  • normalized package name match
  • 匹配方式:Grep
Alpine Linux edge package indexes · dl-cdn.alpinelinux.org · Alpine Linux edge package indexes: grep from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
apk95%

grep-doc 3.12-r0

Searches input files for lines containing a match to a specified pattern (documentation)

https://www.gnu.org/software/grep/grep.html

sudo apk add grep-doc
  • License: GPL-3.0-or-later
  • Architecture: x86_64
  • Source Package: grep
  • normalized package name match
  • 匹配方式:Grep
Alpine Linux edge package indexes · dl-cdn.alpinelinux.org · Alpine Linux edge package indexes: grep-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
dnf95%

grep 3.12-3.fc44

Pattern matching utilities

https://www.gnu.org/software/grep/

sudo dnf install grep
  • License: GPL-3.0-or-later AND LGPL-3.0-or-later AND LGPL-2.1-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later AND GFDL-1.3-no-invariants-or-later
  • Category: Unspecified
  • Architecture: x86_64
  • Source Package: grep
  • 4 依赖
  • 6 提供
  • normalized package name match
  • 匹配方式:Grep
Fedora Rawhide package metadata · dl.fedoraproject.org · Fedora Rawhide package metadata: grep from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst
pacman95%

grep 3.12-2

A string search utility

https://www.gnu.org/software/grep/

sudo pacman -S grep
  • License: GPL3
  • Architecture: x86_64
  • 2 依赖
  • normalized package name match
  • 匹配方式:Grep
Arch Linux sync databases · geo.mirror.pkgbuild.com · Arch Linux sync databases: grep from https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.tar.gz
zypper95%

grep 3.12-1.3

Print lines matching a pattern

https://www.gnu.org/software/grep/

sudo zypper install grep
  • License: GPL-3.0-or-later
  • Category: Productivity/Text/Utilities
  • Architecture: x86_64
  • Source Package: grep
  • 3 依赖
  • 3 提供
  • normalized package name match
  • 匹配方式:Grep
openSUSE Tumbleweed package metadata · download.opensuse.org · openSUSE Tumbleweed package metadata: grep from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst
zypper95%

grep-lang 3.12-1.3

Translations for package grep

https://www.gnu.org/software/grep/

sudo zypper install grep-lang
  • License: GPL-3.0-or-later
  • Category: System/Localization
  • Architecture: noarch
  • Source Package: grep
  • 1 依赖
  • 3 提供
  • normalized package name match
  • 匹配方式:Grep
openSUSE Tumbleweed package metadata · download.opensuse.org · openSUSE Tumbleweed package metadata: grep-lang from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst
MacPorts95%

grep

sudo port install grep
  • normalized package name match
  • 匹配方式:Grep
MacPorts ports tree · api.github.com · MacPorts ports tree: sysutils/grep/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
Chocolatey95%

grep

choco install grep
  • normalized package name match
  • 匹配方式:Grep
Chocolatey community package catalog · community.chocolatey.org · Chocolatey community package catalog: grep from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','gpg4win-vanilla'
Scoop95%

main/grep

scoop install main/grep
  • normalized package name match
  • 匹配方式:Grep
Scoop official bucket manifest trees · api.github.com · Scoop official bucket manifest trees: bucket/grep.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

来源线索

由仓库数据生成

此页面由 av-webscripts/generate-pkg-sqlite.py 生成的私有软件包 SQLite 工件提供。

使用的来源

  • Geiger risk classifier
  • Nucleus package database
  • av.db category and tag curation
  • cross-ecosystem install command graph
  • curated package history
  • external package-manager database matches
  • package relationship graph
  • package version freshness
  • package-page enrichment