Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reset the startup directory to my HOME in Fish?

Tags:

shell

fish

In my desktop manager, I have bound fish to a keyboard shortcut Ctrl + ~. On startup, fish opens the directory /usr/lib/lightdm/lightdm. This is quite annoying, because I have no business with lightdm, and I usually work on code in my $HOME directory.

How can I change the directory that fish starts in? I would like to change the startup directory simply to ~/

like image 436
codysehl Avatar asked Apr 14 '13 15:04

codysehl


People also ask

How do I set the default fish terminal?

If you wish to use fish (or any other shell) as your default shell, you need to enter your new shell's executable /usr/local/bin/fish in two places: add /usr/local/bin/fish to /etc/shells. change your default shell with chsh -s to /usr/local/bin/fish.

Where is fish RC file?

The settings that would normally be written to a ~rc file are instead located in the config. fish file at ~/. config/fish . This means the same Bash-style syntax can't be used, so you will have to use the previously written descriptors unique to Fish.

How do you set up a fish shell?

Simply run fish_config to open the web client. From there, you can choose the themes, colors, prompts, inspect the FSH functions and variables, and see the history of commands used. Changes are, in turn, stored in the ~/. config/fish folder and can be accessed and edited there to dodge the optional web configuration.

How do you exit a fish terminal?

Just type bash and you'll start the bash shell. type exit to return to fish shell when you're done.


1 Answers

I had found that the config.fish file that runs at startup had been changing my default working directory.

A misguided attempt at setting my PATH left a list of directories in my config.fish, the first of which was /usr/lib/lightdm/lightdm. Fish automatically assumes directories without a command should be cd`d into, so my shell was cd`ing into that directory at startup.

I removed the stray lines and all is well.

To change your fish startup directory: add cd /path/to/new/startup/directory to your ~/.config/fish/config.fish file, or create it if it does not exist.

like image 81
codysehl Avatar answered Sep 27 '22 17:09

codysehl