Customizing your own Shell logon scripts

Source: Internet
Author: User

Edit the. bash_profile file under your own user

#. Bash_profile

#export

Ps1= "\n\e[1;32m[\e[0;31m\u\e[0;[ Email protected]\e[0;31m\h\e[1;32m]\e[1;32m[\e[0;34m\w\e[1;32m]$ "


# Get the aliases and functions

If [-f ~/.BASHRC]; Then

. ~/.bashrc

Fi


# User specific environment and startup programs

#User specific environment and startup programs

Path= $PATH: $HOME/bin:/usr/bin/:/usr/local/bin:/usr/sbin:/sbin

Export PATH

Unset USERNAME

Umask 022


#Custom djravine Modification

login_pwd= ' pwd ';

Login_data= ' Date ';

login_users= ' users ';

Logic_uptime= ' uptime ';

server_ip= '/sbin/ifconfig |grep ' inet addr: ' |grep-v ' 127.0.0.1 ' |head-1|cut-d:-f2|awk ' {print '} ';

disk_available=$ (df-h--block-size=1024|awk ' {sum + = $4;} END {print sum;} ');

disk_used=$ (df-h--block-size=1024|awk ' {sum + = $;} END {print sum;} ');

disk_size=$ (df-h--block-size=1024|awk ' {sum + = $;} END {print sum;} ');

Disk_available_gb=$ (echo "scale=2; $disk _available/(1024^2) "|BC)

Disk_used_gb=$ (echo "scale=2; $disk _used/(1024^2) "|BC)

Disk_size_gb=$ (echo "scale=2; $disk _size/(1024^2) "|BC)

Red= "\033[31m"

Blue= "\033[34m"

Green= "\033[32m"


Echo-e ""

Echo-e "${blue}+---------------------------------------------------------------"

Echo-e "${green} welcome! "

Echo-e "${blue}+---------------------------------------------------------------"

Echo-e "${green}server IP: ${red}" $server _ip

Echo-e "${green}date: ${red}" $login _data

Echo-e "${green}users: ${red}" $login _users

Echo-e "${green}directory: ${red}" $login _pwd

Echo-e "${green}uptime: ${red}" $logic _uptime

Echo-e "${blue}+---------------------------------------------------------------"

Echo-e ""

Df-lh|column-c 6|awk ' {printf ' \033[22;32m%s\t%s\t\033[22;31m%s\t%s\t%s\n ', $1,$6,$2,$3,$4,$5} '

Echo-e "${green}total Disk Space: ${red} $disk _size_gb GB"

Echo-e "${green}total used Space: ${red} $disk _used_gb GB"

Echo-e "${green}total free Space: ${red} $disk _available_gb GB"

Echo-e "${blue}+---------------------------------------------------------------"

Path= $PATH: $HOME/bin


Export PATH


This article is from the "10620401" blog, please be sure to keep this source http://10630401.blog.51cto.com/10620401/1946039

Customizing your own Shell logon scripts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.