Home | Articles | About | Contact | Forum |
Sunday, December 04, 2016



Lunarpages.com Web Hosting

Mailing List

E-mail:
By Joining the mailing list you will be notified of site updates.


Show Your Support For
This Site By Donating:











Audience: Newbies - System Admins
Last Updated: 6/24/2011 6:08:51 PM
**All times are EST**



Linux Shell Environment

By Erik Rodriguez

This article provides a overview of the Linux shell environment.



What is a Shell?

The term "shell" sometimes confuses beginners. When referred to by Linux users, the term "shell" means using the command line interface. It is important to know that using a shell is similar to use the DOS prompt. Linux also has a GUI (Graphical User Interface - pronounced gew-eee that is similar to Windows. Using the shell is often frustrating for beginners because you must know the commands, what they do, and the proper way to enter them. This means using the correct syntax. The Linux OS is controlled by the kernel, which is the heart of entire system. However, the kernel can only understand machine code. This is why a shell must be used. The shell interprets commands given by the user and translates them into machine code that the kernel can understand.

Types of Shells

There are several different types of shells available. Each shell has its own pro's and con's, but each shell can perform the same basic tasks. The main difference between them is the prompt, and how they interpret commands. The table below shows the most common shells and their attributes.

Shell Name Ash Bourne Bash (Bourne Again) Korn C-shell T-shell Zsh
Author Kenneth Almquist                     Brian Fox/Chet Ramey Eric Gisin                     William Joy Paul Falstad
Binary ash sh bash ksh csh tcsh zsh
Default Prompt   $ $ $ % %  


The most common shell used by default on Linux systems is bash. In bash, the default prompt for a user is a $ sign. Unless you are logged in as root in which case it the # sign. As you can see by the output below, the root (administrator) is logged in and the # sign is displayed [which I have labeled red].

[root@roswell root]# ll
total 12372
-rw-r--r--    1 root     root         1600 Jul 22 18:01 anaconda-ks.cfg
-rwxr--r--    1 nobody   nobody   10044856 Jul 30 07:03 Cpanel-7.1.0-RELEASE_20-Linux-i686-glibc-2.1.tar.gz
drwx------    2 root     root         4096 Jul  4  2003 cpdist
-rw-r--r--    1 root     root        20135 Jul 22 18:00 install.log
-rw-r--r--    1 root     root         3934 Jul 22 18:00 install.log.syslog
-rw-r--r--    1 root     root          734 Jul 27 06:17 smb.conf
-rwxr--r--    1 nobody   nobody    2448372 Jul 26 22:50 snort-2.gz
-rw-r--r--    1 root     root       109773 Jul 27 05:08 squid.conf
[root@roswell root]# 

Notice the prompt changes when weaponx (standard user) is logged in. It is now a standard $ sign, which I have labeled in green.

[weaponx@roswell weaponx]$ ll
total 4
-rw-rw-r--    1 weaponx  weaponx       203 Jul 31 04:39 overflow.c
[weaponx@roswell weaponx]$ 




Switching Shells

Upon installation, you are prompted as to what shells you want installed. You can also specify a shell for each user. Let's say that weaponx wants to switch from the bash shell (bash) to the bourne shell (sh). Notice the output below:

[weaponx@roswell weaponx]$ sh
sh-2.05b$

Now that weaponx is using the boune shell, lets see how this shell interprets the long listing command.

sh-2.05b$ ll
sh: ll: command not found
sh-2.05b$ 


Ah, it didn't work! If we use the same command in the bourne again shell (bash), we get a different output.

sh-2.05b$ bash
[weaponx@roswell weaponx]$ ll
total 4
-rw-rw-r--    1 weaponx  weaponx       203 Jul 31 04:39 overflow.c
[weaponx@roswell weaponx]$


That is just a simple example of how different shells handle commands. Note that some shells will not perform certain extended commands. Using bash is your best bet. It is the most common, and rather easy to learn once you get the hang of it. If you would like to see a list of common bash commands click here.

Contact Us

If you found this information useful, click the +1 button



Your E-mail:


Subject:


Type verification image:
verification image, type it in the box

Message:


NOTE: this form DOES NOT e-mail this article, it sends feedback to the author.


TCP vs. UDP
Juniper SRX anti-spam filtering config
Windows Server 2008 Clustering Configuration
Windows 2008 R2 Network Load Balancing (NLB)
Extreme Networks: Downloading new software image
Juniper SRX save config to USB drive
Juniper SRX logout sessions
Extreme Networks Syslog Configuration
Command line drive mapping
Neoscale vs. Decru
Data Security vs. Data Protection
Juniper SRX Cluster Configuration
HOWTO - Create VLAN on Extreme Switch
Using a Non-local Colocation Facility
Linux Server Administration
IT Chop Shops
Flow Viewers: SFLOW, NetFLOW, and JFLOW
Exchange 2007 Back Pressure
IPtables open port for specific IP
Politics in IT Departments
HOWTO - Block Dropbox
Cisco IOS Cheat Sheet
Subnet Cheat Sheet
Design a DMZ Network
How DNS works
Firewall Configuration
Juniper SSG Firewalls
Server Management
Configuring VLANs
Runlevels in Linux
Server Clustering
SONET Networks
The Red Hat Network
Server Colocation
Complicated Linux Servers
Dark Fiber
Data Center Network Design
Firewall Types
Colocation Bandwidth




Copyright © 2002-2016 Skullbox.Net All Rights Reserved.
A division of Orlando Tech Works, LLC
By using this site you agree to its Terms and Conditions.
Contact Erik Rodriguez