On-line Tutorials College Credit Continuing Ed. Certifications

Home > On-line Tutorials > UNIX Commands

 

Basic UNIX Commands

At a bare minimum, if you use telnet to install or debug your CGI scripts, you'll need to know how to move around your directories and view the files that are there. Here are the basic commands for that purpose.

In all of these examples, anything in <> should be replaced with the actual file name or directory name -- do not keep the <> symbols when you type the actual command.

Moving around

cd <directory>
The UNIX cd command works just like the DOS command except UNIX uses the forward slash / instead of the backward slash \. You can either type a single directory name or an entire path.
cd public_html
cd /home/ashley/www/images

Viewing files

ls <file or directory>
When used with a directory name, the UNIX ls command lists the directory contents. This is identical the DOS command "dir".
[ashley@server4000 www]$ ls graphs
bar1.gif  bar2.gif  bar3.gif  bar4.gif  bar5.gif  bar6.gif
If no directory name is specified, it lists the contents of the current directory.

If you type a file name instead of a directory, it just tells you if that file exists or not.

[ashley@server4000 www]$ ls graphs/bar1.gif
graphs/bar1.gif
[ashley@server4000 www]$ ls graphs/bar7.gif
ls: graphs/bar7.gif: No such file or directory

If you type ls -l instead of just ls, you will see a long listing, which includes the file/directory permissions and other information.

[ashley@server4000 www]$ ls -l graphs
total 6
-rw-r--r--   1 ashley   enscript       87 May 25  1998 bar1.gif
-rw-r--r--   1 ashley   enscript       97 May 25  1998 bar2.gif
-rw-r--r--   1 ashley   enscript       87 May 25  1998 bar3.gif
-rw-r--r--   1 ashley   enscript      107 May 25  1998 bar4.gif
-rw-r--r--   1 ashley   enscript       87 May 25  1998 bar5.gif
-rw-r--r--   1 ashley   enscript      107 May 25  1998 bar6.gif

Finding yourself

pwd 
The UNIX pwd command tells you what directory you are currently in, giving you the full path from the root directory.
[ashley@server4000 www]$ pwd
/home/ashley/www


Related tutorials

UNIX directory structure
UNIX file permissions
Useful UNIX tasks
Using telnet

 

 

About iTeachU
Programs Offerred
Library
Book Store
Other Resources

Course Access

 

 

 

Home > On-line Tutorials > UNIX Commands

On-line Tutorials College Credit Continuing Ed. Certifications

 

info@iteachu.com

© Copyright 2001-2002 iTeachU All Rights Reserved