Linux Shell Commands

What Is the Linux Shell?

To use Linux--or any Unix-like system, for that matter--you need to know a few things about shells. A shell is a program that acts as an intermediary between you and the guts of the operating system. In a DOS environment, acts as your shell. Linux shells have more interesting names (like bash, pdksh, and tcsh), but they do pretty much the same thing. In addition to translating your commands into something the kernel can understand and act upon, the shell adds some important functions that the base operating system doesn't supply. Using a Linux shell means working with a command line, which is much like working from a DOS prompt. Modern version of Linux come with graphical user interface (GUI) but some Linux tasks can only be done from the command line. The knowledge of how Linux works that you'll gain in this section will provide the foundation you need to use Linux successfully and efficiently. Here's a description of the basic features of all Linux shells, a preview of the functions they perform, and a rundown of what you'll learn in this section.

Prompts  A prompt is a character or string of characters (such as $ or #) that the shell displays when it is ready to receive a new command. You'll learn about the different types of prompts and how to customize them to suit you and the way you work.

Command resolution  When you enter a command, the shell must determine which program to run in order to perform that command. You'll learn how shells do this and how to change the command resolution process to suit your needs.

Job control  Linux lets you multitask (run more than one command at a time). You'll learn how to start, list, and stop tasks; you'll also learn the difference between foreground and background task execution.

Command history and completion  When you're entering lots of commands, sometimes you want to repeat the previous command or issue a similar one. You'll learn how to recall and modify previously entered commands, as well as find out about some keyboard shortcuts that can automatically complete your commands for you.

Wildcards and aliases Wildcards let you process a whole bunch of files at once, instead of having to repeat the same command for each file. You'll learn how to use two types of wildcards and how to create aliases for commonly used commands.

Piping and I/O redirection  Sending the output of one program directly to another program or to a file can save you time and keystrokes. You'll learn how to pipe program output (connect programs together) and how to make a program get its input from a file instead of the keyboard.

This section will look at each of these functions in detail and teach you how to use them to your advantage. But first--a few shell preliminaries.

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

Previous Lesson: What's Next?
Next Lesson: Root and Other Users



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

yazaan     (03 Nov 2012, 19:55)
i am need server lenux shelk
gedeon     (28 Oct 2012, 12:30)
Matt Gilbert     (01 Apr 2012, 17:43)
Yagvrat it seems Bob is using his own time and resources to help people get started in linux, does it not strike you as being disrespectful to not post in English, or at least, broken English here? I can't help but wonder if that is even really a language you are posting in.
yagyavrat arya     (01 Apr 2012, 16:30)
adka bola :
kash in hasinao ke baap mar jate,
bahana gam ka hota, hum inke ghar to jaate.

Ladki boli:

Bewkoof, Yeh sochana bhi paap hoga,
kisi din tu bhi kisi hasina ka baap hoga.

Ladki boli:
Chandni chaand se hoti hai, sitaron se nahi,
Mohabbat ek se hoti hai, hazaaron se nahi.

Ladka bola :
Chandni agar chaand se hogi to sitaron ka kya hoga,
Mohabbat agar ek se hogi to hazaron ka kya hoga.
praveen     (31 Mar 2012, 22:24)
How will you define kernel?
does it is a process or thread?
I know that it is the heart of Operating System
ken chan     (16 Mar 2012, 01:49)
very helpful site, very very helpful especially to those beginning to learn Shell programming and PERL.

You have a good thing here, keep up the good work!

cephas     (03 Mar 2012, 10:06)
I need help on how to start programming in bash scripting.
I am a newbie
Matt Gilbert     (14 Feb 2012, 11:29)
Great intro to bash, could I suggest that another way to see the bash manual is with the 'man' command.

~$ man bash

it's never too early to start reading the man pages, keep up the good work.
Dennis Derton     (12 Jan 2012, 01:47)
i find your site very useful, sorry you get so many ungrateful people wanting you to teach them everything. its a great site, just wanted to say thank you
Max     (08 Jan 2012, 14:08)
PLEASE center the content, it will look nicer on higher resoloutions

left: 50%;
margin: 0px auto 0px auto;}
Bob Rankin     (06 Jan 2012, 10:35)
@prabhu - Please send me a pony. And a barn. And please come every morning to the barn to feed the pony and clean the stall. I like ponies.
prabhu     (06 Jan 2012, 06:37)
i need basic of linux and how to command in shell reply soon
shane     (07 Nov 2011, 17:07)
nice website just found it now
joseph lalthlamuana     (10 Oct 2011, 13:40)
the BEST place for learning LINUX!!....thank YOU!!
Please write some more on tips and trix!!!
uday     (15 Aug 2011, 13:37)
I have learned linux basics from this site..Thanks!
hanan     (17 Jul 2011, 05:13)
if i want to write a small program that take the first agrument and search for the dot by using len. and then remove the extension and put "back" instead.
for example. if i write it will give me hello.back
any help plzz
Liam     (21 Jun 2011, 18:08)
Finally, I found a Linux tutorial that really works for a newbie. Bob, you really cut the mold off from the cheese... :)
pankaj     (17 Jun 2011, 09:14)
Today, I visit this site and find that this site is really good for student, a one who really want to learn Linux.

I need ebooks of Shell programming,and besic commands. Pls forward me any ebook of Linux. if you can..........

