The ShellMe page: Know the shell you work with.

Paragraphs in this page are:

Theory
Variety
Practice



Theory


Q: Ok. I now know the console and permissions. But where do I really type my wise commands?

A: The commands are in reality entered in your favorite shell.

The shell is the command line environment that you use to interact with the system.
Sometines, by saying "shell", people define their Graphics User Interface, which is wrong.
The shell is 2 operations in one:

1) The line editor, where you type, erase, backspace, jump words, autocomplate etc. , but in one line at a time, and finally, when the command is decided, you <enter> it to the second step.

2) The command line interpreter (cli), where the human level command is being interpreted, meaning processed step by step.

Refer to the CodeMe page for the Interpreter- Human level definition.

In addition, the shell can process scripts.

Falling back to TipMe  page:
Q: What is a script then?

A: A script is a high (human) level batch of commands that can use specialized utilities (like the ones described in the Helpme page) to do a complicated work.



Variety


First let's meet the shell we are working with:

foo@bar:~$ echo $SHELL
/bin/bash
foo@bar:~$

$SHELL is a variable, like $PATH.
echo returns the string or variable
to the standard output.

The shell I am using in my Linux box is GNU/GPL bash located in /bin.

The Bourne Again Shell was developped by the Free Software Foundation, Inc. based on Bourne Shell sh as an extension to the old one's capabilities.

The FSF Inc is created by the same person that created the GNU/GPL software licence,
Richard Stallman.

Keep in mind that sh has all that is needed to run common scripts.

Try man bash and man sh. Don't panic if there is not a manual page for sh.

Q: What other options do I have?
A: try ls -l /bin/*sh and see all the alternatives. Some names can be symbolic links to others.

For example, Berkeley Unix C Shell csh does not exist in my system. csh is a symbolic link to tcsh, an enhanced version based on csh.

When we think of a Shell as an environment for interaction, at the same time we have to think of it as a Programming Language also.

A script using special capabilities of the csh cannot run in bash.

Read the man pages of all the shells.
Don't be afraid to use a shell because it's not "popular".




Practice


We will learn basic capabilities of bash.

This is because your new and still unmodified by you GNU/Linux might use this shell by default.

Q: Why the majority?
A: Because of the characteristics combination of this shell:GNU, Powerful, Practical.

Simplified capabilities of bash
Can remember previous commands
Can Auto-complete dirs-files & commands-in-the-path
Can expand names based on pattern (*.jpeg [1-3].txt)
Can alternate the prompt
Can execute commands on logon, second-shell and logout
Can understand a powerful syntax and regular expressions
Can pipe - pass parameters - check conditions


Explanation of the above:

Command Memory
Pressing the up-down arrows, the bash line editor circles around older commands.

The previous commands are "memorized" in ~/.bash_history text file.

Prompt
The prompt is very "tweakable". My prompt: foo@bar:/home/shared$ means:
user foo at host bar is currently viewing /home/shared

he prompt can be altered to see for example:

time and/or date
jobs in the terminal
the state of the shell (first or second)
the current directory but not the full path

Auto Completion
bash autocompletes based in letters specified.

directories and files

type cd /ho and press <tab>. Bash will autocomplete the path.
do the same in cd /s and bash will autocomplete /sbin

Q: But in cd /b there wasn't any responce!

This is because there are /boot AND /bin!
Press the <tab> twice and bash will present the alternatives.

commands in the path

now type: xclo <tab> xclock will be autocompleted.
but typing xc will need <tab> twice because there are many executables in the path that begin with xc

Bash will autocomplete only files-in-the-path that have execute permissions for the username (owner group or others) you are currently logged in the console.


Expansion
Bash expands names based on pattern.

When we copy files (cp *) for example, it is not the cp command that will try to find everything in our current dir, it is bash that does the job.

Try echo *

Here is a small pattern list:

* expands everything, including *.*)
*.* expands only name.extension pattern
*.jpg expands all that have the relevant extension
t?c would expand tac tic toc (? is a single letter wildcard)
[1-3,f].txt would expand 1.txt 2.txt 3.txt f.txt



Pipes, Fifos, Parameters, Syntax
see TrainMe Page. Regular Expressions will be added soon.