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.
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!
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
This comment has been deleted
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:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.