this is my very first question in here since I just started coding, and I hope it's an easy one. Have found likewise questions on here, but none of their solutions seemed to work for me, or I just didn't know how to pull them off. So here goes:
How do I change the default directory, when I open up Terminal on my Mac version 10.12.4? Whenever I open, it says this of course:
Last login: Thu May 17 09:02:07 on ttys004
Mikkels-MacBook-Air:~ MikkelMalmros$
Then I have to use the "cd desktop/coding" to move to the folder I created for programming. I would like to skip that step, so it automatically opens up in there. I've tried going to preferences and changing "Shell opens with command" thing and put in "cd desktop/coding". Whenever I open up Terminal then, it just says "process done" and I can't write anything at all.
So what am I doing wrong, and is there a way to fix this small problem for me?
Add 'cd path/to/directory' to .bash_profile
'cd path/to/directory'
Found at https://superuser.com/questions/193513/how-can-i-change-the-startup-directory-of-my-terminal-on-os-x
Related
I have just installed Joplin on Fedora, by simply using wget; more specifically this is waht I typed in my terminal:
wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash
All went well and I can now open Joplin by searching it in the Gnome search bar; however I would really like to be able to open it from the terminal, instead of having to search it and then opening it by clicking on its icon.
Typing joplin on my terminal accomplishes nothing.
How can I set up a terminal command to open Joplin? In Windows, for example, I would add the .exe file to the PATH variable.. Is there an analogous way on Fedora or GNU/Linux in general?
I think I will answer my own question here! I realized it's really simple: just make an alias! We can use the search function of our file explorer to find the location of the .AppImage of Joplin, and then simply make the corresponding alias; so it's sufficient to simply type into the terminal:
alias joplin = "/path/to/joplin/appimage"
Done! The next time that we will type joplin the app will be launched! Easy as that!
This should work with any other app too!
Opening a gnome-terminal in the specified directory is straightforward:
gnome-terminal --working-directory ~/dotfiles
Creating hyperlinks is not a problem:
echo -e '\e]8;;file:///home/pmn/dotfiles\aThis is a link\e]8;;\a'
this produces a link that opens the file explorer in the correct folder when Ctrl+Clicked.
What I want to do is combine the two things, so that when I Ctrl+Click the link, a terminal pops up, already in the requested folder. It would not be a problem if the current terminal I'm in changed directory, but in that case I'd like to still see the previous terminal output and just do the equivalent of a regular cd (Edit: Note that the ~/dotfiles folder is just an example, I have several links that are generated by a script, and I'd like to be able to click on them to quickly open a terminal where needed).
I tried fiddling with registering custom applications:
In ~/.local/share/applications/mimeapps.list add:
(Note that the use of this file is deprecated, ~/.config/mimeapps.list should be used, if you have tips on doing that properly I'm open to them)
[Default Applications]
x-scheme-handler/mygnometerm=mygnometerm.desktop
In ~/.local/share/applications/mygnometerm.desktop add:
[Desktop Entry]
Type=Application
Terminal=false
Name=My Gnome Terminal
Exec=/bin/gnome-terminal --working-directory=%f
MimeType=x-scheme-handler/mygnometerm
Create the folder for the mime database:
mkdir -p ~/.local/share/mime/packages
Update the mime database:
update-mime-database ~/.local/share/mime
This does work: if I right-click on a folder in the file explorer and select My Gnome Terminal as the app to use, a terminal is opened already in the right folder.
If I print
echo -e '\e]8;;mygnometerm:///home/pmn/dotfiles\aThis is a link\e]8;;\a'
and click on the link, a terminal does pop up, but in the root folder, and the same happens when running
gio open mygnometerm:///home/pmn/dotfiles
I just need to combine everything, but I tried a lot of combination of what to echo in the link and could not find the right one.
I'm also open to other ways to achieve this behaviour, but at this point I'm quite curious in how to to it this way.
The use case, for the curious, is that I made a simple script to check the status of my repos, and I want to click on the ones with things to do without having to copy and paste the path. I reckon I'll save at least 5 seconds!
Cheers!
I used code ~/zshrc. to go into the file and do some custom styling for my terminal. One of those things I added was echo -e " \e[5m \e[25m" which causes my command line to blink if I haven't initialized git tracking. I did it just for fun and decided after pressing cmd + q in vs code that I wanted to change it. However, this was lost and now when I run code ~/zshrc. it brings me to a blank file with none of the settings I personally added. When I did this I was definitely in my home directory. I'm wondering if there is any way I can undo some changes, go back to the way it was on a previous day, or just reset. Any recommendations? My terminal is not usable with everything flashing. Even running ls all my directories are flashing and I can hardly read it.
Thought I'd post an update. After a break, I came back the next day and noticed that the command I should've been running was code ~/.zshrc and not code ~/zshrc.. That fixed the whole problem so I could edit my zshrc file.
On OSX, every time I start my hyper.is terminal I have to cd desktop, is there a way to configure it to start in /desktop by default instead of the root folder?
I'm not sure how this would be done in hyper.is but this can be done more generally by adding cd ~/Desktop to your bash profile. This can be done by running the following:
echo "cd ~/Desktop" >> ~/.bash_profile
This didn't work for me :(
Here's what worked, which is also answered on How do you change the start location for the hyper.is terminal on OSX
"I spent hours on this yesterday! I ended up having to update the .zschrc file.
I made a walkthrough to hopefully save other people the time to do this.
Even though this walkthrough doesn't talk about Hyper, it did update Hyper as well. "
For Windows, if you have Git installed:
Goto hamburger icon -> Edit -> Preferences
Add shell: 'C:\\Program Files\\Git\\bin\\bash.exe' to your .hyper.js file.
Save and then open .bash_profile file and add cd <whatever location you want> and save it.
Reopen Hyper to see the changes.
A while ago I wrote a Terminal script that executes cd Desktop every time I start Terminal.
With the release of Lion, this is no longer necessary as Terminal remembers where I last left off. I can't figure out how to disable/delete the script because I can't find it. There are also no options in the Terminal preferences that can help me. How do I disable or delete this script?
Probably controlled by one of the following files in your home directory, which you can edit/delete to remove this behavior:
.bashrc
.bash_profile
.profile