Spun up an AWS Ubuntu 20.04.2 server. This server sits behind a jump server.
Once the server spun up, I ran:
sudo update
sudo upgrade
As well as rebooted the server. After that, created an ~/.bash_aliases
file and added the following alias:
alias lsd='ls -a -g --group-directories-first'
After saving the .bash_aliases, reloaded .bashrc: source ~/.bashrc
When using the alias, the following error is shown:
xxx@ip-1-2-3-4:~$ lsd
's: unrecognized option '--group-directories-first
Try 'ls --help' for more information.
Verified the following:
- full command will run without the alias
- alias works when adding directly to the ~/.bashrc file
Also verified .bashrc
is reading in the aliases:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Question: How can I use the .bash_aliases file over ssh?
I've read through a similar question, but the solution there doesn't seem to work: Why doesn't my alias work over ssh?
I'm coming from a Windows background and just now starting to work in the Linux world; be gentle.
Edit for Context
The .bash_aliases
file was edited locally on Windows with the MobaTextEditor while ssh'd into the server. Even though the empty file was created on the server, the Unix style encoding was not implied in the editor as the file was empty. Windows encoding was added to the file after editing and saving back to the server with the MobaTextEditor.