# default directory in CLI



## martins (Jun 27, 2010)

Regardless of a WM, whenever I log in and open the terminal the default directory is /usr/home/my_user. 


```
[xtd8865@bsdtop /usr/home/xtd8865]$ ls      
Desktop				firefox-bin.core
bin				sent
data				temp
downloads			xfce4-settings-help.core
[xtd8865@bsdtop /usr/home/xtd8865]$ pwd
/usr/home/xtd8865
[xtd8865@bsdtop /usr/home/xtd8865]$ cd
[xtd8865@bsdtop ~]$ pwd
/home/xtd8865
[xtd8865@bsdtop ~]$
```


```
$ echo $SHELL
/usr/local/bin/bash
```

~/.bash_profile

```
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV
# set prompt: ``username@hostname:/directory $ ''
PS1="[\u@\h:\w] " 
case `id -u` in
      0) PS1="${PS1}# ";;
      *) PS1="${PS1}$ ";;
esac
```

I can't see anything interesting in .shrc


thank you


----------



## nekoexmachina (Jun 27, 2010)

`$ echo $HOME`
`$ file /home /home/*`


----------



## wblock@ (Jun 27, 2010)

martins said:
			
		

> Regardless of a WM, whenever I log in and open the terminal the default directory is /usr/home/my_user.



Yes, that's what it's supposed to do, start you in your home directory.


----------



## martins (Jun 27, 2010)

```
[xtd8865@bsdtop /usr/home/xtd8865]$ echo $HOME
/home/xtd8865
```


```
file /home /home/*
/home:         symbolic link to `usr/home'
/home/xtd8865: directory
```

I see, in BSD the /home directory is just a link to /usr/home. I didn't know about it. I come from linux.


----------



## hedwards (Jun 27, 2010)

Bash would be a bit odd if it always dumps you in your home directory, as that's not what the default shell does.

Under the default shell, you'd end up wherever you were when you initiated the terminal session. Meaning that if you start a WM session from /usr/ports after upgrading ports, you'd end up with your terminal sessions beginning there, IIRC.


----------



## Beastie (Jun 27, 2010)

Try this: before starting X, cd to any directory then start X. Open a terminal emulator and do a pwd.

$HOME can be anywhere you choose when partitioning/installing for the first time.

BTW, you can remove those 2 core dumps in your home directory.


----------



## fronclynne (Jun 27, 2010)

hedwards said:
			
		

> Bash would be a bit odd if it always dumps you in your home directory, as that's not what the default shell does.
> 
> Under the default shell, you'd end up wherever you were when you initiated the terminal session. Meaning that if you start a WM session from /usr/ports after upgrading ports, you'd end up with your terminal sessions beginning there, IIRC.



Without slogging through what bits of the environment get passed at what stage, that might depend rather strongly on whether it was a login shell or not.  I don't know, but that some WMs might pass [red]-l[/red].  I know you can, I just don't know about all the defaults.


----------



## hedwards (Jun 27, 2010)

Ah, I'm never sure whether that makes more or less sense than just defaulting to the home directory. Never really cared enough to figure it out either.


----------

