★ wanayoo — archive 1999 http://bignosebird.com/unix.shtmlNouvelle recherche | Portail wanayoo
BigNoseBird.Com- Small Logo
The Guide to 
       Big Nose Bird
Site Search Engine

  Visit LiveUniverse.com for the best free tools, hosting and community building services
Programming Tutorials

Several years back a relative asked me what I do for a living. I told him I work with UNIX. He thought I said, "Eunuchs" and asked if I found that rather disturbing...
- Bruce

Nothing seems to stir dread in Windows and DOS users more than being faced with the prospect of having to use UNIX for the first time. Yes its true that UNIX is a very sophisticated operating system with a million commands, but you can most likely do everything you need as a webmaster with just a few of them. Think about what commands you use most of the time with DOS!

What you need to find out are the locations of home directories and web directories. Your host or service provider can fix you up with this information.

This page is a quick introduction to the several commands and things you need to know about UNIX. Believe me, you can learn about UNIX on the 'Net- in fact most of the Internet runs on UNIX servers. Print out this page, put it on your lap- and voila you too are a UNIX Guru!


Fear not the FUD.
I cannot stress this strongly enough. In case you are not familiar with the acronym "FUD", it stands for Fear, Uncertainty and Doubt. One of the more popular operating system and software vendors loves to publish documents explaining why Unix is so hard to learn, and therefore pretty much useless, except to a small group of geeks. They also put forth the argument that unix is based on 30 year old technology, and that makes it bad as well.

Well, if it makes you feel any better, the majority of the sites on the Internet- especially the large ones, run on unix servers. As far as 30 year old technology goes, don't you think us geeks would be the first people to adopt a "new" technology if it were in fact better, especially if it were "easier" to learn? Want to know a secret? The GUI interface existed on unix a long, long time ago...

So forget the FUD and read on...


Important Differences Between UNIX and DOS
Despite common belief, switching your mindset from DOS to UNIX is not very hard. There are several things you should be aware of that will instantly make your life easier.
  • The end of file character is control-D, not control-Z

  • UNIX ends its lines with only a control-J. Remember to FTP your HTML and text files from DOS to UNIX using ASCII mode. UNIX will ignore the control-m's, but they look ugly.

  • UNIX is case sensitive. It is important to remember that IMAGE.JPG and image.jpg are not the same. The normal convention in UNIX is to use lower case letters, but this is not law.

  • In UNIX, you do not use the backslash, but rather the forward slash when referencing directories. The backslash tells UNIX to take the character after it literally. So cd \dir\dir would be cd dirdir.

  • cd with nothing after it takes you to your home directory, it does not print out your present working directory. That would be the pwd command!

  • UNIX does not have an unerase command. Once you delete a file, it is gone forever.

  • Command options in UNIX generally use the hyphen-, not the forward slash.


Navigation: Same commands, but...
Getting around in UNIX is very similar to getting around in DOS. The only source of confusion is that when Bill Gates decided to have PC-DOS support a tree directory structure, he had his car running in the garage that night. In other words- Whenever you have an urge to hit the backslash, hit the forward slash key instead.
  • pwd tells you what directory you are in.

  • cd alone returns you to your $HOME directory.

  • cd .. takes you up one level.

  • cd dirname moves you to the directory named "dirname".


File Handling
Unix and DOS have the same utilities for dealing with files and directories- only some of the names have been changed...
  • cp Works just like copy in DOS.
    Syntax: cp file1 file2

  • rm Replaces the DOS erase command.
    Syntax: rm file

  • mv Does what rename does in DOS.
    Syntax: mv file1 file2

  • mkdir is the same as in DOS.
    Syntax: mkdir dirname

  • rmdir is the same as in DOS.
    Syntax: rmdir dirname

  • ls is the UNIX version of dir.
    Syntax: ls -l shows long (detailed) listing.
    Syntax: ls -last shows long listing- newest first.
    Syntax: ls -c is like dir /W


