# new to FreeBSD but not linux...got a question



## gentoobob (Jan 14, 2009)

I cannot use the tab key to auto complete words like you can in linux.  Is there a way in FreeBSD to do that?  I'm using the default FreeBSD shell as a normal user.  I do not want to switch to the bash shell, id like to keep my experience as close to unix as possible.  Just curious if i could get the tab function working under the current shell, CSH.


----------



## DutchDaemon (Jan 14, 2009)

Tab-completion is not a feature of csh, which is why there is tcsh (guess what the 't' is for ..). If you look at 'man csh' (which ends up in 'man tcsh') you can see the differences. Note:


```
Throughout  this  manual,  features  of  tcsh  not found in most csh(1)
       implementations (specifically, the 4.4BSD csh) are labeled with  `(+)',
       and features which are present in csh(1) but not usually documented are
       labeled with `(u)'.
```


----------



## kamikaze (Jan 14, 2009)

Actually in FreeBSD /bin/csh is a hardlink to /bin/tcsh. You can activate completion with the command [cmd=set]autolist[/cmd]. To make this change permanent, add the command to the file ~/.cshrc.


----------



## gnemmi (Jan 14, 2009)

That's weird ... tab completion works in here even though autolist is not set .. 
Anyways you can still use Ctrl+D to get a list of the possible completions of a word. Take a look at tcsh(1) and look for the "Completion and listing (+)" title for more information.


----------



## gentoobob (Jan 14, 2009)

Hey guys, thanks for the help.  I did look at the man, apparently I over looked it.  If you stare at these screens all the time, everything looks the same!!!  lol thanks again.


----------



## gentoobob (Jan 14, 2009)

actually guys, that didnt work.  the Ctrl+D didnt work neither does adding it to the .cshrc file.  I have added set autolist  and I even added another alias...nothing worked, i logged out and back in, then I rebooted...still no changes took a affect.  any ideas?


----------



## gentoobob (Jan 15, 2009)

well it works under root, not my user account...i will look into it later...thanks guys.


----------



## cajunman4life (Jan 15, 2009)

I know it shouldn't matter, but just for kicks, put "set autolist" in ~/.tcshrc, log out and back in, and see if that helps.


----------



## tangram (Jan 15, 2009)

gentoobob said:
			
		

> well it works under root, not my user account...i will look into it later...thanks guys.



$ echo "set autolist" >> ~/.cshrc

Also take look at man tcsh and http://dotfiles.org/. It has loads of cool configs.


----------



## gentoobob (Jan 15, 2009)

well, there is no .tcshrc under my home folder.  nor is there for root either.  is it possible that my shell isnt linked to tcsh?


----------



## gentoobob (Jan 15, 2009)

another issue...is that if i had alias to my user .cshrc, nothing happens, but if I add the same alias to roots .cshrc, it works.  Also roots .cshrc doesnt even have "set autolist" in the file.


----------



## gentoobob (Jan 15, 2009)

i also just discovered (sorry for all the post) that NONE of the aliases that were in my .cshrc file by default work!!!


----------



## gentoobob (Jan 15, 2009)

AHHHH!  lol  I got it fixed.... it would help if my user was under the CSH SHELL!!!!  lol  WHOOHOO!   

just ran chsh -s /bin/csh   fixed!!!  You guys are crazy..thanks.


----------



## tangram (Jan 15, 2009)

Just to consolidate the subject here a couple of notes. Maybe it can help out someone who faces the issue in the future.

If you don't have a *.cshrc* you can just create it by doing:


```
$ echo "set autolist" >> ~/.cshrc
```

Whenever you make changes to your *.cshrc* file you need to source it, like so:


```
$ source ~/.cshrc
```

To check your assigned shell:


```
$ echo $SHELL
```

To change it (or view the user's current shell) you can use *chsh* like this:

```
$ chsh
```

And edit the shell path to point to the desired shell. Or in alternative run *chsh* with the *-s* argument and specify the new shell like so:


```
$ chsh -s tcsh
```


----------



## keramida@ (Jan 17, 2009)

*Use bash if you like it, no reason to fear installing it*



			
				gentoobob said:
			
		

> I cannot use the tab key to auto complete words like you can in linux.  Is there a way in FreeBSD to do that?  I'm using the default FreeBSD shell as a normal user.  I do not want to switch to the bash shell, id like to keep my experience as close to unix as possible.  Just curious if i could get the tab function working under the current shell, CSH.



For what it's worth, there is nothing "wrong" about installing bash or zsh.  They are both far more featureful than the bare-bones "/bin/sh" shell of FreeBSD, and installing them from ports or packages is _very_ easy.

Switching from bash (or another Bourne shell clone) to csh is probably going to be a bit more painful than just installing bash.


```
# [b]pkg_add -r bash[/b]
```

is all it takes to install it, and then you can change your default shell to bash with:


```
# [b]chsh -s /usr/local/bin/bash [i]USERNAME[/i][/b]
```


----------



## cpeterson (Jan 23, 2009)

keramida@ said:
			
		

> For what it's worth, there is nothing "wrong" about installing bash or zsh.  They are both far more featureful than the bare-bones "/bin/sh" shell of FreeBSD, and installing them from ports or packages is _very_ easy.
> 
> Switching from bash (or another Bourne shell clone) to csh is probably going to be a bit more painful than just installing bash.



Agreed, actually some people have gone so far as to get tab completion for sysctl working with system OIDs under zsh. Every member of the BSD dev team I've met has used zsh as their default shell. I run zsh or bash on all of my production BSD boxes too.


----------



## lme@ (Jan 23, 2009)

If you still want to use tcsh, take a look at shells/tcshrc which has some really ass-kicking settings especially for the command completion.


----------



## mousaka (Jan 23, 2009)

What shell is entered in /etc/passwd for the user?


```
test::1002:1002::0:0:test:/home/test:/bin/tcsh
```
After the last colon you can define the default shell for this user, so you don't need to switch it manually.

mousaka


----------



## tingo (Jan 24, 2009)

mousaka said:
			
		

> After the last colon you can define the default shell for this user, so you don't need to switch it manually.



Use the `$ chsh` command to change a users shell permanently.


----------

