Change terminal directory

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
GrandpaRobin

Change terminal directory

Post by GrandpaRobin »

Have had Mint for a couple of months and I LOVE it! And it's FREE!

Anyway, the learning curve has been a little steep for me. I am taking a JAVA class and I save the exercises on my Google drive (using InSync). I'm doing good in the class (I used to write COBOL) but not so good learning Linux.

Is there some way to configure a terminal session to start in a particular directory? I can't find anything in profile preferences. I've tried to write a bash script (finally figured out how to and set execute permission) but it won't run cd or it won't recognize directories with spaces (i.e. "Google Drive"/"CIS 211") or I don't know how to format the command. I've spent a week trying to find an online tutorial I can understand but they all use terms I don't know yet. I'm still excited by Mint but I need a boost over some of the tyro hurdles. I know eventually I look back and say "DUH!". I know it's a stupid little thing but I'm tired of typing in the change every time.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18206
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Change terminal directory

Post by karlchen »

Hello, GrandpaRobin.

This here should be for you: Introduction to the commandline.
It is not as complicated as most people assume. And to a certain extent, it is all pretty logical.
Have fun!
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
User avatar
karlchen
Level 23
Level 23
Posts: 18206
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Change terminal directory

Post by karlchen »

Hello, GrandpaRobin.

About ways to make a terminal open in a particular folder: Many ways lead to Rome. Here is one:
Use your favourite file-manager Nemo and navigate to the parent folder of the folder where you want the terminal window to open.
Example:
I want to open a terminal window in the folder ~/Downloads. ~/Downloads is the shorthand writing for /home/karl/Downloads.
So what I'll do is this:
  • Open Nemo.
  • Navigate to /home/karl or directly click on "Home Folder".
  • In the list of subfolders I select "Downloads" and right click it.
  • From the right-click context menu I select "Open in terminal".
  • Voilà, a terminal window opens and the command prompt proves, the current path is ~/Downloads. The $ sign is just the default command prompt for normal users.
These steps are convenient in all cases where I want to open terminal window in any folder which has just come up to my mind.

HTH,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
GrandpaRobin

Re: Change terminal directory

Post by GrandpaRobin »

Thanks Karl! Two excellent suggestions! I thought 'start in terminal' was for executables. And I will definetly check out the command line reference.
grumpycrocodile

Re: Change terminal directory

Post by grumpycrocodile »

to change to my bin directory, from anywhere, i set an alias for p
alias "p"=cd\ ~/bin
seems to work so far, not sure if this is exactly what you want to do
Locked

Return to “Scripts & Bash”