Ubuntu terminal一直提示使用sudo 执行命令

本文介绍如何去除Terminal中关于使用sudo命令的警告信息。通过运行一次sudo命令或手动创建~/.sudo_as_admin_successful文件即可实现。如果希望恢复警告,只需删除该文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

每次打开Terminal, 窗口上方都会出现
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

解决方法:
Once you run a sudo command, the file ~/.sudo_as_admin_successful will be created and the warning will go away. So either run a sudo command, such as sudo apt-get update or create the ~/.sudo_as_admin_successful file manually:

touch ~/.sudo_as_admin_successful

If you want the warning back for whatever reason, remove ~/.sudo_as_admin_successful

do grep -R “man sudo_root” /etc`

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值