ag简介:
ag是类似于ack、grep的工具,他可以更快速的在文件中搜索相应的关键字
ag命令安装:
系统环境 CentOS 7
Yum安装:
[root@localhost ]# yum install epel-release -y
[root@localhost ]# yum -y install the_silver_searcher
源码安装:
下载安装包
https://github.com/ggreer/the_silver_searcher
[root@localhost aihuidi]# unzip the_silver_searcher-master.zip
[root@localhost aihuidi]# cd the_silver_searcher-master
[root@localhost the_silver_searcher-master]# ll
total 88
-rw-r--r--. 1 root root 2471 Dec 17 2020 ag.bashcomp.sh
-rwxr-xr-x. 1 root root 475 Dec 17 2020 autogen.sh
-rwxr-xr-x. 1 root root 79 Dec 17 2020 build.sh
-rw-r--r--. 1 root root 2740 Dec 17 2020 configure.ac
-rw-r--r--. 1 root root 1503 Dec 17 2020 CONTRIBUTING.md
drwxr-xr-x. 2 root root 56 Dec 17 2020 doc
-rwxr-xr-x. 1 root root 1291 Dec 17 2020 format.sh
-rw-r--r--. 1 root root 11358 Dec 17 2020 LICENSE
drwxr-xr-x. 2 root root 27 Dec 17 2020 m4
-rw-r--r--. 1 root root 995 Dec 17 2020 Makefile.am
-rw-r--r--. 1 root root 668 Dec 17 2020 Makefile.w32
-rw-r--r--. 1 root root 52 Dec 17 2020 NOTICE
-rwxr-xr-x. 1 root root 188 Dec 17 2020 pgo.sh
-rw-r--r--. 1 root root 7985 Dec 17 2020 README.md
-rwxr-xr-x. 1 root root 4940 Dec 17 2020 sanitize.sh
drwxr-xr-x. 3 root root 4096 Dec 17 2020 src
drwxr-xr-x. 4 root root 4096 Dec 17 2020 tests
-rw-r--r--. 1 root root 4980 Dec 17 2020 _the_silver_searcher
-rw-r--r--. 1 root root 2318 Dec 17 2020 the_silver_searcher.spec.in
[root@localhost the_silver_searcher-master]# ./build.sh
./autogen.sh: line 18: aclocal: command not found
[root@localhost the_silver_searcher-master]# yum -y groupinstall "Development Tools"
[root@localhost the_silver_searcher-master]# yum -y install pcre-devel xz-devel zlib-devel
[root@localhost the_silver_searcher-master]# ./build.sh
configure.ac:11: installing './compile'
configure.ac:22: installing './config.guess'
configure.ac:22: installing './config.sub'
configure.ac:8: installing './install-sh'
configure.ac:8: installing './missing'
Makefile.am: installing './depcomp'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for PCRE... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to run the C preprocessor... gcc -E
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking if compiler needs -Werror to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for library containing inflate... -lz
checking lzma.h usability... yes
checking lzma.h presence... yes
checking for lzma.h... yes
checking for LZMA... yes
checking whether PCRE_CONFIG_JIT is declared... yes
checking whether CPU_ZERO, CPU_SET is declared... yes
checking sys/cpuset.h usability... no
checking sys/cpuset.h presence... no
checking for sys/cpuset.h... no
checking err.h usability... yes
checking err.h presence... yes
checking for err.h... yes
checking for struct dirent.d_type... yes
checking for struct dirent.d_namlen... no
checking for fgetln... no
checking for fopencookie... yes
checking for getline... yes
checking for realpath... yes
checking for strlcpy... no
checking for strndup... yes
checking for vasprintf... yes
checking for madvise... yes
checking for posix_fadvise... yes
checking for pthread_setaffinity_np... yes
checking for pledge... no
checking for clang-format-3.8... no
checking for clang-format-3.7... no
checking for clang-format-3.6... no
checking for clang-format... no
configure: WARNING: clang-format not found. 'make test' will not detect improperly-formatted files.
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating the_silver_searcher.spec
config.status: creating src/config.h
config.status: executing depfiles commands
CC src/ignore.o
CC src/log.o
CC src/options.o
CC src/print.o
CC src/print_w32.o
CC src/scandir.o
CC src/search.o
CC src/lang.o
CC src/util.o
CC src/decompress.o
src/decompress.c: In function ‘decompress_zlib’:
src/decompress.c:52:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
stream.next_in = (Bytef *)buf;
^
CC src/main.o
CC src/zfile.o
CCLD ag
make[1]: Entering directory `/root/aihuidi/the_silver_searcher-master'
make[1]: Leaving directory `/root/aihuidi/the_silver_searcher-master'
[root@localhost the_silver_searcher-master]# make install
make[1]: Entering directory `/root/aihuidi/the_silver_searcher-master'
/usr/bin/mkdir -p '/usr/local/bin'
/usr/bin/install -c ag '/usr/local/bin'
/usr/bin/mkdir -p '/usr/local/share/the_silver_searcher/completions'
/usr/bin/install -c -m 644 ag.bashcomp.sh '/usr/local/share/the_silver_searcher/completions'
/usr/bin/mkdir -p '/usr/local/share/zsh/site-functions'
/usr/bin/install -c -m 644 _the_silver_searcher '/usr/local/share/zsh/site-functions'
/usr/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 doc/ag.1 '/usr/local/share/man/man1'
make[1]: Leaving directory `/root/aihuidi/the_silver_searcher-master'
[root@localhost the_silver_searcher-master]# ag
ag命令的使用