如何配置启动文件,以便每次打开新bash时都可以显示磁盘使用情况?

问题描述 投票:0回答:2

我无法找到配置Bash启动文件的方法,以便每次打开新的Bash时都显示我的磁盘使用情况。

我正在使用的脚本是

s=$(du -sh --total | grep "total" | awk '{printf %.3f",$1/5000}')
echo "You are using $s% of your storage"
bash startup du
2个回答
1
投票

你可以将它放在.bash_profile中

vi ~/.bash_profile

如果您想为每个用户添加此项,请使用/ etc / bashrc文件

vi /etc/bashrc

0
投票

通常~/.bash_profile不经常运行。您应该考虑将命令放入~/.bashrc文件中,该文件通常是每个新交互式shell的源。

另请阅读shell的手册页中的INVOCATION一章。

© www.soinside.com 2019 - 2024. All rights reserved.