Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Customize your own shell login script

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Edit the .bash _ profile file under your own user

# .bash _ profile

# export

PS1= "\ n\ e [1Trac32m [\ e [0trans31m\ u\ e [0Tract34m @\ e [0trans31m\ h\ e [1ut32m]\ e [1transfer32m [\ e [0trans34m\ w\ e [1umbent 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 $1}'`

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

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

Disk_size=$ (df-h-- block-size=1024 | awk'{sum + = $2;} 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 [22better31m% s\ t% s\ t% s\ n", $1meme 6m 5m 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report