Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to default to other directory instead of home directory

I am developing on a windows machine. The only place I need for linux command line is Git Bash. The problem is: When I open it, I am in the home directory. I have to change the directory to my workspace, like:

cd ../../../d/work_space_for_my_company/project/code_source 

Can I wrap this in a .sh file so I don't have to hand-type it anymore? This should be simple but I have zero knowledge about Linux command line. I am really appreciated If you can walk me through how to create that .sh file.

like image 598
Xi 张熹 Avatar asked Aug 10 '11 20:08

Xi 张熹


People also ask

How do I change the default home directory?

Changing the Default Home DirectoryThe usermod command modifies a user account information. We specify the desired home directory with the -d parameter. Actually, there's a problem with the usermod command that we've just run. We could have some files already created in our previous home folder.

How do I change the default home location in Linux?

You can use the usermod command to change the default home directory for a user. What this command does is edit the file /etc/passwd. Opening /etc/passwd you will find there is a line for every user, including system users (mysql, posftix, etc), with seven fields per line denoted by colons.

Which is the default home directory?

Default home directory per operating system The file /etc/xdg/user-dirs.


1 Answers

Here's a more Windows-ish solution: Right click on the Windows shortcut that you use to launch git bash, and click Properties. Change the value of "Start In" to your desired workspace path.

Edit: Also check that the Target value does not include the --cd-to-home option as noted in the comments below.

like image 129
David Siegal Avatar answered Sep 29 '22 09:09

David Siegal