Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过在不正确的目录中执行 git reset --hard head 意外地对我的 bash 配置进行了一些更改。特别是我使用的一些漂亮的功能。我有一个终端正在运行,它仍然加载了这些功能,我还能以某种方式从环境中重建它们吗?
如果您将它们定义为文件中的函数,您的来源类似于,.bashrc或者.profile您应该能够使用 bash 的type命令。
.bashrc
.profile
type
$ type your_nifty_function
$ declare -f
将列出当前 shell 中定义的所有函数。
declare
declare将打印出所有定义的函数。(以及所有环境变量)。
alias
alias将打印出所有定义的别名。