internet web hosting

Now that you can connect to your VPS v2 Virtual Server, you need to understand what you are seeing. Since the VPS v2 Virtual Server is virtually your own UNIX machine, an understanding of the UNIX file system and UNIX commands is necessary

In UNIX, a “file” is a unit of storage that ranges in size from very small to very large. A list, a report, a book, a program, and a directory are all “files.” Directories are files that contain other files and perhaps other directories.

UNIX root is the top-level directory, indicated by the first forward slash “/”. /home appears as a subdirectory of “/”, and username is a subdirectory of home. If your login name is Bob, then “bob” would appear in the place of username, and the path would look like this: /home/bob. Each "/" after the root directory is just a separator indicating another directory level.

To change to a directory, type cd (change directory) in the command line. You can cd to a directory by typing the absolute path, meaning that the entire path starting from root is typed out, such as /home/bob, or you can specify a relative path.

% cd tmp

The cd command uses a relative path to change to a subdirectory of the current directory. It is easy to master after little practice. The chart below shows what happens when you type cd alone or with various arguments. Try a few of these cd examples and then type pwd (Print Working Directory) to see which directory you are currently in.

Navigating the File System
The following table lists commonly used UNIX commands, for moving around in the file system.

Command

Example

Function

ls

ls

ls -l

ls –al

ls .

ls /usr

list files in the current directory

list files in the current directory in a long listing

list all files including files beginning with a "."

list files in the /usr directory

pwd

pwd

print working directory - check the current directory

cd

cd

change to your home directory

cd /home

change directory to /home

cd bob

change directory to bob

cd ..

change up one directory (.. represents parent dir)

cd ../logs

change up one directory and down to the logs directory

mkdir

mkdir tmp

make directory tmp under the present directory

rmdir

rmdir tmp

remove directory tmp

rm

rm test

remove the file test

rm -f test

remove the file test without prompting

rm -rf tmp

remove the directory tmp and all subdirectories and files in tmp without prompting (be very careful with this)

cp

cp test test.new

copy the file test to test.new

Use these filesystem symbols as navigation shortcuts.

Symbol

Definition

.

Current directory

..

Parent directory

/

When used by itself or at the beginning of a path it represents the UNIX Root directory. When used within a path it is a separator.


Directories and Files
These are the main directories of your system. You will be working mostly in /home, /usr, and /etc.

Directory

Description

/bin

User utilities fundamental to both single-user and multi-user environments.

/dev

Contains device nodes

/etc

/etc/defaults

/etc/mail

/etc/periodic

Contains servers configuration files such as hosts, mail, inetd.conf, master.passwd, resolv.conf

Default system configuration files.

Configuration files for mail transport agents such as sendmail and includes aliases, virtusertable, and access files.

Scripts that run daily, weekly, and monthly, via cron.

/ftp
/ftp/pub/username
/ftp/pub/incoming

Anonymous ftp directory.
FTP-only user directories belong here.

Suggested anonymous up loadable directory

/home
/home/username
/home/username/www/

Contains users’ home directories.
E-mail users belong here.
E-mail and Web users belong here.

/tmp

Temporary files that sometimes are periodically deleted.

/usr

/usr/local

This directory contains the following subdirectories:

Contains directories like apache, man and frontpage. Contains additional server programs

/usr/local/apache

/usr/local/apache/
htdocs

/usr/local/apache/cgi-bin

/usr/local/apache/
conf

/usr/local/apache/
logs

The virtual httpsd server’s root directory that contains the following subdirectories:.

The Web (html) files for the primary domain. (Web files for subhosts belong in /home/username/www/ /subhostdomain.name)

CGI and scripts directory

HTTPSD servers configuration files

HTTPSD servers log files

/var

Dynamic data files such as mail files and log files; also contains cron, tmp, spool

/var/spool/mqueue

Contains mail messages waiting for delivery

/var/log/messages

Contains miscellaneous log

/var/log/maillog

Contains logs of E-mail activity

/www

Symbolic link to /usr/local/apache

/backup

Contains an on disk copy of the account file system from the previous night (read-only)

/compat

Linux compatibility files

/root

Root home directory

/ports

Collection of third party applications (read-only)

/proc

System processes

/sbin

System programs and administration utilities fundamental to both single-user and multi-user environments.

/skel

Default “skeleton” files (core system binaries) for a new, clean server. (read-only)


UNIX Filenames
When naming your own files, it is important that you do not use spaces in the filenames. Use the underscore character “_” in place of spaces.

File Ownership and Permissions
Controlling access to directories and files on your server takes place at the virtual “root” level.

Connect to your VPS v2 Virtual Server, cd to any directory, and type ls –l. A list of directories and files appears.

drwx------       2   root     wheel      512 Dec 23 16:39    heimda
drwxr-xr-x     2   root     wheel     1024 Jan 22 03:07     log
drwxrwxr-x    2  root      wheel      512 Jan 22 03:07     mail
drwxr-xr-x     2   root     wheel       512 Dec 24 03:01    msgs
drwxr-xr-x     2   root     wheel       512 Dec 23 16:39    preserve
drwxr-xr-x     5   root     wheel       512 Jan 21 18:53     run
drwxr-xr-x     7   root     wheel       512 Dec 23 16:39    spool
drwxr-x---      3   root     wheel       512 Dec 23 16:39   state
drwxrwxrwx  3   root     wheel      512 Jan  3 22:59 tmp
drwxr-xr-x     2   root     wheel       512 Dec 23 16:39    yp

Reading from the left, the line gives the following information in the table.

Column

Definition

drwx-xr-x

10-character access mode that defines file type and access permissions. d = directory. – = file

wxr = permissions for the owner

-xr = permissions for the group

-x = permissions for all others (world)

Number of links

A file or directory can be a link to other files.

Owner name    (i.e., root)

Login name of the owner.

Group name     (i.e., wheel)

Group ID to which the file belongs.

Size

In bytes.

Date and time

Time stamp of last modification.

Name

The name of the file or directory.


The File Mode Explained
The file mode (access mode) is a 10-character label that identifies the type of file and the permissions for the owner, group, and others (world). The first character identifies the type of file. The following characters are often found as the first characters.

Character

Description

-

normal file

dr

directory

l

link to another file or directory (link is shown in the last column)

The next nine characters of the file mode block are separated in three groups of three characters: permissions for the owner, group, and world. The following table summarizes these three blocks of the file mode.

Character

Permission

Numerical Value

-

not assigned

 

r

read

4

w

write

2

x

execute

1


Changing the File Mode
To change the file mode:
  1. Connect to your VPS v2 Virtual Server using SSH and type
    %cd /home.
  2. Create a directory called test, and a new file called test1.
    %mkdir test
    %vi test1 (Use your preferred text editor.)
    A numeric value is used when you change the mode using chmod (change mode). A sample file called test1 with a file mode of -rwxr-x--- has a value of 750. If you change the mode to 755:
    % chmod 755 test1
    the number 755 changes the test1 file mode to read, write, execute for the owner; read and execute for the group and other. The file mode is now:
    -rwxr-xr-x
    A sample follows
    %cd /home/bob/test# chmod 755 test1
    %ls -l

    total 1
    -rwxr-xr-x  1 root  bob  68 Jan 15 22:44 test1

    See the chmod man page for more information.

[Previous] [Section Table of Contents] [Handbook Main Table of Contents] [Next]

Hosting  ::  Web Design  :: Server Administration  ::  Tech Support  ::  Contacts
Data Centers  ::  Tier I Global IP Network  ::  SLA/Contracts  ::  Search  ::  Account Login