centos 关闭"You have mail in /var/spool/mail/root"

centos 下

终端下, 回车即出现的"You have mail in /var/spool/mail/root"

root 用户下

vim  /etc/profile 末尾加入:

unset MAILCHECK

保存:wq!

.  /etc/profile 或者source /etc/profile

以下是 CentOS 7 中 `/etc/profile` 文件的默认代码: ```bash # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } if [ -x /usr/bin/id ]; then if [ -z "$EUID" ]; then # ksh workaround EUID=`id -u` UID=`id -ru` fi USER="`id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" fi # Path manipulation if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin fi pathmunge /usr/local/bin pathmunge /usr/bin pathmunge /usr/local/go/bin pathmunge /usr/local/nodejs/bin pathmunge /usr/local/mysql/bin pathmunge /usr/local/php/bin pathmunge /usr/local/python3/bin pathmunge /usr/local/nginx/sbin pathmunge /root/bin after HOSTNAME=$(hostname) export HOSTNAME # Set the initial umask. Only users can change this setting. if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi # Are we an interactive shell? if [ "$PS1" ]; then if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then # The file bash.bashrc already sets the default PS1. # PS1='\h:\w\$ ' if [ -f /etc/bashrc ]; then . /etc/bashrc fi else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi fi # Try to keep environment pollution down, EPA loves us. unset ENV RCFILE REPLY_HISTORY_FILE INPUTRC GLOBIGNORE unset -f pathmunge ``` 注意,这是默认代码,如果您对其进行了修改,可能会与此不同。建议在修改之前备份此文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值