Use of aliases

I just want to ask if these aliases are persistent or it only work for the session you are working

e.g hy=" history"

… wld this alias be valid if i were to use it at another time?? or is it only valid for that session.

They only live for that session, so the command has to be run for each session where you want to use it.

Put things you want to run each time in .bashrc

cd() {
  # automatically list files after changing directory with cd
  command cd "$@" && ls

I tend to put machine-specific things in .bashrc and then source another file for stuff I use on all computers

1 Like

From Alias 1, what do I write for filename? and how?

In the bash profile, beneath the previous alias, add

alias hy=“history”
Save the file.

Press Enter to write the filename.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.