Linux Classes
Share This With a Friend  
LINUX CLASSES - LINUX BASICS

Which Linux Shell Should I Use?

Bash (and Other Shells)

Bash, the default Linux shell, is popular and offers lots of advanced features. It combines many of the niceties found in the Bourne shell (the original Unix shell) and other modern shells. But there are alternatives. The Korn shell is popular among many Unix users because it offers a rich scripting (programming) facility. Korn is commercial software, but there is a public-domain (free) version for Linux called pdksh. Another shell that's popular with C language programmers is the C shell, which exists for Linux as tcsh.

Most versions of Linux provide both pdksh and tcsh, and you can try them out by entering their names at your shell prompt. If you decide to make a permanent switch to something other than the default bash shell, you must log in as root and edit the entry for your user ID in the /etc/passwd file.

Entries in the /etc/passwd file look like the following example. Just change "bash" at the end of the line to "pdksh" or "tcsh," and you're done. (If you're not familiar with Linux-based text editors, see "Text Editors").

hermie:x:501:1::/home/hermie:/bin/bash

Though there are alternatives, I suggest you familiarize yourself with bash's features first, because bash is the most commonly used Linux shell. In the rest of this section, we'll go over the basics of working in the bash shell, so go ahead and log in as user hermie now and follow right along. It'll help a lot to enter the commands as you go, experiment with them on your own, and see the actual output.

For more information on the bash shell, see the bash manual.

Previous Lesson: Logoff and Shutdown
Next Lesson: The Command Prompt

[ RETURN TO INDEX ]


   

Comments - most recent first
(Please feel free to answer questions posted by others!)

David     (22 Aug 2013, 01:36)
I don't think the ls behavior is shell dependent, you probably have just a different environment configuration under both shells which affects the ls output behaviour.

But I think you should avoid using ls for such purposes anyway. Most of the time a simple "echo * > list.txt" is enough. When you really need them line separated you might instead use "printf '%s\n' * > list.txt"
Robert     (07 Mar 2013, 19:00)
I'm working with linux terminal running on a server using tcsh. Wherever I use "ls -1 * > list.txt" to capture a list of files, I notice that there are some additonal characters flanking a filename if this file was set with execute permission. Then the filename in the list won't be recognized subsequently. Certainly when I change the shell to bash, it won't occur. I'd like to know why? Thank you for your time and help.
Robert
james     (21 Mar 2012, 20:07)
I am attempting to learn linux for use on my android phone (android is based on top of a linux os) My question is; Is there anyway for me to get into the Root user through the terminal. (there is no login) I really just want to get in and delete some non-essential files through the terminal but they are all protected and when i try to delete them they are "read only". Is there any back door route?
shitiz     (15 Dec 2011, 10:15)
could u pls tell me why do we need to login as a root user to reboot or shut our system down in command line interface whereas we can do the same without being root user in the graphical interface......??????????
Bob Rankin     (14 Sep 2011, 09:54)
@teejay - And the answer is the same. See the nav bar on the left.
teejay     (13 Sep 2011, 23:48)
Hi Bob, same thing happen to me when I click the link "Text Editors" as with Humphrey. I also, would like to ask with the correct address for the link.

Thank you!
duvvuri     (02 Jul 2011, 10:34)
To know your shell just type the following at the command prompt: -

$ echo $SHELL

To know the list of available shells on ubuntu :-
$ cat /etc/shells
BlackHatLinux     (22 Jun 2010, 06:54)
hello dr.bob, a friend of mine uses Ubuntu and stuck after reading this chapter because he couldn't find pdksh or tcsh on his system. i just want to add some info on how to fix this, in case someone has the same problem. run this command on terminal prompt:

sudo apt-get install pdksh (to download and install pdksh)
sudo apt-get install tcsh (to download and install tcsh)

by the way dr.bob, you're great!! thanks for the lessons.
Bob Rankin     (01 Mar 2010, 07:00)
@Cliff, the text assumes you have a computer with Linux installed. If you want to try Linux, see this article: http://askbobrankin.com/wanna_wubi.html
Cliff     (26 Feb 2010, 07:30)
I'm sorry Bob, color me stupid, but I get to section "Which Linux Shell Should I Use?" line "In the rest of this section, we'll go over the basics of working in the bash shell, so go ahead and log in as user hermie now and follow right along." and I am suddenly lost - log into WHAT? All I have been doing so far is reading. I have not been directed to download anything to anywhere in anyway!? Should I download UBUNTU or some other distro and if so, where and how. I am an old COBOL programer here, so, I am not completely stupid, but I think I missed something along the way. You also indicated previously that I now know how to pronounce Linux - is it Linux (like Lennox) or is it Linux (like Lionel) - short i or long i? I learned Fortran, RPG II, COBOL, and even IBM Assembly language, work on DEC machines in a language I can't even remember anymore, managed 25 DEC databases as a DBA, but, I AM old. This shouldn't be this tough, but you have lost me on 2 key points. Has it been so long that I should read something else before I come back to this? BTW, this is the 2nd time I have read this far only to get frustrated and quit. Any help would be appreciated.

Cliff
Bob Rankin     (09 Feb 2010, 09:47)
Sorry for the confusion, but if you look in the nav bar to the left, you'll see the "Linux Editors" section after clicking that link.
Humphrey     (09 Feb 2010, 09:21)
Hi Bob, was reading your interesting prose, unfortunately the link "Text Editor s" on the "Which Linux Shell Should I Use" just sends me at the end of the page.
Could you provide me with the correct address or fix the link Please?
Many thanks, and many Years of Bliss Life to You.

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 
 


Ask Bob Rankin - Free Tech Support


Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.