我无法找到配置Bash启动文件的方法,以便每次打开新的Bash时都显示我的磁盘使用情况。
我正在使用的脚本是
s=$(du -sh --total | grep "total" | awk '{printf %.3f",$1/5000}')
echo "You are using $s% of your storage"
你可以将它放在.bash_profile中
vi ~/.bash_profile
如果您想为每个用户添加此项,请使用/ etc / bashrc文件
vi /etc/bashrc
通常~/.bash_profile
不经常运行。您应该考虑将命令放入~/.bashrc
文件中,该文件通常是每个新交互式shell的源。
另请阅读shell的手册页中的INVOCATION
一章。