[I. Basics] 1.10 脚本:CentOS6.9 RESET.sh

#!/bin/bash
# filename: CentOS6.9 RESET.sh
# date: 2018-06-16

# 1. Automatic login GUI desktop by root identifiy
autoTrue="AutomaticLoginEnable=true"
autoRoot="AutomaticLogin=root"
sed -ri "/\[daemon\]/s/(\[daemon\])/\1\n${autoTrue}\n${autoRoot}/" /etc/gdm/custom.conf

# 2. Modify PS1 prompt visual style
echo 'PS1="\[\e[1;32m\][\u@\h \W]\\$\[\e[0m\]"' > /etc/profile.d/env.sh
source /etc/profile.d/env.sh

# 3. Add DIY aliases into ROOT`s .bashrc
cat >> ~/.bashrc << EOF
`echo`
#DIY aliases for Lab Testing
`echo`
alias cdhtml='cd /var/www/html'
alias cdnet='cd /etc/sysconfig/network-scripts/'
alias egrep='egrep --color=auto'
alias disepel='sed -ri /enabled/s/enabled=1/enabled=0/ /etc/yum.repos.d/base.repo'
alias epel='sed -ri /enabled/s/enabled=0/enabled=1/ /etc/yum.repos.d/base.repo'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias p='poweroff'
alias rb='reboot'
alias scandisk='echo - - - > /sys/class/scsi_host/host2/scan'
alias yr='yum remove'
alias yy='yum -y install'
alias vi='vim'
alias vie0='vim /etc/sysconfig/network-scripts/ifcfg-eth0'
alias vie1='vim /etc/sysconfig/network-scripts/ifcfg-eth1'
alias viht='vim /etc/httpd/conf/httpd.conf'
alias vimy='vim /etc/my.cnf'
alias nr='service network restart'
alias hr='service httpd restart'
EOF
source ~/.bashrc

# 4. Reboot 
reboot

猜你喜欢

转载自blog.csdn.net/gymumanalvin/article/details/80715447