turn off bash colored prompts for all users

Reindl Harald h.reindl at thelounge.net
Fri Aug 2 22:03:38 UTC 2013


Am 02.08.2013 23:56, schrieb Joe Zeff:
> On 08/02/2013 02:30 PM, Tom Horsley wrote:
>> In fact, I have thwarted that on my system by running a
>> yum "hook" function that re-applies all my hacks every time
>> there is an update, but it is silly that I have to resort
>> to that.
> 
> This is why I referred to my method as elegant: I don't need to know where the colors are set up and I don't need
> to worry about updates stepping on my changes.  I've applied it to my own .bashrc and root's. There are two friends
> who have accounts for ssh reasons, and if they don't like color ls, they can either change it, or ask me about it
> because I'm not imposing my preferences on them

a more elegant method would be to "source" a central file

/root/.bashrc:
if [ -f /usr/local/etc/bash_profile ]; then
 . /usr/local/etc/bash_profile
fi

/home/harry/.bashrc:
if [ -f /usr/local/etc/bash_profile ]; then
 . /usr/local/etc/bash_profile
fi
_______________________________________

[root at srv-rhsoft:~]$ cat /usr/local/etc/bash_profile
alias dir='/usr/bin/ls -a -l -h --color=tty -X --group-directories-first --time-style=long-iso'
alias rm='/usr/bin/rm -I --one-file-system'
alias cp='/usr/bin/cp -i'
alias mv='/usr/bin/mv -i'
alias ls='/usr/bin/ls -l -h --color=tty -X --group-directories-first --time-style=long-iso'
alias df='/usr/bin/df -hT --exclude-type=tmpfs --exclude-type=devtmpfs'
alias ..='cd ..'
alias ...='cd ../..'
alias grep='/usr/bin/grep --color'
alias chown='/usr/bin/chown --preserve-root --changes --no-dereference'
alias chmod='/usr/bin/chmod --preserve-root --changes'
alias repair_mysql='/usr/bin/mysqlcheck -h localhost --check-upgrade --all-databases --auto-repair --user=root -p'
alias free="/usr/bin/free -m"
alias rkhunter='/usr/bin/rkhunter --skip-keypress  --report-warnings-only'
alias nmap_scan='/usr/bin/nmap -O -sV -T4 -d'

alias firewall_status='/usr/sbin/iptables --list --numeric --verbose | grep -v LOG'

alias nat_status='/usr/sbin/iptables -t nat --list --numeric --verbose; echo ""; echo
"----------------------------------------------------"; /usr/bin/netstat-nat -x | sort -n; echo ""; echo "Tracked
Connections:"; /usr/bin/netstat-nat -n | wc -l'
alias mysql='/usr/bin/mysql -u root -p'
alias mysql_upgrade='/usr/bin/mysql_upgrade -u root -p'
alias repair_mysql='/usr/bin/mysqlcheck -h localhost --check-upgrade --all-databases --auto-repair --user=root -p'
alias analyze_mysql='/usr/bin/mysqlcheck -h localhost --analyze --all-databases --user=root -p'
alias ntp_status='watch "/usr/sbin/ntpq -p"'
alias bond_status='cat /proc/net/bonding/bond0'
alias netstat='/usr/bin/netstat --numeric-hosts --numeric-ports --programs -u -t'
alias fsck.ext4='/usr/sbin/fsck.ext4 -C 0 -f'
alias systemctl='/usr/bin/systemctl --no-pager --full'
alias clamscan='/usr/bin/clamscan --log=/var/log/clamscan.log --infected --recursive=yes --cross-fs=yes
--scan-pe=yes --scan-elf=yes --scan-ole2=yes --scan-pdf=yes --scan-html=yes --scan-archive=yes'
alias uname='/usr/bin/uname -rv'
alias route='/usr/sbin/route -n'
alias bash_history='/usr/bin/cat ~/.bash_history'
alias rate_control='/usr/bin/watch "/usr/sbin/iptables --list --numeric --verbose | grep -v LOG | grep hit_count;
/usr/sbin/iptables --list --numeric --verbose | grep -v LOG | grep conn; echo \"\"; echo \"Tracked IPs\"; cat
/proc/net/xt_recent/DEFAULT | wc -l"'
alias kate='/usr/bin/kate --graphicssystem native'
alias ssl_bench='openssl speed -evp aes-256-cbc aes-128-cbc rc4 bf-cbc'
alias readahead_analyze='/usr/lib/systemd/systemd-readahead analyze'
alias bind_version='dig version.bind chaos txt'

export HISTCONTROL=erasedups:ignorespace
export HISTTIMEFORMAT='%F %T '

export GREP_COLOR="00;41"

if ([ "$TERM" != "screen" ] && [ "`pgrep screen`" != "" ] && [ "$SSH_TTY" != "" ]); then
 screen -r 2> /dev/null
fi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20130803/97c7881c/attachment.sig>


More information about the users mailing list