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.
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.
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.
Default home directory per operating system The file /etc/xdg/user-dirs.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With