File Permissions
DOS has a limited utility for setting permissions on files: ATTRIB. In UNIX (being that it is a true multi-user, multitasking operating system), has a more sophisticated method of setting permissions: the chmod command. To understand it, let's look at a small directory listing as made with the ls -l command.
  drwxrwxr-x    1 bnb      xbignose    1018 Apr 30 23:45 mydir
  -rw-rw-r--    1 bnb      xbignose   18755 Apr 30 23:37 mypic.gif
  -rwxrwxr-x    1 bnb      xbignose   18525 May  4 02:48 mycommand
  
The permissions are indicated by a series of rwx's on the left side of the listing. The first position indicates the type of file. For our purposes it is always a "-" for a file, or a "d" for a directory.

The remaining nine characters indicate the permissions given to the owner, group, and others. Since owner and other both start with the letter "O", think of owner as the user. Here is the nitty gritty...

  • X means execute permission- except for directories where it means search permission.

  • The first three permission characters are for the user (owner), the middle three are for the group, and the last three are for all other people on the system.

  • chmod 775 dirname is the normal permission for a directory. drwxrwxr-x

  • chmod 664 filename is the normal permission for a non-executable file, i.e., an HTML or image file.

  • chmod 775 filename is the normal permission for an executable file, i.e., a shell script. Usually these are not in your web directory.
Many of you without telnet access that use an FTP program such as Cute-FTP or WS-FTP, will have to use the unix command function of your program. Check the help file with your FTP program for the exact instructions.


Text Editors
The main editors available on most UNIX systems in order of appearance are:
  • vi. The most popular UNIX editor. Can be found on every system. Takes some getting used to, but is very addictive! recommended. Here is an excellent Quick tutorial by Tony Thomas.

  • emacs. Very powerful. Very complicated.

  • pico. On screen reminders of comand keys.


For more documentation...
Every UNIX system has on-line documentation. It is identical to the paper manual pages. In order to use this feature, you must be able to access your site and login using a TELNET program.

Getting help is as simple as entering the command:

          man command
  
The man command will format and display the manual pages for the command you request. Not all of the instructions you will find will make much sense as ALL options for a command are presented, but most have simple examples.


Congratulations!
Guess what? You have graduated! This pretty much covers the material of a two day Introduction to UNIX course- retail value is about $595.




Find or Give Help on the BBS
Home Top E-mail
If it looks great, it's by Christine
Some Fine Print
© 1997,1998,1999, 2000 BigNoseBird.Com, Inc. All rights reserved. All other trademarks are the sole property of their respective owners. The products that we recommend are only ones that we use. We have no relationship with any of the authors or their companies. We cannot assume responsibility for their ultimate performance or lack of same. We also cannot assume responsibility for either any programs provided here, or for any advice that is given since we have no control over what happens after our code or words leave this site. Always use prudent judgment in implementing any program- and always make a backup first! For further information, please read our Privacy Statement. We can be contacted at webmaster@bignosebird.com.

Member of the reallybig.com Web builder network
Back to Network
Check it out. Over 60,000 Animations!
60,000 animations are currently in the Animation Factory Premium Gold site. Become a member today and start downloading from our library of images.
Content Areas
reallybig.com
Web site

The largest directory of Web building resources on the internet
BigNoseBird
FREE CGI scripts, tutorials, essential HTML tricks and much more
Font Pool
More than 1000 truetype FONTS!
Dynamic Drive
Add power to your site with free original, ultra cool DHTML scripts.
GraphX Kingdom
Download thousands of great ICONS & CLIPART images!
Features
Instant
Web Graphics

Quick and easy way to give your pages a nice, uniform look.
Cartoon Fonts
These are REALLY NICE and look great anywhere.
Great Text Effects
Easy pop-ups & rollovers, all cut-n-paste, all very cool.
The 216-Color Webmaster's Palette
See it for the first time!
Internet Traffic
Report

Does your connection sometimes seem a little slow?
Click here
to find out what conditions are RIGHT NOW throughout the internet
Sponsor Info
Click here if you would like to advertise on the reallybig.com network.
BigNoseBird Newsletter
Subscribe
Un-Subscribe


Sign up today to receive our low volume newsletter. Tips, tricks, news, and whatever else crosses our minds.
Back Issues
Privacy Statement