internet web hosting
UNIX is an operating system in that it enables you to interact with the operating system in many methods. These methods usually involve something called a shell. Some shells that come with your Virtual Server include:
  • bash - GNU Bourne-Again shell
  • csh - A shell (command interpreter) with C-like syntax
  • ksh - Public domain Korn shell
  • scotty - A TCL shell including tnm extensions
  • sh - Command interpreter (shell)
  • tclsh - Simple shell containing Tcl interpreter
  • tcsh - C shell with file name completion and command line editing
  • zsh - The Z shell

Note: C shell (csh) is the default shell for your Virtual Server.

Information on each of these shells can be obtained from a man page query:

% man csh

You can change a Virtual Server's default login shell by using the chsh command. When you run this command, it starts up whatever you have set as your default editor, and it allows you to change any of the following information:

  • User database information for Virtual Servers
  • Shell: /bin/csh
  • Full Name: Enetrics Communications
  • Location:
  • Office Phone:
  • Home Phone:
Changing Your Shell from /bin/csh to /bin/tcsh
  1. Change the path for your shell to Shell: /bin/tcsh.
  2. Save the file. The shell takes effect next time you login to the Virtual Server.
C-Shell

Since C shell is the standard with the Virtual Server, you must understand how it works with your Virtual Server. Each shell language is also an interpreter. Shells can be used like Perl or other interpreted languages to write scripts, or automate systems administration tasks. For example, a simple csh script might look like the following:

#!/bin/csh
echo "Content-type: text/plain"
echo ""
printenv

Note: If this script were called from the Web, the user's "environment" would be output to the browser.

Some of C shells features include the ability to:

  • Pipe output of one program into the input of another program
  • Use the asterisk ("*") for wildcard filename abbreviations
  • Use shell variables (such as $HOME) for customizing the environment
  • Access previous commands (command history)
  • Create aliases (such as the www alias in the $HOME directory) in a shell program

The C shell configuration files are found in the users $HOME directory:

  • .cshrc - Executes every time a new shell is spawned (i.e., every time you make a Telnet connection to your server).
  • .history - Saves a list of commands executed from the command-line.
  • .login - After the .cshrc file is executed, .login is run.
  • .logout - Executed by the shell when the user logs out.

Other important configuration files can be found in your ~/etc/ directory:

  • Password file
  • Sendmail file
  • Aliases file.
Obtaining More C-Shell Information
Connect to your server via Telnet. At the command prompt type:

% man csh

Note: You can also get information about other shells, such as the ksh, using this technique.

Obtaining Information about C-Shell Commands

Connect to your server via Telnet. At the command prompt type:

% man ls

Note: Replace ls with any command that you need more information about.

C-Shell (CSH) Commands and Descriptions

Command

Description

#A comment

A script that has the symbol # as the first character is considered a CSH script

#!shell

Used to specify a different shell for the script. Replace the name shell with the path to the shell (including Perl) that you want to use for the script

Null

Returns an exit status of Zero

*

Wildcard symbol, matches "any" value

@

Assign a value of an arithmetic expression to the variable alias Allows you to assign an alias for a unix command.

If you use DOS , you may want to make aliases for DOS commands that you may confuse with Unix commands. Store the commands .cshrc file.

If you overwrite the standard unix convention, call the original by appending the forward slash to the front of the command, by entering:

% /ls

rather than:

% ls

UNIX Commands and Descriptions

Command

Description

bg

Put the current job in the background

break

Resume execution (break out of while or foreach loop)

breaksw

Break out of switch statement

case

Identify a pattern in a switch statement

cd

Change Directory. Default changes user to home directory

chdir

Same as cd

continue

Resume execution of while or for each loop

default

Label the default case in a switch statement

dirs

Print the directory stack

echo

Write supplied string to stdout

end

Ends a foreach or switch statement

endif

Ends an if statement

eval

Eval is usually passed an argument. It resolves the variable then runs the resulting command

exec

Executes a command

exit

Exit a shell script

fg

Bring job to the foreground (see bg)

foreach/end

Runs a foreach loop

glob

Similar to echo, except no \ escapes are recognized. Often used in scripts to force a value to remain the same for the rest of the script

goto

Skips to a line beginning with whatever string you put after the goto command

hashstat

Display statistics that show the success level of locating commands via the path variable

history

Display a list of events

if

Begin a conditional statement

Jobs-1

List all running or stopped jobs

kill options id

Terminate the process ID(s) or job ID(s) specified

kill (proc id)

Kill the process id number given, usually found through a ps -auxw command.


UNIX Signals and Functions

Name

No.

Function

HUP

1

Hang up

INT

2

Interrupt

QUIT

3

Quit

ABRT

6

Abort

KILL

9

Non-catchable, non-ignorable kill, the big bomb

ALRM

14

Alarm Clock

TERM

15

Software termination signal

limit

 

Display limits set on a process or all limits if no arguments are given

login

 

Replace users login shell with /bin/login

logout

 

Terminate login shell

nice

 

Change execution priority for specified command

nohup

 

Prevents "command" from terminating after terminal line is closed

Notify

 

Reports immediately when a background job completes

onintr

 

"On Interrupt" Handles interrupts in scripts

popd

 

Pop a value from the stack

pushd

 

Push a value onto the stack

rehash

 

Recompute the hash table for the PATH variable (when you create a new command, run rehash so the has table finds the command

Repeat

 

Execute command for the specified number of times

Set

 

Set a variable to a value

Setenv

 

Assign a value to an environmental variable name

shift

 

Shifts wordlist variables. For example, name [2] becomes name [1]. Use this to get values from a wordlist in a script.

source

 

Read and execute commands in a CSH script. For example, if you add or modify your .cshrc file, you can do a source .cshrc.

stop

 

Stop a background job from running.

suspend

 

Suspend the current foreground job (<ctrl>-z)

switch

 

Set up and argument where what is executed depends on the value of the variable you are matching. Used in conjunction with the case variable.

time

 

Run a command to show how much time it uses. Use this in a shell script to tell how long that it took to run.

umask

 

Display or set the file creation mask.

unalias

 

Remove an alias from the alias list

unhash

 

Remove the internal hash table (and instead spends the path in the PATH variable)

unlimit

 

Remove allocation limits on resource.

unset

 

Remove one or more variables (as set by the set command)

unsetenv

 

Remove an environmental variable

wait

 

Do not execute until all background jobs are completed.

while/end

 

While loop.


For More Information
For additional information about the topics discussed in this chapter, see the following pages on the Enetrics Communications web site.

Installing Perl Modules
Visit Technical Support Pages For Perl Mod for More Details

Hosting  ::  Web Design  :: Server Administration  ::  Tech Support  ::  Contacts
Data Centers  ::  Tier I Global IP Network  ::  SLA/Contracts  ::  Search  ::  Account Login