eddiehaskell     (17 Apr 2011, 23:32)
@ ajay kumar:
Download Linux from (or elsewhere). Then download an ISO burner. (Try or You need a CD/DVD drive which can burn CDs. For a bootable disk, your Linux choice should be a 'live' distro.
eddiehaskell     (17 Apr 2011, 23:17)
@ Adrian:
Assuming you're familiar with MS Windows, then PCLinuxOS is a very good distro. It's easy to install and offers several desktop environments. KDE and Gnome are the most popular; I favor XFCE. If you have an older machine (small HDD, limited CPU and RAM), then DSL (Damn Small Linux) is a good distro to learn with. It can also be run live: running the CD without installing to the hard-drive.
Adrian     (10 Mar 2011, 17:51)
Can anyone tell me a good distro to go through this tutorial with?

Thanks in advance
ajay kumar     (08 Mar 2011, 04:16)
pls tell me how i download linux 9 bootable disk.i have tried many times but its all in iso image .pls tell me how i download and convert into bootable disk.pls reply me
Pawan     (16 Jan 2011, 14:08)
Today, I visit this site and find that this site is really good for student, a one who really want to learn Linux.

I need ebooks of Shell programming. Pls forward me any ebook of Linux. if you can..........
Nahid Rauf Sheikh     (13 Dec 2010, 07:47)
My first day today. Learning and getting much more from Dr. BOB. Really very informative and co-operative web site he developed. He is doing for the betterment and prosperous future for next generation. Thanks Bob. Stick to ur work. Its kind of worship to help humanity. Great God be please with u
toni     (30 Nov 2010, 13:01)
It wasn't obvious finding the difference in meaning. It is clear now. Thanks
Bob Rankin     (29 Nov 2010, 19:12)
@toni - Almost the same. -e tests for existence, and -f tests if the file exists and is a regular file (not a directory).
toni     (29 Nov 2010, 14:46)
I came across the following if-statement in another tutorial:

if [[ -e $file ]]
then ...

What's the meaning of the "-e"? It seems to be equivalent to "-f", or am I mistaken?
zedadex     (18 Nov 2010, 15:27)
you are a beast. this is exactly what i needed. Thanks, and i agree with Robert, this needs to go viral :)
Bob Rankin     (15 Nov 2010, 07:56)
Hmmm... a tutorial of linux shell programming commands... hmmm... I wonder where someone could get a thing like that?
anit     (15 Nov 2010, 01:08)
please give me a tutorial of linux shell programming commands
ReaPr1965     (09 Nov 2010, 17:13)
I,m New to your site and it's outstanding. I'm learning more by the minute. I do have on my laptop XP Pro and Xandro Presto(which I'm Learning to use). I was just wondering will this site still be in operation after Dec. 21,2012???
Steve Foster     (08 Nov 2010, 11:29)
Very useful, tried loads of other help pages but found them frustrating. Thankyou
norabh chauhan     (08 Nov 2010, 11:19)
this site is very important for beginers,thankyou very much, i love linux very much.....................................
beauty     (15 Oct 2010, 00:05)
It was very useful
Anuradha.T.S     (06 Sep 2010, 02:54)
This site is good and can easily understandable,how to create keyboard shortcuts?
Robert     (01 Sep 2010, 22:20)
SWEET!!..This site needs to go viral ;)
Rohit mahadik     (24 Aug 2010, 01:03)
This is very easy language for understanding!!!
Linux is my Heart@@@@@@@@
Thank u so much again#########
Satish     (15 Aug 2010, 12:02)
This site contain everything user need to plan.
wajahat     (14 Jul 2010, 06:36)
how to create keyboard shortcut in LINUX?
Arvind Gautam     (26 Jun 2010, 19:11)
tahnk u sir ggggggggggggg(Mr.BOB)
its very intersting site for learning Linux........
its very easy language
xxx     (24 Jun 2010, 04:14)
It was very useful! thanks a lot! :)
to aviveki     (27 May 2010, 11:27)
@vivek.. Are you thinking of writing an advanced and comprehensive linux networking tutorial. if If so please post a link here so we can all see.Make sure you dont miss anything or I might leave a nasty thankless comment, like yourself

vivek (25 Feb 2010, 03:01)
pretty good for beginners
need much more regarding linux networking
Joe     (04 Apr 2010, 11:50)
great site !! thanks a lot !!!
Bala Kishore     (11 Mar 2010, 21:35)
I have forgot my zip password, how to extract it using terminal
Bob Rankin     (04 Mar 2010, 12:01)
Teach you EVERYTHING? I'm gonna need more than gratefulness to fill that order. How about we make a deal? You READ and STUDY everything I've written on this site, and I won't send you a bill. Sound good? :-)
Cynthia Dipuo Nshimane     (04 Mar 2010, 08:39)
i am studying software engineering in NIIT i want to learn more about everything in linux and java pliz help diz iz mae email addres.teach me everything and i will be grateful.thanks 4 welcoming me
vivek     (25 Feb 2010, 03:01)
pretty good for beginners
need much more regarding linux networking
mary     (16 Feb 2010, 22:47)

am a beginner in LINUX and the tutorial has been so helpful. thank u BOB
sowmya     (07 Feb 2010, 22:57)
this site was very useful for the beginners
easy to understand
thank u very much
shahidhusain     (26 Jan 2010, 06:02)
Thanks: very easy & understanding language you have put in, as it is of more useful to a very newbie or the 1 who wants get true understanding in details to LINUX, Thanks Tutor Respectable BOB
sailesh bajracharya     (21 Jan 2010, 07:37)
this is a great place for learning linux. thanks Mr.BOB

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.
Notify me about new comments on this page
Hide my email

Ask Bob Rankin - Free Tech Support

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

Popular Pages