Hacker News new | ask | show | jobs
by yellow_and_gray 4232 days ago
What stopped me from using FreeBSD a year ago was lack of automatic tab completion on the shell.

I would like to try FreeBSD again. Does anyone know if this works now?

edit: clarified the reason I ask is because I want to know.

7 comments

You can change the shell for a user in /etc/passwd, or with the command chsh.

It's funny how little things like this affect where you go with systems. On the uni systems, emacs was set up to reformat your code by default (as you typed it in). This drove me bananas, and I didn't realise it was configurable. So I went off and found another editor, and I'm still using it.

Just don't change root's shell to something like bash. BAD THINGS WILL HAPPEN.
Care to elaborate? Does FreeBSD make assumptions about the root user's shell that Linux doesn't?
Yes, root's shell should be one provided by the distribution's base install.

I think the biggest worry is that if you need to do something like boot into single user mode for an emergency recovery, and /usr or /usr/local (with root's shell in it) is on a different or unmountable partition then you will not be able to do anything.

Additionally, if you upgrade your shell, or something gets borked, then... you now don't have a shell.
This is one of the reasons for the existence of the 'toor' user, which still uses the default shell
Say there's a failure that forces you to bail into an emergency session where you can't mount /usr/local (which is where bash is typically installed on FreeBSD). All of a sudden, you don't have a shell.

This is a really bad place to be.

I have no idea which shell you used, but this has worked for years in both zsh, and also in bash on FreeBSD.

With zsh you even get tab completion of ports, packages, and other command specific arguments.

I mean absolutely no disrespect by this: if enabling automatic tab completion stymied you a year ago, running FreeBSD (or other operating systems with a similar ethos) as a main install may not be for you just yet. Play with it in a VM with snapshots, use it as a learning experience for how to manage, break, and fix a *NIX install.

Personally I run Ubuntu on my work desktop so I can focus on work and not managing the OS. I run a private irc server on a busted old desktop running Arch Linux for the opposite reason :)

The default shell in freebsd is probably still sh, which does not have tab completion. The Linuxes long ago moved to bash, which does.

However, in the FreeBSD ports tree, I guarantee you there is a bash package you can install, and then you can just switch your shell to be bash instead of sh.

Few minor corrections as several posts in this thread suggest outright installing bash just to achieve tab completion in FreeBSD.

The default root shell on FreeBSD is csh (tcsh) [1] and has been that way for at least 21 years (at least if I read the revision history [2] correctly, my own memories only go back about some 15 years).

As per Wikipedia article, tcsh natively supports tab completion since about 1983 [3] (which I can confirm always worked without an issue as far as my memories go, so again, give or take 15 years).

Permanently switching any user shell to tcsh (if it happens to be sh) is pretty much a single `chsh` command away, so as far as strictly tab completion goes, manual installation of bash is not required at all.

The required steps (step) to setup tcsh for tab completion can be found i.e. in this 2004 FAQ [4]:

Tip#7: List possible completions

I often see Bash users complain that Tcsh does not give a list of completions with the tab key. This is not true. Not only can Tcsh list complentions, but it can do it in color. Just add this to your ~/.tcshrc

set autolist set color set colorcat

[1] https://www.freebsd.org/doc/en/articles/linux-users/shells.h...

[2] https://svnweb.freebsd.org/base/head/etc/master.passwd

[3] https://en.wikipedia.org/wiki/Tcsh

[4] http://www.tcsh.org/TipsAndTricks

+1 I'm confused as to why so many people are saying that FreeBSD doesn't autocomplete when it always has.

Also want to add that csh comes stock with historical auto completion which I very much enjoy.

Typing "tail " and pushing the up arrow will auto complete with the last command you typed starting with "tail ".

...and /bin/sh has tab completion anyway (set -o emacs)!
The default shell in freebsd is probably still sh, which does not have tab completion

/bin/sh in 10.x has tab completion.

Thanks. This helps.

I didn't see tab completion when I was running the installer and I gave up.

Thank you for answering my question.

That's not a FreeBSD issue, that's a shell issue. Install bash and you'll have tab completion.
Really... /bin/sh has always had tab completion:

    set -o emacs
At a guess you're using sh or csh instead of bash?