# Which shell do you use?



## Citsakots (Dec 6, 2008)

I'm planning on switching the shell I'm currently using(tcsh) to Bash but I've read that changing the root shell to bash might be a bad idea. The main problem I have is tcsh doesn't update the directory list automatically, so that's why I'm wondering which shell do you guys use?


----------



## cajunman4life (Dec 6, 2008)

Do not, DO not, DO NOT change root's shell. 

Your comments lead me to believe that you are doing everything on your system as root. This is also a bad idea.

Create a user account for yourself, and select any shell you want. Give yourself SU and/or sudo access so you can still maintain the system. But try to do as little as root as possible.

That said, I use bash and ksh93 about half/half.


----------



## Citsakots (Dec 6, 2008)

cajunman4life said:
			
		

> Do not, DO not, DO NOT change root's shell.
> 
> Your comments lead me to believe that you are doing everything on your system as root. This is also a bad idea.
> 
> ...



Haha don't worry I have my own user account in the wheel group so that's nothing to worry about. Also I have my user account shell as bash and my root account shell to tcsh. I've read, which makes perfect sense, that you shouldn't change your root shell because once an update occurs, the libraries change and that you won't be able to go to root because the installed shell won't work till update. So in the end your shell won't work in root and it causes a lot of problems. I just wanted to know the reason why and such .


----------



## Mel_Flynn (Dec 6, 2008)

```
make -C /usr/ports/shells/bash -D WITH_STATIC_BASH -DWITHOUT_NLS PREFIX=/ install
```

Library problem and "no mounted /usr" problem solved. The rest is paranoia. It's easy to change the shell back to csh for problem reporting if you suspect the shell to play a roll with your bug.
su(1) has quite a few advantages over sudo as shell/command wrapper, especially in machine stress situations and because sudo tries to be too smart about your environment variables.
Of course, the conservative "feed the newbies babyfood" answer is to not change root shell.


----------



## Djn (Dec 6, 2008)

I've just gotten used to tcsh. The history completion (type the first letters, arrow up) is more pleasant than ^R in bash, the config syntax makes more sense, and I do anything complicated in script files anyway.
Besides, it's one less thing I need to install. 

The rehash thing is slightly annoying, granted - I'm thinking about just setting it to run whenever tcsh displays a new prompt. (The overhead is so small these days that running it each time I press enter in a shell really doesn't worry me).


----------



## gnemmi (Dec 6, 2008)

csh for every user on my system ..

See ... csh is the default root shell .. so why shouldn't I use it as the default shell for my system users as well??

After a while, users get used to use csh and switching back and forth between a regular users and root makes it even easyer for newcomers .. after all thye've all been using csh for moment one on a daily basic .. so .. there's no real need to go switching from shell to shell according to suit a particular user's need.

Even so .. if a particular user feels unconfy with csh... well... that woud make him a minority .. and minorities (as well as exceptions), constitut no base upong wich general rules should be created.

Scripting is still confined to sh thouhg ...or Perl 

Yet still ... users are free to change their shell to something else that better suit their needs at the drop of a hat. I ain't forcing anyone to use csh after all...

My two cents.

PS: I'm willing to pay a reasonable price for this two books, since they are downright impossible to get around here: Unix C Shell Field Guide (Paperback) and C Shell Quick Reference Guide (Paperback). No matter what state their are in ... I just can't get them over here. So if you happen to have a spare copy, please let me know and we will work someting out.

Thanks
Best Regards
Gonzalo

PS: wouldn't it be a good idea to setup a "sell/buy subforum"?? .. just a thought ...i mean .. what's nothing to some ... means a lot to others around the globe ... 

Regards


----------



## Citsakots (Dec 6, 2008)

Mel_Flynn said:
			
		

> ```
> make -C /usr/ports/shells/bash -D WITH_STATIC_BASH -DWITHOUT_NLS PREFIX=/ install
> ```
> 
> ...



Wow, thank you for such a great post. I didn't know you could do that and also thank you for not feeding me "baby food".


----------



## Mel_Flynn (Dec 6, 2008)

gnemmi said:
			
		

> csh for every user on my system ..
> 
> See ... csh is the default root shell .. so why shouldn't I use it as the default shell for my system users as well??


Cause the default shell for users is sh? csh is BSD historical for root, I don't think there are any valid technical reasons other then "importing a new root shell or switching to sh gives too many noise on mailing lists", but I'll gladly be corrected on this topic.

It's quiet inconvenient to install software on a vanilla machine using csh, cause you have to rehash all the time. Of course I never spent time investigating csh, so I might be missing a shell feature to set auto rehash.


----------



## gnemmi (Dec 6, 2008)

Yes ..I considered "rehash" briefly ... but .. root has to rehash all the time .. so .. why not getting newcomer to get used to the habit of rehashing?

After all .. newcomers are "someday will be root" or will have to work as root eventually .. son why not getting them accuaitend with rehash from moment one??

By the time they get to be root "rehash" wil be second nature to them ...

Learning to do a rehash after years of not using it ... is quite annoying .. so why not avoiding that from the ground up???

That's the way I see it (and I'm far from having an absolute truth on this matter or any onther ...) it's the best way to go.

I mean .. If you're going to do something ... why not leraning it the right way from the very beginning??

On a side note .. rehash is not only a good habit .. but also a good practice that let's you know more about some of the most simpler internals of you OS of choice 

Mel@:It's quiet inconvenient to install software on a vanilla machine using csh, cause you have to rehash all the time. Of course I never spent time investigating csh, so I might be missing a shell feature to set auto rehash.

Yes ... and I probably falll in the same cateory too ... we need books on Csh ... that was why I was asking for Unix C Shell Field Guide (Paperback) and C Shell Quick Reference Guide (Paperback) 

But i've got the feeling that, even if you don't like it _that_ much or are still not quite convinced.. you do know where I'm aiming at 

Now, and back to the books .. it would really be a good thing to have them both at hand...


----------



## vermaden (Dec 6, 2008)

My choices are:
*#! /bin/sh* for scripting
*ZSH* for interactive use
*CSH* for root account (also often the first thing I type on the root prompt is '*zsh*' if its avialable)


----------



## sverreh (Dec 6, 2008)

I use tcsh (and sometimes sh) on the command line. The "rehash problem" is really not a problem for me. It takes about 0.2 seconds to type and execute the command, and I usually don't install very many programs every day. So in an average week I think I loose about 1 second because of "rehash" 



			
				gnemmi said:
			
		

