AlmaLinux 9.2 historyコマンドでコマンド履歴を検索する方法

環境
AlmaLinux release 9.2 (Turquoise Kodkod)

構文
history | grep <検索文字列>
historyコマンドでコマンド履歴を検索します。

操作例1
# history |grep mysql

結果

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
111 systemctl start mysqld.service
112 systemctl status mysqld.service
111 systemctl start mysqld.service 112 systemctl status mysqld.service
111 systemctl start mysqld.service
112 systemctl status mysqld.service

操作例2
# history | grep nginx.service

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
407 systemctl stop nginx.service
412 systemctl start nginx.service
485 systemctl restart nginx.service
407 systemctl stop nginx.service 412 systemctl start nginx.service 485 systemctl restart nginx.service
407 systemctl stop nginx.service
412 systemctl start nginx.service
485 systemctl restart nginx.service

 

AlmaLinux 9

Posted by arkgame