命令行 删除在打开终端时出现的有关sudo的注释

分享于 

2分钟阅读

ubuntu

  繁體

问题

每当我打开终端,


To run a command as administrator (user"root"), use"sudo <command>". 


See"man sudo_root" for details.



这出现在终端之前,如何才能让它消失?


答案1

创建文件~/.sudo_as_admin_successful后,警告将消失,运行sudo命令,例如sudo apt-get update或手动创建~/.sudo_as_admin_successful文件:


touch ~/.sudo_as_admin_successful



如果出于原因想返回警告,请删除~/.sudo_as_admin_successful


rm ~/.sudo_as_admin_successful




答案2

注释掉:sudo vim /etc/bash.bashrc相关节,注释掉:


# sudo hint


# if [ ! -e"$HOME/.sudo_as_admin_successful" ]; then


# case" $(groups)" in * admin *)


# if [ -x /usr/bin/sudo ]; then


# cat <<-EOF


# To run a command as administrator (user"root"), use"sudo <command>".


# See"man sudo_root" for details.


# 


# EOF


# fi


# esac


# fi



查找要启动的文件:


$ sudo grep -R"man sudo_root" /etc



结果:


/etc/bash.bashrc: See"man sudo_root" for details.





COM  COMM  Comma  命令行  TERM  终端