More Website Templates @ TemplateMonster.com -
July 28, 2014!
Unix Shell Tutorial - BASIC
A Unix shell is a command-line interpreter that provides a text user interface
for Unix-like operating systems. The shell is both an interactive command
language and a scripting language. Users typically interact with Unix systems
using a terminal emulator to type commands to the system for various functions.
There are several shell systems available on Rexx, but for this tutorial we
will be using the standard BSD shell, also called the Berkely Shell.
This tutorial will cover some basic operations to get you started, but is not
intended to be a complete guide. There are several books and websites that
go into more depth, or you may wish to take a class at your local community
Do not be affraid to experiment with the commands. Anything that can damage
the server is restricted to access by our staff and system operator. You
also can not view or access anything belonging to another user.
For the purpose of this tutorial, "server" refers to the name of the
server your shell account is on, and "user" refers to your username.
To use Unix shell on Rexx, You will need to install a text terminal program
or activate the built-in telnet terminal in windows.
To start the windows Telnet, type the following command in a DOS window (cmd.exe) or under start/RUN:
telnet cutter.rexx.com 491
(Replace cutter.rexx.com with your Rexx shell server shown below)
In many installations of Windows, the Telnet terminal is disabled. If the above command
does not connect you to your Rexx Unix Shell server... you will need to activate
or install the Telnet terminal program. This can be found in
Control Panel > Programs > Programs and Features > Turn windows features on or off > Place a check mark next to Telnet Client and click OK
PuTTY (Public Teletype) **RECOMENDED**
We recomend using PuTTY as it supports secure encrypted communication with
our servers, and is a FREE program. You can download PuTTY from https://www.putty.org/
When you run PuTTY you will be shown a configure screen where you will need to
enter the connection settings for your shell account server. An example is shown
at the right.
First enter the host/server name. Typically we assign the shell server
that is nearest to you. (There are no user shell accounts on our Frankfurt
or Sydney servers at this time. International users should use cutter.rexx.com)
|Los Angeles CA||cutter.rexx.com|
Rexx does not use the standard "well known" port numbers for security.
If you will use "Secure Shell" (SSH) then use port 55, for Telnet use port 491.
Select either SSH (Secure Shell) or OTHER/TELNET
Under saved sessions is a place that you can name the config. Enter "Rexx Unix Shell"
or any other name so you will know what this config will connect to, then click
the SAVE button.
Double click the name in the list to connect to the Rexx Server.
You will be asked to "login:" where you should type your Rexx username.
You should type just the plain username without a domain name.
After entering your username, you will be asked for your password.
Note that the password does not echo to the screen.
If your login is successful, the server will display your last login date
and location, the version of Unix running on the server, and the date when the
server was first brought online. There may be a "message of the day" and
finally the security system (named "Hassan") will run a basic security check.
Finally, the system will present you with a command prompt where you can type
Another feature of PuTTY is that you can scroll back the text using your
mouse-wheel if the text runs off the top of the screen.
General Info about Commands
Commands in Unix are generally typed in lowercase.
If the command requires parameters you must type a SPACE between each
of the parameters.
Rexx has an online set of Unix manual pages for most commands.
The manual pages explain the command, and any extra parameters or options.
|man [command]||Manual||Display Unix Manual for page [command]|
|apropos [function]||Find command(s)||Search the manual for a command that does a function|
For example, typing "man man" will display the manual page for the 'man' command.
While in the manual page (or any document) press [SPACE] or [F] to scroll forward.
Press [B] to scroll back
Press Forward_Slash to search the document. Example '/text' will search the document for "text"
Press [Q] to quit from the document and return you to a command prompt.
In the Beginning ...
The simplest commands you need to know are
|exit||Exit the shell||Logout from the current shell session|
|clear||Clear Screen||Erase the screen and give a new command prompt|
|date||Show Server Date/Time||Displays the Server Clock (Set to UTC/GMT/Zulu)|
|du||Disk Usage||Display the amount of disk storage used for the current directory, lists sub-directories. The disk space is reported in kilo-byte (1024 bytes) blocks. The last number is the total of all files and directories.|
|passwd||Password||Change your Rexx login password|
Like with most computer systems, Unix uses multiple directories (or folders)
to store files.
There are many system and public directories on Unix systems, some of which
you can access, and some you can not.
Each user on Rexx also has a seperate and private directory
(normally called the "home directory") which is located at /home/server/user
The basic commands for directories are:
|pwd||Print Working Directory||Print out the location of the directory you are currently in.|
|cd [directory]||Change Directory||Change your location to [directory]|
|mkdir [directory]||Make Directory||Create a new directory|
|rmdir [directory]||Remove Directory||Remove an existing directory. Note that the directory being removed must be empty.|
Directory names that start with a FORWARD-SLASH indicate that the path starts
at the top or root level of the disk drive. [example: cd /home/server/user]
Directory names that start with a single dot OR no special characters are
anchored in the current directory.
Example: Assuming you are currently in /home/server/user then both 'cd public_html' and 'cd ./public_html' would
take you to /home/server/user/public_html
Directory names that start with a tilde [~] use your home directory as their base.
Example: ~/public_html is the same as /home/server/user/public_html
A file is a computer resource for storing data on a computer storage device.
Just as words can be written to paper, so can data be written to a computer
file. Different types of computer files are designed for different purposes.
A file may be designed to store an Image, a written text, a video,
a computer program, or any wide variety of other kinds of data.
Certain files can store multiple data types at once.
|ls [directory]||List Short||Short List the files in a directory. Default is the current directory.|
|ll [directory]||List Long||List the files in a directory, in long form. Default is the current directory.|
The long listing of files in the directory has the following form:
- file mode
1st Character indicates type of file:
- indicates a regular file
d indicates a directory
l indicates a symbolic link
Characters 2,3 and 4 are the permissions for the owner of the file:
r for read permission, if - then file is not readable
w for write permission, if - then file is not writable
x for execute permission, if - then not executable. For directories x indicates directory may be entered
Characters 5,6 and 7 are permissions for the group indicated
Uses the same rwx format as the owner permissions
Characters 8,9 and 10 are permissions for EVERYONE
Uses the same rwx format as the owner permissions
- number of links
- owner name
- group name
- number of bytes in the file
- Date and time file last modified, if >6 months then year is shown instead of time.
- the filename
In the example above there are 2 regular files, "cron.tab" and "mail_table" (filenames shown in white)
There are 4 directories, "DATA", "Mail", "projects" and "public_html" (DIRECTORY names shown in cyan)
There is 1 symbolic link, "www" which directs back to the directory "public_html" (shown in pale green)
There are no executible files (scripts) but they will be shown in Red Text.
It is important to note that filenames in Unix **ARE** case sensitive.
"Filename" .. "FileName" .. and "filename" are three seperate files!!
Files can be manipulated in several ways:
|cp [source] [destination]||Copy||Copies file [source] to file [destination] :: Both source and destination filenames are required.|
|mv [source] [destination]||Move||Move file [source] to [destination] :: Both source and destination filenames are required.|
|rm [filename]||Remove||Removes the named file. Removal is permanant!!!
|cat [file][+file][...]||concatenate||Output single or multiple files. The default output is to the interactive user terminal (Your screen.)|
|head [-n lines] [file]||Show first lines of a file||Output the first 10 lines of a file. Number of lines can be specified with the option -n (Example "head -n 20 file" will display the first 20 lines of file, 10 lines is default)|
|tail [-n lines] [file]||Show last lines of a file||Output the last 10 lines of a file. Number of lines can be specified as in head.|
Files 102: Text Editing/Word Processing
There are several editors installed on Rexx that can be used for text editing
and word processing. In all cases, type the name of the editor you wish to
use folowed by the name of the file you wish to edit or create.
|ee [file]||Easy Editor||A what-you-see-is-what-you-get screen editor. The menu and commands are accessed by pressing the ESC key. This is the recomended editor for those new to Unix.|
|joe [file]||The Unix version of WordStar which uses commands like CONTROL-K-Y etc...|
|vi [file]||Advanced Unix editor, visual version||
|ex [file]||Advanced Unix Editor, line version|
Text Unix is where the internet was born.
|lynx [url]||Text Web Browser||Access web pages in text|
|elm||Elementry Mail||A visual interactive e-mail client|
|ssh [host] [port]||Secure Shell||Remote access another system using encrypted connection|
|telnet [host][port]||Telnet||Remote access another system using Teletype Terminal|
|nslookup [host]||Name Server Lookup||Look up the IP address of a host/server|
|host [IP_ADDR]||Host Lookup||Find the name of a host/server from the IP address|
|ping [IP or host]||ping||Test the network connection to another host|
|traceroute [IP or host]||Trace Route||Trace the network route to another host|
|whois [host]||Who is host||Lookup the registration of a domain name or host owner|
|nn [host]||Network News||Early Message Board client|