每次进入终端机都可以不输入jupyter notebook而输入jp吗?我尝试为~/.bash_profile添加别名,但不起作用
alias jp = 'jupyter notebook'
上面写着
-bash: ‘jupyter: command not found
发布于 2017-05-29 12:24:24
有不同的方法可以做到这一点:
第一个~/.bashrc
使用您选择的editor
打开~/.bashrc,并在Alias
后面添加一些行
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
alias jp='jupyter notebook'
保存并关闭它。
别名第二个~/.bash_
一个更明确的方法是touch
一个新文件~/.bash_aliases,然后用你经常选择的editor
打开它。添加几行,保存并关闭它。
alias jp='jupyter notebook'
alias la='ls -al'
alias ..='cd ..'
要重新加载bash_aliases,您需要在.bashrc中添加以下行
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
最后,您需要重新加载源代码:
第一种方法:
$ source ~/.bashrc
第二种方式,创建新文件后:
$ source ~/.bash_aliases
https://stackoverflow.com/questions/44234140
复制相似问题