I've tried
gnome-terminal -x 'cd /path/to/dir'
and
gnome-terminal -e 'cd /path/to/dir'
but both give me errors when the new terminal opens. How do I get a new terminal to start in a specific directory?
I've tried
gnome-terminal -x 'cd /path/to/dir'
and
gnome-terminal -e 'cd /path/to/dir'
but both give me errors when the new terminal opens. How do I get a new terminal to start in a specific directory?
You can:
Edit/create the file ~/.bashrc and add this line at the end of the file:
alias cdx='cd /path/to/myfolder'
Save the change and logout/login. When you execute the command "cdx" it will take you to the specified folder.
You can create a shortcut/link that will execute this command:
If you use gnome-terminal (ubuntu):
gnome-terminal --working-directory="/full/path/to/myfolder"
If you use lxterminal (Lubuntu):
lxterminal --working-directory="/full/path/to/myfolder"
you can add nautilus-script like that
Create empty file named as "Open Terminal Here" in
~/.local/share/nautilus/scripts/ # for Ubuntu 13.04 or above
~/.gnome2/nautilus-scripts/ # for Ubuntu 12.10 and below
directory.
Open it and write these lines inside.
#!/bin/bash
gnome-terminal
Make it executable, and right click at any directory in nautilus and select "Scripts > Open Terminal Here" from menu.
This works:
gnome-terminal --tab --title="your title" -- bash -c 'cd /path/to/dir && your_code' &
A few comments:
$ gnome-terminal --version # GNOME Terminal 3.28.1 using VTE 0.52.1 +GNUTLS -PCRE2
Open "~/.bashrc" Scroll to the bottom and add a change directory command Example: cd ~/myfolder
Then save and exit. The "~" will take you to your home folder (/home/loginname)
Each time you launch your terminal it reads the .bashrc file so you could also put search paths ETC.....,, in it.
Open System Settings: -re- down Arrow at top right of Desktop
Select: [user] > Account Settings - [user] is your account name
I have to click on left-top back arrow to get to Settings > Devices
Select: Devices > Keyboard - Devices is near bottom of list
Go to bottom of Keyboard Shortcuts
Click on [+] to create a New Custom Shortcut
Add Custom Shortcut:
Name: [Name your Shortcut]
Command: gnome-terminal --working-directory=[directory path]
my [directory path] is: /home/rob/c/
Click on "Set Shortcut"
Press Shortcut keys you want to use - I use:
Ctrl + Alt + J - to open terminal to my path - not case sensitive
You can Edit or Remove it by clicking on it.
This works for me and Ctrl + Alt + T still works to open terminal.
gnome-terminal --working-directory=/path/to/dir
as
root45 answered
or u can do like this also
if you start gnome-terminal like "gnome-terminal --working-directory=myfolder" it will start with the working directory at ~/myfolder. so you could add a new entry to your menu to use that command instead of the other one.