比如為了測試,我們使用yum新裝了nginx,那么如何卸載的時候更干凈一些呢?
我們先使用history來查看剛剛執行過的命令
yum history
然后會出現如下所示
[root@localhost ~]# yum history 已加載插件:fastestmirror ID | 登錄用戶 | 日期和時間 | 操作 | 變更數 ------------------------------------------------------------------------------- 5 | root <root> | 2021-03-16 11:22 | I, U | 24 4 | root <root> | 2021-03-16 11:21 | Install | 1 3 | root <root> | 2019-01-23 14:28 | I, U | 46 2 | root <root> | 2019-01-23 14:27 | Install | 1 1 | 系統 <空> | 2019-01-23 22:07 | Install | 313 history list
我們可以根據時間和變更書來判斷,剛剛的操作,可以看到,ID為5是我剛剛安裝的nginx,nginx所變更的文件數為25,那么我們可以執行如下命令撤回nginx安裝
后面的數字:5,為ID
yum history undo 5
這樣就可以把Nginx卸載干凈了