I am trying to create an alias and I have added this line in ~/.bash_aliases
:
alias server-python='open http://localhost:8000 && python -m SimpleHTTPServer'
alias ssh-saad='ssh saad@<my-server>' <my-server>
is replaced by the IP address of my server. So in my ~/.bashrc
file these lines are uncommented
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
and in my ~/.profile
:
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
I believe that whenever I start the terminal my aliases should work. However, unless I run the command source ~/.bash_aliases
it’s not working. Also, for the first server-python
alias I am getting an error:
Couldn't get a file descriptor referring to the console
I have looked into these solutions here:
How to create a permanent "alias"?
Ubuntu alias not applied in bashrc
but still cannot make it work. I would really appreciate it if someone could point out to me what I am doing wrong. I know that the problem is very trivial, but I must be just missing something.
I have now fixed the error
Couldn't get a file descriptor referring to the console
by using sensible-browser
instead of open
:
alias server-python='sensible-browser http://localhost:8000 && python -m SimpleHTTPServer'
alias name='commands' something
The something part shouldn't work.