Hi, Is there a way to determine what shells are available on a Linux box other than trying out /bin/shellname ? Even a workaround would do :) Thanks. asked 03 May '10, 08:16 Knight Samar |
Have you a look in /etc/shells?
Thinking about this further you could also make use of "whatis" command for any shells that are not listed in "/etc/shells".
This will list any shells in '/bin' that have a description that contains the word "shell". It may also be worth doing this in other directories such as /usr/bin, /sbin. This may produce the odd false positive but should give you something to work with. answered 03 May '10, 09:31 gjcwilliams 3
Some shells listed in /etc/shells might not be there, something like this might help: for i in $(</etc/shells) ; do [[ -x $i ]] && echo $i ; done
(03 May '10, 16:34)
jlliagre
Nice work of a for loop jlliagre.
(03 May '10, 19:36)
bullium
@gjcwilliams thanks, i didn't know there was a /etc/shells. and thanks for the neat trick using 'whatis'. It never crossed my mind, i could do that ! @jilliagre, thanks for the trick! It works great too! I am already loving LinuxExchange!
(05 May '10, 09:32)
Knight Samar
|
which and whereis, along with locate. on a newly installed machine run
when you first install the OS so you can use locate, which likes specific syntax,but shows everything matching. And on Slackware you can grep /var/log/packages for a match. For determining, say, whether you had ruby installed, you would type:
And if ruby is installed, you should get back:
...others are python, bash, tclsh, tcsh, zsh, ksh, tksh, sh (usuallaly just a symlink to /usr/bin/bash, but will actually point to /bin/tcsh if you choose the C shell as your particular user's default. man whereis man which man locate to quickly determine the default shell for any particular user simply grep /etc/password for their username and examine the designated shell (or lack thereof) there.
I hope that helps! Kindest regards, Bradley . answered 15 May '10, 12:31 tallship @tallship but that requires me to try out all shells that may be which thus require me to know what shells are out there. As I stated in my question, I wanted to know a way wherein I can know what shells are available on the box other than trying out each shell.
(17 May '10, 18:22)
Knight Samar
@Knight_Samar: That is how you tell without as you say, "trying out each shell". this simply proves the existence of the shells and returns an error if they don't exist - because /etc/shells can have bogus entries (which is common for say, chroot'd accounts for ftp only configs, etc.), and as I pointed out above, is incomplete because it fails to list many shells, like the ones I listed above. You can use the "whatis" construct above, but as even gjcwilliams points out himself in his post - it can provide false positives. The way I provided shows you definitively. Hope that helps! Bradley
(24 May '10, 19:24)
tallship
|
I'm not sure whether the following will double-check the actual existance of the shell files but it should work and looks a little neater too:
answered 12 May '10, 17:54 pmarini chsh has only -h and -s options on ubuntu 9.04 :( so no listing possible.
(12 May '10, 22:31)
Knight Samar
|