> Scripting is still confined to sh thouhg ...or Perl



Absolutely! Although I tend to use Perl more than sh.


----------



## graudeejs (Dec 6, 2008)

i use mksh, because it's sh compatible.
for some reason I didn't like ksh93


----------



## danger@ (Dec 6, 2008)

you can use su -m ...


----------



## MartijnAtLico (Dec 6, 2008)

I use zsh.. currently I only use about 5% of it's functionality, but someday I'm going to do great things with it 

http://friedcpu.wordpress.com/2007/07/24/zsh-the-last-shell-youll-ever-need/


----------



## Dr_Phoenix (Dec 6, 2008)

Using csh. When running and testing some scripts switching from csh to sh or bash if needed but more simple to add at the start of script file signature like #!/bin/sh #!/usr/bin/perl  etc.


----------



## estrabd (Dec 6, 2008)

bash, though I try to write my shell scripts so that they're compatible with the original bourne shell.


----------



## estrabd (Dec 6, 2008)

sverreh said:
			
		

> I use tcsh (and sometimes sh) on the command line. The "rehash problem" is really not a problem for me. It takes about 0.2 seconds to type and execute the command, and I usually don't install very many programs every day. So in an average week I think I loose about 1 second because of "rehash"
> 
> Absolutely! Although I tend to use Perl more than sh.



I love me some Perl, but *many* things are still done more appropriately as a shell script.


----------



## sverreh (Dec 6, 2008)

estrabd said:
			
		

> I love me some Perl, but *many* things are still done more appropriately as a shell script.



When it comes to system administration, I agree totally. However, I am not a sysadm (except for the desktop at home), and many of my scripts at work rely heavily on regexp. And there Perl really shines. :e


----------



## UNIXgod (Dec 6, 2008)

vermaden said:
			
		

> My choices are:
> *#! /bin/sh* for scripting
> *ZSH* for interactive use
> *CSH* for root account (also often the first thing I type on the root prompt is '*zsh*' if its avialable)



+1 but I never change my shell under root. even if it's avalable. Even the zsh guys don't suggest it for root.

I can't begin to explain the problems that could occure if the root shell is changed.


----------



## anomie (Dec 6, 2008)

Citsakots said:
			
		

> I'm planning on switching the shell I'm currently using(tcsh) to Bash but I've read that changing the root shell to bash might be a bad idea.



I'll agree with other sentiments on the thread. Leave root's shell alone. If you want a root (for functional purposes) account with a special shell, then set up the toor user. 

Two easy steps: 

*# chpass -s /usr/local/bin/bash toor*

*# passwd toor*

Voila. Use *su - toor* from a regular user account. 



> The main problem I have is tcsh doesn't update the directory list automatically, so that's why I'm wondering which shell do you guys use?



I use tcsh for interactive shells (even on a Linux workstation), and sh for scripting everywhere (FreeBSD, Linux, Solaris).


----------



## Eponasoft (Dec 6, 2008)

Good ole /bin/sh for me.


----------



## Oko (Dec 7, 2008)

```
$ echo $SHELL
/bin/ksh
$
```


----------



## ninjaslim (Dec 7, 2008)

I generally use ZSH for everything.  No, I have not changed the root shell. I just use sudo, which preserves env vars.


----------



## Pushrod (Dec 7, 2008)

cajunman4life said:
			
		

> Do not, DO not, DO NOT change root's shell.



I changed my root's shell to zsh sometime in 2005 and have not had a single problem. zsh is installed in /bin on my machine, and all of the libs are outside of /usr, so basically, I have zsh in the base system. It works great and I would recommend it to anyone who is willing to take the couple of careful steps needed. I have this same setup on four different computers; three are FreeBSD and one is CentOS Linux (sigh).

I personally don't like [t]csh because it uses a different language than sh. It does not make sense to me to switch back and forth, and I don't feel the need to learn csh scripting.


----------



## lyuts (Dec 7, 2008)

I'm using tcsh and have no problems with scripting.


----------



## CyberCr33p (Dec 7, 2008)

For root I use csh and for users bash.


----------



## SirDice (Dec 7, 2008)

Tcsh for all my accounts, the standard bourne sh for scripting and if things get complicated perl.


----------



## dap (Dec 7, 2008)

I use tcsh because I like the programmable completion and the completion.
For scripting I use sh and Python.


----------



## tomh009 (Dec 7, 2008)

Hmm, not many ksh users out there, it seems.  After spending my early years with csh and tcsh, I switched about 20 years ago to ksh, as I could have the same shell on Windows (with MKS Toolkit), and I haven't switched since.

I use pdksh, as none of the ksh93 features seem compelling to me, and I figure that for sure I'd have to relearn something.   

The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ... navigation without having to think about it, and without having to locate the cursor keys on the keyboard.  And note that it also supports "set -o emacs" so there is no need to have a religious discussion about vi vs emacs!  :e


----------



## cajunman4life (Dec 7, 2008)

tomh009 said:
			
		

> The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ...



I can't tell you how many MSWord documents that have :w or :wq embedded randomly within... it's tough to break.


----------



## tomh009 (Dec 7, 2008)

I recognize those random letters from my documents, too!  That's why I try to have as many common tools across platforms as possible, and ksh and vi are an easy choice for that.


----------



## nakal (Dec 7, 2008)

I'm using tcsh, because the history function is very convenient. I just type a short prefix (mostly one letter) and press "cursor up". It finds the last matching line.

Scripting shell is sh for me.


----------



## bsddaemon (Dec 8, 2008)

Bourne shell, for scripting, of course, and zsh, for interactive use. The auto-complete feature in zsh is just amazing. I can even auto complete *remote* file/dir when I scp with private key, kernel config file when I build, install kernel...

I wish I could do in-line scripting (scripting with command line in  interactive mode) with zsh. There are some differences syntaxes, builtin commands in Bourne and zsh.

Is there any setting that I can enable the "bourne shell compability", if it does exist?


----------



## vermaden (Dec 8, 2008)

bsddaemon said:
			
		

> I wish I could do in-line scripting (scripting with command line in  interactive mode) with zsh. There are some differences syntaxes, builtin commands in Bourne and zsh.



Any examples?


----------



## nORKy (Dec 8, 2008)

scripts : sh
users : zsh
root: csh


----------



## bsddaemon (Dec 8, 2008)

vermaden said:
			
		

> Any examples?



I was having problem with in-line command cp (with variable), printf (zsh has it own printf?), complex while or if statement. There are some more but I couldnt remember on top of my head. They work in bourne script file, but didnt work with zsh

afaik, zsh is more bash-like, rather than sh


----------



## jleal2003 (Dec 9, 2008)

My choices are:
#! /bin/sh for scripting
BASH for root account (


----------



## bsddaemon (Dec 9, 2008)

bash for root??? Poor Charlie...

and there is no normal account, you log in as root all the time???


----------



## lazybones (Dec 9, 2008)

tomh009 said:
			
		

> The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ... navigation without having to think about it, and without having to locate the cursor keys on the keyboard.  And note that it also supports "set -o emacs" so there is no need to have a religious discussion about vi vs emacs!  :e



Another pdksh user here!  The pdksh maintainer was a sysadmin at my school when I was there - they had it deployed for all user accounts campus-wide and it's been my shell of choice for 15 years now.  I'm married to the vi commandline editing - in any other shell I'm driving people nuts with beeps when I fire off "[esc]kkk"


----------



## Ole (Dec 9, 2008)

Citsakots said:
			
		

> Wow, thank you for such a great post. I didn't know you could do that and also thank you for not feeding me "baby food".



With portupgrade you can automatize that by:
MAKE_ARGS in pkgtools.conf:


> 'shells/bash' => [
> 'WITH_INCLUDED_FAQ=yes',
> 'WITH_STATIC_BASH=yes',
> 'WITH_INTEGRATED_HELPFILES=yes',
> ],


AFTERINSTALL  in pkgtools.conf:


> 'shells/bash' => sprintf(
> '/root/bin/ports/bash.sh'
> ),



and create&chmod +x /root/bin/ports/bash.sh with similar content:


> #!/bin/sh
> 
> cp /usr/local/bin/bash /bin/bash
> cp /etc/shells /tmp
> ...



(not cleanly scripts but it working . For example it remove records /usr/local/bin/bash for exclude of wrong-headed choice user shell in "adduser"

After that, portinstall and portupgrade shells/bash will be compile static bash, place him to /bin and correct /etc/shells file


----------



## sverreh (Dec 9, 2008)

lazybones said:
			
		

> I'm married to the vi commandline editing - in any other shell I'm driving people nuts with beeps when I fire off "[esc]kkk"



I'm also "married to the vi commandline editing" as you say! :e
But I am using tcsh, which has the same feature. Just put 


```
bindkey -v
```
in .cshrc (or .tcshrc if you like)


----------



## bsddaemon (Dec 9, 2008)

vermaden said:
			
		

> Any examples?



Another one:


```
func () {
    VARS="a 1 b 2 c 3"

    for var1 var2 in $VARS; do
        echo $var1 $var2
    done
}
```

This function works fine with *zsh*, but doesnt work with *Bourne*



> Syntax error: word unexpected



In my script, I have no choice but to define *shebang* as *#!/usr/bin/env zsh* :S

Maybe someone has better solution?


----------



## vermaden (Dec 10, 2008)

bsddaemon said:
			
		

> I wish I could do in-line scripting (scripting with command line in interactive mode) with zsh. There are some differences syntaxes, builtin commands in Bourne and zsh.
> 
> Is there any setting that I can enable the "bourne shell compability", if it does exist?
> 
> ...



From *man sh*:


```
The syntax of the for command is:
           for variable [in word ...]
           do list
           done
```

This is the syntax of POSIX sh, so there is nothing strange that extended ZSH capabilities ([font="Courier New"]for A S D in ...[/font]) does not work on standart sh, ZSH IS compatible with POSIX sh, I just do not know why you want POSIX sh to be compatible with ZSH extensions.

Other example of that is that for loop that only works at ZSH:
[font="Courier New"]$ for I in {1..10}; do echo $I; done[/font]


----------



## UNIXgod (Dec 10, 2008)

tomh009 said:
			
		

> Hmm, not many ksh users out there, it seems.  After spending my early years with csh and tcsh, I switched about 20 years ago to ksh, as I could have the same shell on Windows (with MKS Toolkit), and I haven't switched since.
> 
> I use pdksh, as none of the ksh93 features seem compelling to me, and I figure that for sure I'd have to relearn something.
> 
> The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ... navigation without having to think about it, and without having to locate the cursor keys on the keyboard.  And note that it also supports "set -o emacs" so there is no need to have a religious discussion about vi vs emacs!  :e



What do you think of zsh?


----------



## dclau (Dec 14, 2008)

user(s): ksh
root: csh
scripts: sh


----------



## hydra (Dec 16, 2008)

I am using tcsh, was thinking about trying out zsh.


----------



## rdivacky@ (Dec 16, 2008)

while I agree that tcsh is a messy old warty piece of sh... shining  I am still using it. I guess it's my .cshrc that makes it so appealing to me but I am to lazy to switch


----------



## lme@ (Dec 21, 2008)

with shells/tcshrc tcsh is a very nice piece of software! I just love its programmable completion!


----------



## tangram (Jan 8, 2009)

For root I use tcsh and zsh for regular user in FreeBSD. On Linux land I mainly use bash.

I actually like tcsh quite a bit but I'm looking into zsh (building .zshrc).


----------



## estrabd (Jan 8, 2009)

csh for root, bourne or bash as user; for scripting, I bound myself to the limits of bourne.


----------



## darkshadow (Jun 14, 2010)

*zsh*

I love zsh , and it is great take a look http://zsh.sourceforge.net/Doc/Release/Introduction.html


----------



## nekoexmachina (Jun 14, 2010)

i use zsh too, but may be i'll switch to csh for interactive shell if i'll find time to configure it as my zsh.


----------



## fronclynne (Jun 14, 2010)

tcsh because I'm lazy.  I don't use very many features but I'm used to the completion paradigm of tcsh on freebsd, and I have no good reason to change, since it's in /bin.

I usually install zsh and pdksh (& sometimes mksh) and every once in a great while I'll change my ol' user account over to one, but I go back to tcsh after a couple of days.


----------



## ah7013 (Jun 14, 2010)

bash for me because I come from a Linux background and all the Linux distros I have tried used bash so i'm just used to it.


----------



## ckester (Jun 14, 2010)

I've been using mksh since seeing killasmurf recommend it in another thread.

Reasons: size, speed, absence of GNUish cruft.  Ability to redirect stderr.  Enhanced pattern matching in variable substitutions.  Reasonable license!


----------



## hedwards (Jun 15, 2010)

For my main user account, I've switched from tcsh to bash on account of all the scary things I was reading about the c shells. The main one being that other shells have the ability to evaluate what a command is going to expand to without actually executing it.

But, as for root, I'll leave it as is forever. If, however, one is going to change it then for God's sake keep it as one of the ones which is shipped as a part of the base system. Having had the experience earlier today where I couldn't log in as myself because I hadn't finished the dependencies for bash I'd highly recommend against using ports for root's shell.

I do however dislike the way that bash handles the history. It's always irritated me that you can't type in a few characters of the command and skip to just the commands you've entered that start with those characters.


----------



## DutchDaemon (Jun 15, 2010)

ckester said:
			
		

> I've been using mksh since seeing killasmurf recommend it in another thread.
> 
> Reasons: size, speed, absence of GNUish cruft.  Ability to redirect stderr.  Enhanced pattern matching in variable substitutions.  Reasonable license!



I've switched to mksh from bash as well. Less clutter, better speed, and with the included mkshrc sample it can be made to look like bash with minor tweaks. And NO dependencies whatsoever!


----------



## ckester (Jun 15, 2010)

I didn't know about that mkshrc sample, Dutch.  Thanks for pointing it out.  Something to play with today!

The *.profile* I'd been using with bash seems to be working just as well with mksh, without needing any edits. What I liked in bash is apparently just the stuff they borrowed from Korn shell, and not any of their own "innovations".


----------



## olav (Jun 15, 2010)

Im using bash mostly, but after reading this thread I have to check out mksh


----------



## graudeejs (Jun 15, 2010)

sh vs bash vs mksh


----------



## hedwards (Jun 16, 2010)

killasmurf86 said:
			
		

> sh vs bash vs mksh


Those results aren't terribly surprising. The clone of the Bourne Shell FreeBSD uses ought to be quite a bit quicker as it doesn't incorporate as much cruft as bash does.


----------



## carlton_draught (Jun 16, 2010)

I used sh for root, and bash for users. In root, I always switch straight to bash for interactive use. Scripts are done in sh when I have a choice. However, I will have a look at some of the more popular options after reviewing this thread.


----------



## graudeejs (Jun 16, 2010)

hedwards said:
			
		

> Those results aren't terribly surprising. The clone of the Bourne Shell FreeBSD uses ought to be quite a bit quicker as it doesn't incorporate as much cruft as bash does.



So what cool stuff do you do with bash, that other shells can't do?

http://en.wikipedia.org/wiki/Comparison_of_computer_shells


----------



## lme@ (Jun 17, 2010)

Now that our beloved Bourne Shell got support for filename completion, we can all switch to it! 
See http://svn.freebsd.org/viewvc/base?view=revision&revision=209221


----------



## BrainDamage (Jun 17, 2010)

zsh for interactive use
csh as default for root account, but normally I switch over and use the zsh


----------



## mirabilos (Jun 17, 2010)

lme@ said:
			
		

> Now that our beloved Bourne Shell got support for filename completion, we can all switch to it!



Itâ€™s actually an almost-POSIX shell, not(!) a Bourne shell,
with broken behaviour for "sh -c 'somescript' -- foo bar baz"
which mksh can emulate when compiled with a specific option,
-DMKSH_MIDNIGHTBSD01ASH_COMPAT, and then when either called
with â€œ-o shâ€ or as sh when compiled with -DMKSH_BINSHREDUCED.

Iâ€™d say ditch it. MidnightBSD is doing so, and they like mksh.


----------



## fairy (Jun 18, 2010)

killasmurf86 said:
			
		

> sh vs bash vs mksh


You could have included zsh. It's usually faster than bash and has better sh emulation.
Anyway, shell scripts are easy to rewrite for bash/zsh/whatever so that they're faster than on /bin/sh. You'll see real performance when you reduce external commands to minimum.


----------



## loop (Jun 18, 2010)

csh for root, zsh for user.

I've been using zsh for years ... mostly for it's completion abilities (I'm a lazy typist . Started using it well before any of the other shells featured built-in completion, and haven't bothered to change


----------



## ckester (Jun 18, 2010)

It looks like those of us who are looking for something other than bash are about evenly divided between mksh and zsh.  Perhaps we need to do a head-to-head comparison between these two.   What benchmarks do you suggest?


----------



## sk8harddiefast (Jun 18, 2010)

Hi. I use bash but i want to use mksh but i didn't find none .mkshrc sample googling. Even on mirbsd site.
Is anyone how can post one or give me a url with a sample?


----------



## DutchDaemon (Jun 18, 2010)

Ports install examples under /usr/local/share/examples/.


----------



## sk8harddiefast (Jun 18, 2010)

This was the path i was searching for. I found it and i copy it on my home directory.
I set *alias ls='ls -G'* and i have colorised terminal 
But how can i colorise my hostname too?
I don't understand nothing on this file


----------



## graudeejs (Jun 18, 2010)

I've read man mksh.
As I understand, you can't colorize it (without some trick, which have side effects)

_At least I can post small replies_


----------



## DutchDaemon (Jun 18, 2010)

The default (included) .mkshrc colorizes with `ls -G`
No additional settings have been made.

Just tried without any .mkshrc .. still colorizes.


----------



## sk8harddiefast (Jun 19, 2010)

> Just tried without any .mkshrc .. still colorizes.


On me default is not ls -G. Is ls -F.
No. Without any .mkshrc on my home directory all colours are white 
Also without any .mkshrc is not giving me hostname before $
I open mksh from bash. This is possible to make the difference?


----------



## mirabilos (Jun 19, 2010)

When you copy the dot.mkshrc sample file (ugh, the FreeBSD porters have colourised some
parts of it?) to ~/.mkshrc then mksh will give you the username, hostname and current
working directory before the $ (or #). You can of course write your own, itâ€™s just a
sample ;-)

Colourising that is rather easy and, in mksh (as opposed to, say, pdksh), comes without
side effects. The sample file starts the effective PS1 with ^A^M (i.e. control-a or ASCII
0x01, and control-m or \r or ASCII 0x0D). This enables a â€œmagic modeâ€ first known from
AT&T ksh88 which allows you to wrap your escapes into matching pairs of ^A, like you use
\[ and \] in GNU bash.

Since mksh, by urging from Dave Korn himself, now supports $'â€¦', you can use
â”‚ PS1=$'\1\r\1\e[7m\1$PWD\1\e[0m\1> '
or things like that (this is actually an example line from the manual page, not
a prompt I use, but it works like that too). The prompt from dot.mkshrc is much
more complex, for example it applies the replacing of $HOME with ~ similar to
GNU bashâ€™s \w and, in addition to that, prevents the rest from being wider than
about a third of the display.

Also, you could send me your (GNU bash syntax) prompt per eMail and Iâ€™ll convert
it to mksh syntax for you (unless I get a bazillion eMails per dayâ€¦) â€“ you should
of course state if you want the whole directory (/home/foo/bar), \w (~/bar), or
just the last part, for example.

I will update the online versions of the manpage to match mksh-current right
after submitting here:
â€¢ https://www.mirbsd.org/man1/mksh or https://www.mirbsd.org/man/mksh.1
â€¢ https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh.pdf

It should be noted that I will *not* be monitoring this web forum, I just
stumbled across this thread (it was pointed out to me). There are support
channels (both IRC and eMail) documented.


----------



## sizemj (Jan 5, 2011)

*what shell do you prefer*

Kind of an opinion question. I was wanting to know what shell most people use. I have come from Linux so Bash is the norm but FreeBSD it is the csh. 

thanks

*[ merged with existing thread - Mod. ]*


----------



## graudeejs (Jan 5, 2011)

http://forums.freebsd.org/showthread.php?t=12768

http://forums.freebsd.org/showthread.php?t=11819 (a little related)


----------



## UNIXgod (Jan 5, 2011)

sizemj said:
			
		

> Kind of an opinion question. I was wanting to know what shell most people use. I have come from Linux so Bash is the norm but FreeBSD it is the csh.
> 
> thanks



err. So because you come from linux you prefer bash? Just because the system has a 'default' shell does not dictate that you have to use it. Also FreeBSD user should default to ash not tcsh.

I use zsh and script in ash.


----------



## UNIXgod (Jan 5, 2011)

http://www.freebsd.org/doc/en/books/faq/applications.html#MINIMAL-SH


----------



## ckester (Jan 5, 2011)

I've been using shells/mksh ever since I saw killasmurf's recommendation early last year.


----------



## sizemj (Jan 6, 2011)

No I have change to the tcsh. I know that sh is the default.


----------



## Pushrod (Jan 6, 2011)

I use zsh exclusively and have "tunnel vision" with it. It's root's shell even.


----------



## jrm@ (Jan 6, 2011)

zsh here, for root as well.  I've messed things up, but have always been able to fix the mess-ups with the toor account, which uses /bin/sh.  Can someone give a scenario where toor couldn't save you?

zsh users who don't like to rehash may want to check out the options nohashdirs and nohashcmds.


----------



## UNIXgod (Jan 6, 2011)

haha don't change root shell! lol to zsh even. You guys have way to much time on your hands.


----------



## vermaden (Jan 6, 2011)

@UNIXgod

When he has *toor* account available with /bin/sh shell, then nothing can hurt him, even rm -f /usr/local/bin/zsh ...


----------



## UNIXgod (Jan 6, 2011)

vermaden said:
			
		

> @UNIXgod
> 
> When he has *toor* account available with /bin/sh shell, then nothing can hurt him, even rm -f /usr/local/bin/zsh ...



Never really used toor ( reverse root) .... I imagine it's a security risk to some degree to enable it.

I don't like messing to much with root. I guess I never found /bin/csh to be that disabling. It has shell !history and simple tab completions and reminds me that I'm running root with it's prompt. But to each their own.


----------



## Pushrod (Jan 6, 2011)

UNIXgod said:
			
		

> haha don't change root shell! lol to zsh even. You guys have way to much time on your hands.



Yeah, takes a real lowlife to su root and then chsh.

You can consider me the resident BSD badass. I have changed root's shell, don't have separate partitions for /var, /usr, or /tmp, and I have minfree set to 0 on almost all disks.


----------



## UNIXgod (Jan 6, 2011)

Pushrod said:
			
		

> Yeah, takes a real lowlife to su root and then chsh.
> 
> You can consider me the resident BSD badass. I have changed root's shell, don't have separate partitions for /var, /usr, or /tmp, and I have minfree set to 0 on almost all disks.



Wow you rebel. Do you also duel boot your laptop to win98 as well or just run inside vm?

j/k =)


----------



## vermaden (Jan 6, 2011)

UNIXgod said:
			
		

> Never really used toor ( reverse root) .... I imagine it's a security risk to some degree to enable it.



What security risk if both *root* and *toor* will have the SAME password?

That is the PURPOSE of *toor* account, as backup for root, or as a root account with alternative shell.


----------



## Blueprint (Jan 7, 2011)

I use ksh93 (interactive + scripting) because I use AIX at work and it is included in the base install. However ksh88 is the default root shell. 

I haven't heard of mksh either until I saw killersmurfs post but I was hoping he would have included ksh93 in his tests. From what I read ksh93 is meant to be faster then all the other sh compatible shells.

Many people critisize ksh93 for interactive use but I think its really good now with recent versions. 

I'm just curious why people would use mksh over ksh93, is it for licensing reasons?


----------



## UNIXgod (Jan 7, 2011)

Blueprint said:
			
		

> I'm just curious why people would use mksh over ksh93, is it for licensing reasons?



That was the original reason. Korn shell was not F/OSS originally and those who prefered it used pdksh( i.e. public domain ksh).. mksh somehow came from there through openbsd. korn didn't become open source until the end of the 90's. Also bash and zsh have incorporated modern shell feature originally found in the korn shell. zsh was directly influenced.


----------



## Blueprint (Jan 7, 2011)

Sorry I probably should have asked if it's "still for licensing reasons?". I am aware of the history, and the reasons we have bash,zsh and pdksh. But since ksh93 has been opensource for a while and since mksh is a relatively new offering. Are people in this thread making the switch to mksh for licensing reasons or do they prefer it over ksh93 for other reasons?


----------



## Galactic_Dominator (Jan 7, 2011)

One thing not mentioned with building static libs, is the penalty of using them.  It's going to use more memory that way. If you're doing a lot of scripting in a memory contrained enviroment, a static build of bash/zsh/etc is not ideal.  That and sh execution is faster despite an earlier claim to contrary.  This is why the base system shell of Debian and Ubuntu have switch to the dash shell(Debian Ash) similar to FreeBSD's /bin/sh.

Personally, I use either zsh, or tcsh for an interactive shell and I hate working in bash.  One it's more frustrating attributes for me is it's history-search-backward functions as it's not nearly as useful as tcsh's FreeBSD default and to get the same behavior in zsh just add

```
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
```
There is no identical behavior in bash although you can get close with some fiddling.

tcsh has many nice attributes too that many aren't aware of.  For example, 
	
	



```
set autolist
```
 in your .cshrc/.tcshrc gives nice autolisting similar bash or zsh.  Many more too, see tcsh().  A lot less memory than bash/zsh too although that may not be as important as it once was.

If I'm doing to heavy lifting with shell zsh is a easier IMO, but for me I've probably already resorted to use python.  I just don't like typing a thousand lines in sh when I could do in 100 with python plus it's easier to read/maintain/debug.


----------



## fat64 (Jan 7, 2011)

shells/ksh93 as a user, and /bin/sh as root.


----------



## ckester (Jan 7, 2011)

Blueprint said:
			
		

> Sorry I probably should have asked if it's "still for licensing reasons?". I am aware of the history, and the reasons we have bash,zsh and pdksh. But since ksh93 has been opensource for a while and since mksh is a relatively new offering. Are people in this thread making the switch to mksh for licensing reasons or do they prefer it over ksh93 for other reasons?



To be honest, I haven't tried ksh93.  I suppose I should.

I'd been using bash out of dumb, lazy habit (it's the default on the OS X system I was on before switching to FreeBSD) and  was looking for something lighterweight. killasmurf's recommendation of mksh spoke to my need/desire.

But to turn the question back on you, why ksh93 rather than mksh?


----------



## rbelk (Jan 8, 2011)

I have never liked Bash, but I have and will use it on Linux systems. I use TCSH for interactive shells and SH for scripts. I did switch to ZSH for a while. Since I try to keep it simple, I use TCSH. TCSH is already installed in the base and I don't have to install ZSH. All I do on a new system is copy my .tcshrc over to the new system and I'm done!


----------



## Blueprint (Jan 8, 2011)

ckester said:
			
		

> But to turn the question back on you, why ksh93 rather than mksh?



Well for me it makes sense to keep my life simple by using a shell that is available on all systems I may need to use in the future. Ksh93 is available on all the propriety unix systems, linux distros and FreeBSD.


----------



## ckester (Jan 8, 2011)

I'm retired now, and the only systems I'm likely to use are my own.  So portability is less a concern than it used to be.  

I did install ksh93 since my last post in this thread.  One thing I notice right away is that it's bigger than mksh:


```
$ ls -l /usr/local/bin/ksh93 /usr/local/bin/mksh
-r-xr-xr-x  1 root  wheel  1222248 Jan  7 21:24 /usr/local/bin/ksh93
-r-xr-xr-x  1 root  wheel   210560 May 10  2010 /usr/local/bin/mksh
```

I've also been doing some web searches for benchmarking tests of shell and other scripting languages:  

This site looks interesting, although I haven't given a close reading yet.  Nor have I tried to run its tests myself.  

Here are some benchmarking tests specifically for ksh and its workalikes.

Taking a different tack altogether, this one tries to evaluate the suitability of different languages for "script oriented programming".


----------



## captobvious (Jan 8, 2011)

zsh for users


----------



## Daisuke_Aramaki (Jan 10, 2011)

csh for root and ksh for user on my OpenBSD boxes. csh for root and mksh for user on my FreeBSD box.


----------



## fossala (Jan 10, 2011)

csh for root and tcsh for user. zsh on linux.


----------



## vermaden (Jan 13, 2011)

I just tried the mksh shell, I could use it under one circumstance ... it must support !$, let me explain:
ZSH/CSH/BASH:

```
# ls /boot
# cd !$
cd /boot
```

MKSH:

```
# ls /boot
# cd !$
mksh: cd: /!$ - No such file or directory
```

Generally !$ meanse LAST argument of previous command, pretty goddamn usefull in interactive mode.


----------



## DutchDaemon (Jan 13, 2011)

vermaden, try [alt]+[dot] (this will expand the last argument of the previous command, pasting it at the cursor position). Repeat for browsing previous arguments.


----------



## vermaden (Jan 13, 2011)

Thanks for suggestion, but that does not seem to work.

The left [ALT]+[.] does not do anything, the right [ALT]+[.] puts something like 'middle dot' and returns an error after [ENTER]:


```
# ls /boot
# ls Â· 
ls: Â·: No such file or directory
```


----------



## DutchDaemon (Jan 13, 2011)

Weird  Works fine here, with the 'left alt' and the 'right alt (alt gr)'. I use straightforward us-ascii though. Both insert /boot when the previous command was ls /boot. I've seen other methods (or at least mksh feature requests) that seemed to work with something like 'm-.' and/or 'M-.', but I have no idea how these would work.

There's also this in the manual (emacs mode):
[cmd=]man mksh | less +/"   Emacs editing mode"[/cmd]


```
prev-hist-word: [n] ^[., ^[_
             The last (nth) word of the previous (on repeated execution, sec-
             ond-last, third-last, etc.)  command is inserted at the cursor.
             Use of this editing command trashes the mark.
```

I guess I miss the necessary genetic markers to fathom this. But it's clear that the logic to retrieve/reproduce the last argument is definitely in there somewhere.


----------



## nekoexmachina (Jan 13, 2011)

Right now - zsh.
Want to migrate my zshrc to cshrc and use it, if it would be functional enough (like, to use minimum of non-base software )


----------



## ckester (Jan 13, 2011)

DutchDaemon said:
			
		

> Weird  Works fine here, with the 'left alt' and the 'right alt (alt gr)'.



Works here too, with $TERM=xterm-256color.

But it doesn't work with $TERM=cons25.


----------



## vermaden (Jan 13, 2011)

@DutchDaemon

Would You mind sharing Your ~/.mkshrc file? Maybe its a configuration problem on my side.


----------



## DutchDaemon (Jan 13, 2011)

@vermaden:

It's basically /usr/local/share/examples/mksh/dot.mkshrc with a very minor alteration to the PS1 line to get a nicer prompt. And my $TERM is 'xterm', by the way.


----------



## vermaden (Jan 13, 2011)

I have also tried that, it does not work with [ALT] but with [ESC] for me, seems that I do not have somewhere _'meta sends esc'_ option enabled.


----------



## DutchDaemon (Jan 13, 2011)

Heh ... [ESC] + [.] also works here 

The only difference is that I can cycle with [Alt] + [.] [.] [.] [.] etc., but have to use [ESC] + [.] [ESC] + [.] [ESC] + [.]


----------



## mirabilos (Jan 13, 2011)

Alt-x as Meta is not supported, DutchDaemon: Meta-. yields Â® really. Use Esc+x instead (note foo-bar = hold them together, foo+bar = press them in sequence notation). ^[x means Esc+x just as ^X means Ctrl-X â€“ Ctrl-[ is ESC in ascii(7).

Czesc vermaden, mksh feature requests (and support, I suppose) go via IRC (channel #!/bin/mksh or #ksh on Freenode) or, if must be, mailing lists. (Or Launchpadâ€¦ if absolutely must be.) IRC is the fastest/best/easiest.

^[. does have a feature request open (in the Debian BTS). I donâ€™t think the specialness of the exclamation mark will find its way into mksh though (it also would break just too many scripts), and the presence of the â€œwbx hackâ€ (PS1 response beginning with "!" is converted into "r ") is a mistake.

Hi ckester, nice to see â˜º Note that some things are terminal dependent, for example, in wsvt25 (wscons, the BSD equivalent to FreeBSDâ€™s cons25) thereâ€™s no difference between Ctrl-CurLeft and just CurLeft, so the shell cannot know that. On others, the keys are simply not known, but you can usually use the bind builtin to configure that yourself.

.oO(In MirBSD, thereâ€™s no toor and never has been, and root is usually not usable, doesnâ€™t even have a password or home directory, real men use sudo(8), see http://xkcd.com/838/ â˜»)

Blueprint, on some NetBSD mailing list, thereâ€™s a discussion about pdksh/mksh/ksh93, and it seems that ksh93 cheats a little to be faster (plus it has a bytecode compiler, but IMO a lot of bloat and inferiour command line editing â€“ YMMV though). Iâ€™m okay with Dave Korn, and heâ€™s okay with mksh as long as I try clearly to get people to not confuse it with AT&T ksh. And mksh is by no means new, just its â€œproduct placementâ€. Itâ€™s actively developed though (like ksh93).

Off again,
//mirabilos (Mr. mksh)


----------



## vermaden (Jan 14, 2011)

@DutchDaemon

Ok, thanks mate 

@mirabilos

Ok, goot to know, thanks.


----------



## purgatori (Jan 14, 2011)

vermaden said:
			
		

> My choices are:
> *#! /bin/sh* for scripting
> *ZSH* for interactive use
> *CSH* for root account (also often the first thing I type on the root prompt is '*zsh*' if its avialable)



This.


----------



## chrcol (Jan 19, 2011)

Mel_Flynn said:
			
		

> ```
> make -C /usr/ports/shells/bash -D WITH_STATIC_BASH -DWITHOUT_NLS PREFIX=/ install
> ```
> 
> ...



also to add further, changing root's shell still allows login with toor on default shell, should a bash problem occur.


----------



## chrcol (Jan 19, 2011)

MartijnAtLico said:
			
		

> I use zsh.. currently I only use about 5% of it's functionality, but someday I'm going to do great things with it
> 
> http://friedcpu.wordpress.com/2007/07/24/zsh-the-last-shell-youll-ever-need/



unfortenatly #1 failed for me on that list of reasons to use it.

my prompt variables fail and act like sh instead of bash.


----------



## chrcol (Jan 19, 2011)

UNIXgod said:
			
		

> +1 but I never change my shell under root. even if it's avalable. Even the zsh guys don't suggest it for root.
> 
> I can't begin to explain the problems that could occure if the root shell is changed.



please explain since I have ran root using bash for a numbr of years without noticing problems.

the only problem I know off really is if the bash binary breaks preventing login.


----------



## Galactic_Dominator (Jan 19, 2011)

chrcol said:
			
		

> please explain since I have ran root using bash for a numbr of years without noticing problems.
> 
> the only problem I know off really is if the bash binary breaks preventing login.



Well since a lot of us work on remote systems off-site, sometimes a long way away, that is a pretty large problem.  There are still a ways that binary can break(not all /usr are located on the same disk / is) so given that bash as an interactive shell doesn't hold a lot of advantages over something like tcsh then I guess the standard advice is still good advice.  The static binary approach would be less than ideal for memory constrained system running a bunch of bash scripts and if you aren't running a bunch of bash scripts it's really debatable if bash gives you an advantage.

It's more of a "Should you change the root shell" vs "Can I change the root shell" question and that's best answered by the person/group administering the system.  If bash  gives useful functionality not present in tcsh and you're ok with the risk and hassle then switch.


----------



## chrcol (Jan 19, 2011)

I also remotely administer servers.

in over 5 years I think I have had bash break twice, the last time it happened I was aware of toor and it was a non issue as I simply logged into toor, and recompiled bash to fix it.

I have a few issues with the default shell, mainly.

rehash - urrgh
poor command history system
less compatible with most scripts out there.
my prompt variable doesnt work on it.

its down to choice which I am fine with, but am wondering if this changing root shell thing is simply overstated given that there is a recovery account.


----------



## Galactic_Dominator (Jan 19, 2011)

chrcol said:
			
		

> I also remotely administer servers.
> 
> in over 5 years I think I have had bash break twice, the last time it happened I was aware of toor and it was a non issue as I simply logged into toor, and recompiled bash to fix it.


You must mean you were aware of toor prior to your issue and enabled it.  Making toor available to a remote login isn't something that's good practice if that's what you did.



> rehash - urrgh


Difficult to respond to.  rehash and the frequency required has never caused me a second thought.


> poor command history system


I guess that's a per-user preference because that's primarily the reason I hate bash.  It's command history filter is near useless IMO.  Most of the time it's just easier to retype the whole thing under bash.  tcsh and the FreeBSD defaults allow me to quickly find complex commands I've already got in history.


> less compatible with most scripts out there.


Actually most scripts are  shebang'd to run with the shell they were written for which is hopefully /bin/sh.  Many also test for the proper shell before executing main code.  Also please note this is about the interactive, not scripting shell.  I'm not saying you should use 
	
	



```
#!/bin/tcsh
```
 in your scripts.


> my prompt variable doesnt work on it.


Use the appropriate tcsh variables and you won't have a problem.



> its down to choice which I am fine with, but am wondering if this changing root shell thing is simply overstated given that there is a recovery account.


I don't think so.  It's typically a new user issue(coming from linux) and toor account is disabled by default.  Expecting the new user to remember and deal with all the complications of changing the root shell is just asking for trouble.


----------



## UNIXgod (Jan 19, 2011)

chrcol said:
			
		

> please explain since I have ran root using bash for a numbr of years without noticing problems.
> 
> the only problem I know off really is if the bash binary breaks preventing login.



I though this was answered or is this just bait?


----------



## pkubaj (Jan 19, 2011)

Zsh wherever it's possible.


----------



## chrcol (Jan 20, 2011)

why are people mentioning enabling toor?

I have done nothing to specifically enable toor and am able to use it on newly deployed servers.

also I am not baiting anyone.


----------



## Galactic_Dominator (Jan 20, 2011)

chrcol said:
			
		

> why are people mentioning enabling toor?
> 
> I have done nothing to specifically enable toor and am able to use it on newly deployed servers.



Because if you haven't enabled the toor account, the only way you can utilize it is an `# su` from a super-user account.  You *cannot* login with a default toor account meaning there's no way to fix your bash error you claimed to earlier via toor unless you have explicitly setup the account.  

Run `# vipw`look at the toor line.  Notice the '*' in the second field?  That mean that account cannot login.

Either way, you're wrong on something.

FWIW, there is nothing inherently special about the toor account, it's just another UID 0 that comes disabled by default.


----------



## chrcol (Jan 21, 2011)

I just tested again and can login to toor over ssh even without it having no shell configured in passwd. It uses csh.  So it seems a misunderstanding here, it blocks su but not direct ssh login.  So regardless of this, someone can setup an alternative shell for root and then enable the toor account for su.  Still not a disaster to change root's shell.


```
Jan 21 09:38:36 vm1 sshd[81144]: Accepted publickey for toor from 192.168.1.124 port 54316 ssh2
```


```
# id
uid=0(root) gid=0(wheel) groups=0(wheel)
```


```
# grep toor /etc/passwd
toor:*:0:0:Bourne-again Superuser:/root:
```


----------



## Galactic_Dominator (Jan 25, 2011)

chrcol said:
			
		

> I just tested again and can login to toor over ssh even without it having no shell configured in passwd. It uses csh.  So it seems a misunderstanding here, it blocks su but not direct ssh login.  So regardless of this, someone can setup an alternative shell for root and then enable the toor account for su.  Still not a disaster to change root's shell.
> 
> 
> ```
> ...



Obviously by this point you're trolling at this point disseminating incomplete information to further your position.  I encourage anyone who is actually interested in changing their shell to "verify" these statements before they proceed.  You will find a different scenario than the one quoted above.  ssh via pam authenticates against /etc/master.passwd.  The only default scenario where ssh can bypass a disabled account is using ssh keys or some other type of authentication like openldap/NIS.  If you have bypassed normal authentication paths in order to make toor work, that does invalidate your point about toor being accessible remotely by default.  You did need to do extra steps prior to a bash login issue in order to resolve it.  

Also as mentioned before, enabling a UID 0 user for remote login is generally not considered safe.  It's somewhat more debatable if you're using keys and such, but even then it's another attack vector.  The standard sshd config file doesn't allow root logins for a reason.  This is also the policy of many companies so you may not have a choice in the matter.


----------



## chrcol (Jan 26, 2011)

will you stop calling me a troll I find it offensive.

the fact is this.

I use key login, I allow key login for root over ssh (but not password), and that allows me to login as toor using my key over ssh without modifying the toor account.

What is so incomplete about it?  I dont call people trolls who disagree with me.


----------



## DutchDaemon (Jan 26, 2011)

Stop the bickering, or you'll both get to know the /sbin/nologin shell! p)


----------



## Mattias (Jan 26, 2011)

bash :f
- since it's works flawlessly right out of the box on the Linux distro's I'm running, I use it on BSD's as well (for uniformity). And I really don't notice any difference speed-wise.. guessing _I'm_ the bottle neck in the interaction hehe.


----------



## rusty (Jan 26, 2011)

root = csh
me/users = tcsh

No complaints from anyone with access to my servers.


----------



## Bra1n0v3rfl0w (Jan 29, 2011)

(1) user = tcsh
(2) root   =  csh
(3) script  =  sh
(1),(2) reason: http://www.freebsd.org/doc/handbook/install-post.html, and page 4 of this thread (January 5th, 2011, 22:53), by *UNIXgod*: reference to chapter 7.10 FAQbook.
(3) reason: http://www.kitebird.com/csh-tcsh-book/csh-whynot.


----------



## UNIXgod (Jan 29, 2011)

Bra1n0v3rfl0w said:
			
		

> ... and page 4 of this thread (January 5th, 2011, 22:53), by *UNIXgod*: reference to chapter 7.10 FAQbook.



You have immortalized me!!!! =)

I'll quote it for all to see:


> 7.10. Why is /bin/sh so minimal? Why does FreeBSD not use bash or another shell?
> 
> Because POSIXÂ® says that there shall be such a shell.
> 
> ...



Here is a clean link to Csh Programming Considered Harmful


----------



## Bra1n0v3rfl0w (Jan 30, 2011)

UNIXgod said:
			
		

> You have immortalized me!!!! =)



Hahaha...nice one!

To be true, I added the first link I had in mind regarding _csh programming considered harmful_. :e


----------



## anon12b (Apr 26, 2012)

Galactic_Dominator said:
			
		

> Also as mentioned before, enabling a UID 0 user for remote login is generally not considered safe.  It's somewhat more debatable if you're using keys and such, but even then it's another attack vector.  The standard sshd config file doesn't allow root logins for a reason.  This is also the policy of many companies so you may not have a choice in the matter.



This is not really true. There is not a significant benefit to logging in as a user, and using programs to escalate privileges. The problem becomes one of root equivalency. Indeed, the only consideration is that "root" is a known account name, if you were using password authentication. If a malicious party were able to capture credentials to login on a UID 0 account, then that is equal to an account that is able escalate its privileges.  In particular, there have been several issues with sudo(8), and using su(1) to increase privileges (or, at all with a TTY, as opposed to a command) is not great. I suggest you search for Solar Designer's postings on the issues, if you are not aware of why this is the case.

To clarify, what I mean to say is: logging in as UID 0 is as safe as logging in as any account that can become UID 0; you should be using keys, not passwords, for any privileged account -- including accounts that can escalate privileges; the standard sshd configuration doesn't allow root logins primarily because it supports password authentication, and the root password may not have been correctly set by the time SSH is running; the policy of companies is related to accountability, not security per se (in fact, that is what sudo(8) is pretty good for: accountability). 

That out of the way: I have tended to always use ksh, as I quite often use commands that would create a small script, and the syntax of csh is alien to me.  For standard program invocation, and minor file manipulation, I found that FreeBSD's tcsh was actually quite nice (after using some tips from this bulletin board); I don't think I would swap to using it full time, though.


----------



## soupbowl (May 9, 2012)

I have been using zsh for years and love it.


----------

