(Site Identification)

'Eye' Focus: Web Support Tutorials

The Command Shell

The command shell is a method of directly communicating with a remote system via an instruction, or command line, interface. The method relays instructions and messages between two computers for the purpose of performing tasks and running programs when direct access is not always possible.

(to Top) Table of Contents:

(to Top) Command Shell Fundamentals (Terminal Emulation)

A long time ago, computers were behemoths that occupied entire rooms. In order for more than one person to use the system at one time, "terminals" were connected to the computer via a network. At first these terminals were teletypes (TTY) - just fancy typewriters that did little more than transmit typed characters to and from the main system. The computers could tell these TTY's to print characters, do line feeds (advance to the next line) or carriage returns (return the beginning of the line), and read input from keyboard where a person was typing instructions.

Then CRT (cathode-ray-tube video) terminals were introduced where new methods of handling characters for screen display had to be developed. These early terminals included the DEC family of VT's (video terminals) like the VT-52 and the VT-100. They were pretty fancy for the time, allowing users to perform "full screen editing" by moving a cursor around the screen and deleting characters at will. They also allowed the computers to print special characters like lines and dashes, display bold text, or clear the screen entirely.

Nowadays we don't live in caves and hunt mammoth, but we still use this emulation for remote login sessions like Telnet. The emulation of old terminal types, like TTY or VT-100, are good ways of controlling a computer through another computer because they are character based and are designed to transmit and receive data quickly and efficiently.

Now there are even more command shell protocols for connecting to a remote system. These protocols include (but are not limited to): Telnet (Telephone Networking), rterm (Remote Terminal), SSH (Secure SHell, protocols 1 and 2), and a host of others like Xterm and X-window which often work toward a graphical command shell interface. The most common communication protocol used for this purpose has been Telnet.

(to Top) What is Telnet, Anyway?

The term "TELNET" refers to a specific protocol that provides remote computer access. The term itself refers to Telephone Networking, which was later shortened to Telnet and now relates to any networked connection. Telnet allows for remote access of a computer and to provide the ability to instruct that computer to create, edit, execute, and delete files just as if the user were sitting at that computer.

The use of this term as a verb, as in "Telnet to a host," means to establish a connection across a network from one system to another using the Telent protocol. Usually, you must have an account on the remote system to be able to login to it. However, some systems provide public services (generally referred to as anonymous access accounts) that do not require a personal account, but also limit what can be done in that system.

Recently, many systems have been transitioning away from the Telnet protocol and opting for one of the more 'secure' protocols. These other protocols encrypt the transmitted information to make it more difficult to see what is being done. The encryption helps to keep the systems and data more secure from unapproved access.

(to Top) Connecting to Remote Systems

Sources for command shell software include:

Using a Command Shell with a Mac:

Using a Command Shell with a PC:

(to Top) UNIX Commands

The UNIX operating system and the command line instruction is the historical basis behind the command shell. Most of the instructions and operations that you can do in the UNIX environment will work with most servers. Below is some helpful starter information on using these commands.

UNIX Sites

Basic UNIX Commands

List Contents of Directories - and [options]
Command ACTION
ls lists files in current directory
ls -l provides long listing of current directory
ls -l /usr/jane provides long listing of the directory
ls -a list all entries (including ones starting with a decimal)
ls -i print inode numbers
ls -t sort by modification time
ls -x multi-column list, sorted across each row

What would you like to do?
ACTION Command Examples
append to file (concatenate) cat >> cat >> file
changing permission group chgrp chgrp GroupName FileOrDirectory
combine 2 files cat cat File1 File2 > File3
copy files cp cp MyFile CopyOfMyFile
create a file cat cat > NewFile
edit files ed ed File
list files ls ls /usr/mac
move a file (to directory) mv mv MyFile docs/html/mine
remove (delete) a file rm rm UnWantedFile
rename (move) a file mv mv OldFilename NewFilename
view files cat cat plan.dec
view files page
page plan.dec
change login password passwd passwd
change to another directory cd cd /usr/tmp
create a directory mkdir mkdir /usr/paul/budget
find out where you are pwd pwd
go to your home directory cd cd
remove an empty directory rmdir rmdir junk

Redirection of Output or Input

source > target
redirects the output of a command to a file
source >> target
redirects the output of a command to the end of an existing file
source < target
takes the input of a command from a file, not the terminal

Change Access Modes

chmod [mode] files
modes can be symbolic or numeric

Symbolic Case:
A method where you can set or change specific permissions patterns without modifying others.

chmod [agou][+-=][rwx] files
a for 'group,' 'other,' and 'user' access permissions (all).
g for 'group' access permissions.
o for 'other' access permissions.
u for 'user' access permissions.
+ to add access permissions.
- to remove access permissions.
= to set access permissions.
r for read permission.
w for write permission.
x for execute permission.

Symbolic Case Example:
chmod ug+w files
Adds write permission for 'user' and 'group' to a resource named 'files'.

Numeric Case (shorthand method)
The shorthand method is often convenient and quick but it also does a full reset of the base* permissions on the target. The numeric case uses a number (N) as the octal sum of 04 (read), 02 (write), 01 (execute) for user, group, and other.

[Please Note: If your system uses File Access Control Lists (FACL) then then those extended permissions are not reset. FACL permission changes must be made with the FACL commands.]

chmod NNN files
[N--] relates to [rwx------] for the owner's permission settings.
[-N-] relates to [---rwx---] for the group's permission settings.
[--N] relates to [------rwx] for the other's permission settings.
Numeric Case Example:
chmod 764 files
Changes access permissions of a resource named 'files' to [rwxrw-r--] so that:
'user' has read/write/execute permission (4+2+1=7),
'group' has read/write permission (4+2+0=6), and
'other' has read only permissions (4+0+0=4).

This produces the setting of 764. You should note, if you intend to give the Internet access to read files in a directory, then you must also provide execute access for that directory (but not write access). This means 'other' must have a permission of [------r-x] or [--5]. (Consult the UNIX sites listed above for further details.)

[Updated: Sunday, November 18, 2007]