How do I make a command run automatically (in my case: alias t="todo.sh") whenever I open a new terminal window? I've looked for many posts but they all have personalised commands, which then led to personalised answers. Can anybody help me with this?

  • Look for shell startup files e.g. ~/.bashrc and ~/.zshrc etc There are many about this. All files are personalised each user has different ones. You are asking for a personalised one as well. There are many generic answers to this and the shell manuals give exact answers
    – mmmmmm
    Jan 12 '21 at 13:20
  • Which specific posts have you looked at already?
    – nohillside
    Jan 12 '21 at 13:21

Each shell has initialisation files which get run at each start (aka new Terminal tab/window). Put the command into the appropriate one and it will be available in new tabs.

  • for bash, use ~/.bashrc
  • for zsh, use ~/.zshrc

You can use echo $SHELL to determine which shell you are using.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .