LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


View Poll Results: What is your preferred Linux login shell?
ash 0 0%
bash 287 81.77%
csh 4 1.14%
dash 3 0.85%
es 0 0%
fish 2 0.57%
ksh 18 5.13%
pdksh 2 0.57%
rc 1 0.28%
scsh 0 0%
sh 3 0.85%
tcsh 10 2.85%
wish 0 0%
zsh 16 4.56%
Other 5 1.42%
Voters: 351. You may not vote on this poll

Reply
  Search this Thread
Old 06-18-2014, 01:27 PM   #61
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065

Quote:
Originally Posted by Langjan View Post
Serendipity7000, us newbies will just have to stay out in the cold, I wonder if all these posters actually know what it's about, seeing nobody seems anble to tell us!
Nah: the "shell" (no matter which it is) is, literally, a command and programming language.

You type a command, hit the carriage return key (nowadays enter, thanks mostly to Microsoft) and the shell program does a fork-and-execute of that command. The fork part creates a new shell that inherits all the environment settings of the parent shell and executes what has become a child process (the command you entered). When that child process completes, it dies and you're returned to the parent shell for the next command or shell program you want to enter.

A shell program is when you type something like
Code:
while condition is TRUE
do
     command [arguments]
done
In this case, when you type the word "done," the fork and execute takes off and does what you told it to (if you told it correctly, that is).

All shells do this in pretty much the same way -- the difference is grammar and syntax.

The Bourne Again Shell (BASH) is a port of the original Bourne Shell (sh) with KornShell (ksh) features and functions folded in. It's not copied from original Unix code, it's a complete rewrite so as not to violate copyrights. BASH also includes some extra features that have been added over the years. The developers of BASH took the manual pages and other documents that described how to use sh and ksh (and most likely a couple others) and wrote C code to make BASH do that.

