How To Open New Terminals in Sub-directories

Last updated 2 months ago

How to open new terminals in directories other than `/root/sandbox/`

Using Terminal Settings

Sometimes you may want terminals to default to a particular directory within a project, and not the /root/sandbox/ to prevent users from having to repetitively enter cd commands.

To accomplish this:

  1. While in the Creator, select the "Interface" tab:

Interface tab

2. Then, scroll to the "Terminal Tabs" options:

Terminal options

In the "Terminal Tabs" section enter cd {{directory-path}} where {{directory-path}} is the path to the desired sub-directory. This will run for the first terminal that is open when the project starts and the cd /var/www/html will be visible in the terminal. Furthermore, this will not be applied to new terminals created in the project. To get this effect, we must take alternative steps.

Using a Startup Script

1. Go to the "Settings" tab:

Settings tab

2. Navigate to the "Startup Script" option and enter the following:

printf '#!/bin/bash\ncd /root/sandbox/{{directory-path}}' >> /root/.bashrcs/
Startup script

... where {{directory-path}} is the path to your directory ("/var/www/html").

New tabs will now open in the sub-directory of your choice.