Linux 排查命令
date
slug
linux-troubleshooting-commands
author
status
Public
tags
技术分享
summary
type
Post
thumbnail
category
💻 Backend
updatedAt
Oct 29, 2023 10:05 AM
查找指定进程
ps -ef|grep svn
查找指定进程个数
ps -ef|grep svn -c
ps -ef|grep -c svn
从文件中读取关键词进行搜索
cat test.txt | grep -f test2.txt
说明:
输出test.txt文件中含有从test2.txt文件中读取出的关键词的内容行
从文件中读取关键词进行搜索 且显示行号
cat test.txt | grep -nf test2.txt
说明:
输出test.txt文件中含有从test2.txt文件中读取出的关键词的内容行,并显示每一行的行号
从文件中查找关键词
grep 'linux' test.txt
从多个文件中查找关键词
grep 'linux' test.txt test2.txt
grep不显示本身进程
ps aux|grep \[s]sh
ps aux | grep ssh | grep -v "grep"
找出有u开头的行内容
cat test.txt |grep ^u
转换为16进制
printf "%x\n" 10804