There are a large number of shell programs on every Unix and Linux system: to see how many and what they are:
Code:
file /bin/* /usr/bin/* | fgrep POSIX
There are quite a few, not all found in /bin and /usr/bin.

Fact is, you can write a large number of useful shell programs once you get the grammar and syntax down and you'll find yourself using the shell to do useful work more and more as time goes on.

Hope this helps some.
 
2 members found this post helpful.
Old 06-18-2014, 01:34 PM   #62
Drakevr
Member
 
Registered: Jan 2013
Location: Greece
Distribution: Slackware64, openBSD
Posts: 38

Rep: Reputation: 7
I use the MKSH variant/implementation of KSH in all of my systems.
 
Old 06-18-2014, 02:16 PM   #63
ruphert
LQ Newbie
 
Registered: Jun 2014
Posts: 2

Rep: Reputation: Disabled
You should check http://fishshell.com/ before vote here We have 2014!
 
Old 06-18-2014, 02:46 PM   #64
montuos
LQ Newbie
 
Registered: Apr 2011
Location: Virginia, USA
Distribution: Kubuntu 12.04
Posts: 6

Rep: Reputation: 0
Yup; bash because it's there.
 
Old 06-18-2014, 05:16 PM   #65
snufkinski
LQ Newbie
 
Registered: May 2014
Posts: 1

Rep: Reputation: Disabled
bash (Linux)

csh (BSD)

because there're there
 
Old 06-18-2014, 07:41 PM   #66
stealthpaladin
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by Langjan View Post
Serendipity7000, us newbies will just have to stay out in the cold, I wonder if all these posters actually know what it's about, seeing nobody seems anble to tell us!
Hey there, Langjan; if you've ever opened your terminal on a Linux distro, the login-shell is basically what you're typing commands into. Same thing applies if, for instance, you're on a Windows machine running PuTTY to connect to a server. Now, say I've logged in / opened the terminal on whatever distro, you now have some options. For instance if the default shell is bash, your distro very likely has some other shells pre-installed. It is usually very easy to install others via your package manager too.

So, if bash is the default and dash is also installed, I may just issue the command:
dash

which will simply start up the dash interpreter. Just as when running vim/vi/... your terminal has now given over control to the dash program which lets you use different syntax and run dash scripts directly from the command line. Different shells have different syntax for their more advanced features like: loops, scripting variables, parsing arguments passed to a script, etc...


So, once you have run dash this way, dash would be referred to as a non-login, interactive shell. Basically that just means it isn't the shell you logged into, but one you ran after you got going. Another example of this would be using tools like screen or tmux, which allow you to run multiple terminal 'inside' of another. I could set my default tmux shell to tcsh, but it would still not be the login shell unless that's -more-or-less- the system default.

I'm over-simplifying a little bit for example, but that's PRETTY MUCH what's going on.


imho, the popularity of bash isn't really a sign of it's own feature-set, but a side-effect of it's early adoption into redhat and debian. The vast majority of distros are based on these and since bash readily works with both and is available on many systems, it self-perpetuates. If you've done any administrative work on Ubuntu, CentOS, Fedora, Mint.... then you have a bit of a push to start liking bash. (note, it isn't always the default but can be set as such and commonly comes set as default)


For myself, I particularly like plain sh for the same reason. It is -very- portable across distributions. Because I'm a programmer that enjoys writing utility tools I don't often need bash to extend things for me. When I do need that extra boost, and since I've used FreeBSD some in recent years, I really like tcsh because it is a shell based on the C language. tcsh is the default shell for FreeBSD.

I really imagine that most opinions on which shell is 'best' come down to similar preferences based on what you've worked with and what use-cases you've encountered in personal experience, vs the actual language features. Many shells do have some pretty cool features though =] Often the trade-offs are: flexibility, powerful features, community support and portability.
 
1 members found this post helpful.
Old 06-18-2014, 07:52 PM   #67
stealthpaladin
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by tronayne View Post
Nah: the "shell" (no matter which it is) is, literally, a command and programming language.

You type a command, hit the carriage return key (nowadays enter, thanks mostly to Microsoft) and the shell program does a fork-and-execute of that command. The fork part creates a new shell that inherits all the environment settings of the parent shell and executes what has become a child process (the command you entered). When that child process completes, it dies and you're returned to the parent shell for the next command or shell program you want to enter.

A shell program is when you type something like
Code:
while condition is TRUE
do
     command [arguments]
done
In this case, when you type the word "done," the fork and execute takes off and does what you told it to (if you told it correctly, that is).

All shells do this in pretty much the same way -- the difference is grammar and syntax.

The Bourne Again Shell (BASH) is a port of the original Bourne Shell (sh) with KornShell (ksh) features and functions folded in. It's not copied from original Unix code, it's a complete rewrite so as not to violate copyrights. BASH also includes some extra features that have been added over the years. The developers of BASH took the manual pages and other documents that described how to use sh and ksh (and most likely a couple others) and wrote C code to make BASH do that.

There are a large number of shell programs on every Unix and Linux system: to see how many and what they are:
Code:
file /bin/* /usr/bin/* | fgrep POSIX
There are quite a few, not all found in /bin and /usr/bin.

Fact is, you can write a large number of useful shell programs once you get the grammar and syntax down and you'll find yourself using the shell to do useful work more and more as time goes on.

Hope this helps some.
oh, seems you already have been over some of this. good notes on the process and historical significance around copyright =]
 
Old 06-18-2014, 11:35 PM   #68
drdisk
LQ Newbie
 
Registered: May 2014
Location: McDowall, QLD, Australia
Distribution: Ubuntu 14.04
Posts: 10

Rep: Reputation: Disabled
During the eighties, sh was the only shell I knew. [UNIX and XENIX]
In the nineties, I used csh and ksh. [SunOS and Solaris]
In the noughties, ksh and bash. [Solaris and several flavours of Linux]
In the current decade I have only used bash. [Ubuntu plus (rarely) some other linux]

On a side-note: using MS-DOS, long before the arrival of MS Windows, and responsible for running a well-known training Institute on PCs running PC-DOS and then MS-DOS, I did a great deal of extensive programming in the DOS batch-file language and, after debugging them, compiled the .BAT files into .COM files and, later into .EXE files. Some of the .BAT programs were up to about 35 pages of DOS commands. At that time, all the other branches of the Institute in many countries were still running CP/M.
Years later, on visiting a branch of that Institute in a different country, MS-DOS having at last replaced CP/M, I was amazed to see that the main shell for the use of the students was a by then at least ten-years-old copy of one of my old Batch programs!

I must say I was very glad when the time came to leave MS-DOS behind me and get stuck into Linux.
 
Old 06-19-2014, 03:31 AM   #69
normanlinux
Member
 
Registered: Apr 2013
Location: S.E. England
Distribution: Arch
Posts: 161

Rep: Reputation: Disabled
Bash will obviously be the most popular (common?) choice since it comes as the default shell on most varieties of Linux and is a petty good shell, so the majority have never tried anything else.

I started in the eighties with the Bourne shell, which was a revelation compared to other systems I had used, and moved up to ksh, then bash on Linux. Having seen some references to zsh I decided to give it a try. There is a lot to learn, but now I use nothing else.

I would encourage people to take the time to give zsh a real try (i.e. not just 10 or 20 minutes followed by "what's the big deal"). It won't suit everybody (does anything, really?) but I think many of you will come to love it - even if just for something as trivial as the right prompt - and will find lots more goodies (such as multios etc).

Some useful references:

http://friedcpu.wordpress.com/2007/0...ull-ever-need/
http://www.linux-mag.com/id/1079/
http://zshwiki.org/home/convert/bash
http://zsh.sourceforge.net/Guide/zshguide.html
 
Old 06-19-2014, 06:29 AM   #70
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,727

Rep: Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741Reputation: 2741
Preferred Linux logon shell

I prefer to work in bash, having come to appreciate the power and convenience. What shell is opened during logon is less important than what shell you got along with. I can boot into dsh in posix mode, or ksh, and be just fine as long as bash is available. I just run and script for the shell I like, regardless of what shell I am given at logon.
 
Old 06-19-2014, 06:45 AM   #71
serafim
LQ Newbie
 
Registered: Aug 2005
Location: Nacka, just outside of Stockholm, Sweden
Distribution: Manjaro Mate, Ubuntu Mate, Debian
Posts: 22

Rep: Reputation: 5
Smile Bash

Bash because whatever I try I only remember either bash or tcsh commands, nowadays fewer and fewer tcsh ones.
99 % of my scripts are in bash so of course I consult them....
 
Old 06-19-2014, 07:49 AM   #72
wbrehob
LQ Newbie
 
Registered: Feb 2011
Distribution: Red Hat & Ubuntu
Posts: 1

Rep: Reputation: 0
Login shell: bash (or ksh if bash if not available)
Simple shell scripts: sh (because it is available on EVERYTHING)
More complicated shell scripts: bash

I agree that *sh is not the best programming language for a lot of things, but when you're a UNIX system administrator you don't need speed, you need the ability to call whatever command is needed at the time to run backups, check devices, look through files, etc., you need easy input/output, and you need it to run on whatever system your customer has laying around without having to install new stuff. *sh provides all of those.
 
Old 06-19-2014, 02:16 PM   #73
André7785
LQ Newbie
 
Registered: Mar 2009
Distribution: Open SuSE 13.2, Leap 42.1
Posts: 19

Rep: Reputation: 0
How can I figure out on which shell the graphical login screen is based on?
When the Xorg-Server doesn't start I'm on bash, not as preference but as a presence.
 
Old 06-19-2014, 02:57 PM   #74
texadactyl
LQ Newbie
 
Registered: Apr 2014
Location: Dallas TX, USA , 3rd Rock, Sol
Distribution: Xubuntu, Raspbian
Posts: 6

Rep: Reputation: Disabled
Andre,

The graphical login screen (pre-login) and the Xorg software have nothing to do with a specific user's preferred shell; the shell of choice is launched when that user performs a login. Only when a specific user is logging in does a shell get invoked. See file /etc/passwd.

For example, my login entry on one of my computers is as follows:
elkins:x:1000:1000:Richard Elkins,,,:/home/elkins:/bin/bash

As you can see, my default shell is "bash". That can be changed at any time through a GUI tool or direct editing; note that a change is only apparent at the next login.

Executing `man 5 passwd` will show the manual page for /etc/passwd and an explanation for each variable-length field (field separator = ':') on every text line.

Richard
 
Old 06-19-2014, 02:59 PM   #75
PilotFishBob
LQ Newbie
 
Registered: Mar 2006
Posts: 1

Rep: Reputation: 0
Bash
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Preferred central login server? szboardstretcher Linux - Server 0 03-20-2014 07:45 PM
Which Is Your Preferred Linux Shell? jeremy Linux - General 47 01-10-2014 07:55 PM
Login Shell / Non-Login shell Clarification needed (RHEL 6.3) kingston Linux - Newbie 1 12-07-2012 12:51 AM
Preferred distribution for c and shell programming? Its All in your Head Linux - Distributions 3 07-07-2007 03:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration