OfficeTrio: The Integrated ECommerce Solution OfficeTrio: The Integrated ECommerce Solution OfficeTrio: Features OfficeTrio: User Manual OfficeTrio: Testimonials OfficeTrio: The Demo is Offline! OfficeTrio: Order O3 Now

More Unix

Every person or user accessing a Unix server is running a completely separate user session.

A shell program provides the user interface you see - i.e. the prompt. The shell basically enables you to run programs on demand. Common shell programs are the 'Bourne', 'C', or 'BASH' shells.

There are a number of settings that can be individually set for each user - and these settings are used by the shell to manage your interaction together. These settings are held in environment variables.

For example, there will be environment variables defining what type of terminal you're using, how big it is, what your username is and where your home directory is.

All environment variables start with the dollar sign '$'. $HOME is your home directory. if you type
echo 'Home dir=' $HOME
you'll get a response like:

 Home dir=/user/yourname

Try the following commands:

  • env

    Displays a list of all your environment variables.

  • cat .bashhistory

    Show the history of what you've typed. Note, you can access this list through 'hot keys' to save typing. (Usually the up and down arrows on the keyboard)

  • cat .bashrc

    Shows your login script - this script is run every time you open a terminal window.

All the Unix commands are files too. They live in a directory like '/bin' or '/usr/bin' on the machine. The reason you can access all the Unix commands from any directory is simply because a search path is set up...

A search path is an environment variable that tells the Unix shell where to look for programs. When you type a command, the shell looks in all the directories listed in the $PATH environment variable. You can type echo $PATH to see how the path is set up for your session.

You can (of course) alter the contents of environment variable. (That why they're called 'variables'.) You could, for example, extend the search path to include an extra directory.

INFO:
You can create your own unix commands either by creating aliases (i.e. alias ll='ls -al';) which you'd place in a startup file like .bashrc ...

...or by writing small executable files and placing them in the search path:
  • Use the cat command to open a new file.
  • Type the unix commands which have the desired effect.
  • Close the file.
  • Make it executable using the chmod command
  • Then you can run it like any other command.


Unix comes with a number of extremely powerful tools (Note, there are man pages for them all):

  • All Unixes come with a 'C' compiler. C is a powerful general-purpose programming language. Most of Unix itself is written in C.

  • Perl is a programming language that's widely used on the Internet. Web servers

  • 'awk', and 'sed' are powerful file manipulation programs. If you needed to format a thousand pages of text, or automatically strip the email address from every email you're sent and store it, you could use one of these programs.

  • 'grep' is a program that performs pattern matching. You'd use grep to find a particular bit of text in a file.

  • Much of the above 3 programs power comes from their ability to handle regular expressions. This is a language that can describe generalised patterns of characters. For an explanation of what they are, and how they work, see the resources section for links.

  • Unix has 2 built in editors, 'ed' and 'vi'. ed is a 'line editor', and its operation is so obscure by today's standards, hardly anyone uses it.

    vi, on the other hand, while still very strange if you're used to windows, is very powerful, quite easy to use - once you get the hang of it, and has a huge user base. It's also the only reasonable editor you'll get on a character-based system.



You never really need to, but it's often desirable to edit files on your webserver directly. Files like system settings, .qmail files, Perl scripts etc. are sometimes better edited on site...

Consider debugging a Perl script... The debugging cycle is: edit, save then run. If you have to upload as well, the cycle becomes: edit, save, upload, change file permissions (chmod), run. These extra two steps slow the process down a lot!

INFO: All your web pages should be edited on your PC, then uploaded to your webserver. This way you always have the most recent versions in one place - on your PC.


There are 3 ways to edit files that are on your webserver:

  1. Edit on PC and Upload.
  2. Edit on server using vi.
  3. Edit on server using a remote editor - there's only 1 I know of: Direct FTP from CoffeeCup.com.

vi is an editor that inspires love and hate amongst its users. I recommend you read this article: The VI Story and try it on your own webserver.

If after this time, you don't want to use it, then try one of the alternatives.

Resources

Books (from Amazon.com)
UNIX in a Nutshell
by Arnold Robbins
Unix in a Nutshell is the standard desktop reference, without question. With clean layout and superior command tables available at a glance, O'Reilly's third edition of Nutshell is an essential to own.
Linux in a Nutshell
by Ellen Siever, Jessica P. Hekman, Stephen Spainhour, Stephen Figgins
Linux In A Nutshell lists around 200 basic utilities beginners should find immediately useful in the first few pages! No one has a brain large enough to keep all these commands and utilities instantly available, hence the need for quick references.
UNIX Shell Programming
by Stephen G. Kochan, Patrick H. Wood
A new, thoroughly revised and updated edition of a best-selling computing classic. Shows Unix users how to automate tasks and develop powerful shell scripts. Offers complete instructions for the standard Bourne shell, plus the Bash and Korn shells.
Mastering Regular Expressions
by Jeffrey E. F. Freidl
Regular expressions confer an incredible amount of power when handling textual data with scripting languages such as Perl, Python and awk and more. The programmer that can master regular expressions can do just about anything!
Sed and Awk
by Dale Dougherty, Arnold Robbins
sed & awk describes the two powerful text processing programs that are mainstays of the UNIX programmer's toolbox.
Learning the Vi Editor
by Linda Lamb, Arnold Robbins
This newly updated edition is a complete guide to text editing with vi. Lots of new topics. Quickly learn the basics of editing, cursor movement, and global search and replacement.

Unix Resources
Unix is a Four Letter Word...and Vi is a Two Letter Abbreviation
Excellent documentation from Christopher C. Taylor
The Unix Reference Desk
Good articles for beginners and much more.
Unix Guru Universe
Lots of useful links.
Unix man Pages
Definitions of all the Unix commands - online.
The Creation of the Unix Operating System
A lengthy, but informative article on the history of Unix.

Linux Resources
The Linux Documentation Project
Plenty of online documentation...
LinuxWorld
An online magazine dedicated to Linux.
Linux Journal
The magazine website.
Linux Gazette
Online magazine (published by Linux Journal)
Slackware
One of the oldest linux distributions.
GNU
A freely distributable unix project.
FreeBSD
Another Popular Linux Distribution.
Debian
Another Linux.
Mandrake
A free / commercial linux. Reputedly has excellent installation tools.
SUSE
Another free / commercial unix.

Regular Expression Resources
Regular Expression Resources on the Web
A long list of everything R.E. related.
Regular Expressions
Article by LinuxFocus.org

VI Resources
See also the first two links in the unix section!
The VI Story
This is quite a clear and succinct guide. You'll need to practise while you read though.
Table of vi commands
A table of all the commands available from the keyboard in vi. Very useful.


Tutorials

Contents

Free EBooks
Free Scripts

Introduction
What Can I Do With A Website?
Internet History
Introduction
Preparation
Website Builders

Webmaster's Tools
Tools Intro
HTML Editor
PHP IDEs
Graphics Resources
Telnet and FTP
Miscellaneous Tools

Web Design
Web Design
Domains
Keywords/Description
Logo/Graphics

Creating Web Pages
Setup
HTML
HTML Tips And Tricks
Home Page
Navigation
Other Pages

Webhosting and Unix
Webhosting
Telnet/Unix
More Unix
Website Upload
Analyse And Verify

Programming
Programming 1
Programming 2

PHP
PHP
PHP Scripts
PHP Hit Counter Script
PHP Download Tracking Script
PHP Navigation Script
PHP Affiliates Tracking Script
PHP Users Management
PHP Site Search Script

Perl
Perl
Perl Hit Counter Script
Perl Order Processing Script

Databases
Databases
SQL
Database Setup

ECommerce
ECommerce

Automation
Automating Order Processing
PayPal Automation
Email Automation
Installing Scripts

Security
Basic Security

Affiliates
Affiliates Programs

Managing Your Website
Website Management
Promotion/Advertising
Search Engines
Search Engine Optimisation



Powered By OfficeTrio