Custom Path on Ubuntu start

I’ve been trying to customize my Ubuntu terminal.

My next self made task is for the Ubuntu terminal to load a specific path rather than the default on on opening.

To be more specific, I have Nginx installed and want to open that folder on start up.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi @teohristov,

In such cases, you can use the .bashrc file in your user’s root folder. In the .bashrc file you can add any command you want, you can create aliases and so on.

Basically, what you need to do is go to your user’s root folder:

cd ~
nano .bashrc

On the top of the file add

cd /path/to/nginx/installation

where /path/to/nginx/installation is your actual path.

Additionally, you do not have to limit yourself to only this command. Let’s say you want to list the directory as well, just for the kicks of it. You can add ls -lah in the same file underneath the cd command as well.

Usually, once you’ve created aliases or added such commands to your .bashrc file, you need to either reload it or open a new terminal(it reloads/loads by default on new terminal.). You can do it with:

source ~/.bashrc

Hi @teohristov,

Just to give you more information on what else you can achieve with changing/customizing your .bashrc file, you can also add colors to your terminal from there.

To add colors to the shell prompt use the following export command syntax: ‘\e[x;ym $PS1 \e[m’ Where,

  • \e[ : Start the color scheme.
  • x;y : Color pair to use (x;y)
  • $PS1 : Your shell prompt variable.
  • \e[m : Stop color scheme.

You can change the color of the shell prompt by setting the PS1

To set a red color prompt, type the following export command:

export PS1="\e[0;31m[\u@\h \W]\$ \e[m "

Here is a list of colors:

  • Black 0;30
  • Blue 0;34
  • Green 0;32
  • Cyan 0;36
  • Red 0;31
  • Purple 0;35
  • Brown 0;33
  • Blue 0;34
  • Green 0;32
  • Cyan 0;36
  • Red 0;31
  • Purple 0;35
  • Brown 0;33

This comment has been deleted