NetNation Managed Hosting, Server Colocation Services and Shared Web Solutions
Customer Login Webmail Click for Canadian Site
 
Domain Name Registration
  spacermore extensions
 

Unix FAQ



Is index.phpl a different file from INDEX.HTML?
How do I get online help for a UNIX command?
How do I list my files & directories?
How do I change directories?
How do I make directories?
How do I remove directories?
How do I copy files & directories?
How do I move (rename) files?
How do I remove files?
How do I search within files?
How do I change file and directory permissions?
How do I back up files & directories?
How do I compress & uncompress files & directories?

Is index.phpl a different file from INDEX.HTML?
Yes, unlike Windows or DOS, UNIX is case sensitive. This means that index.phpl is different from Index.phpl, INDEX.HTML and all its various case combinations.

This can create a problem when transferring your site from your hard drive (Windows or DOS) to one of our UNIX servers. It can often result in pages having broken links and missing images.

If you encounter this problem, check to make sure that the hyperlinks contained within your web pages correspond to the exact filenames on your web site. If they do not match, you can either modify your links or rename your files with an FTP program so they match your hyperlinks.

Also note that your user name, password and all UNIX commands are case sensitive.

How do get online help for a UNIX command?
The man command, short for manual, displays online help for a particular UNIX command.

Type man ls at the command prompt to get information on the ls command.

How do I list my files & directories?
The ls command lists the files and subdirectories of the current directory. This is equivalent to the dir command in DOS.

ls -a will show all hidden files such as .htaccess
ls -l will show detailed information including permissions, owners, size and file modification time.

How do I change directories?
The cd command will change to another directory. This is equivalent to the cd, chdir in DOS.

Once you login to your account with telnet, type cd HTML to change to your HTML directory.
Type cd to return to your home directory ( /home/your_user_name )
Type cd .. to change to the directory just above the current one.

How do I make directories?
The mkdir command makes a new directory. This is equivalent to the md, mkdir commands in DOS.

At a telnet prompt, type mkdir test to create a new directory called test.

How do I remove directories?
The rmdir command will remove an empty directory. This is equivalent to the rd, rmdir commands in DOS.

At a telnet prompt, type rmdir test to remove a directory called test.

How do I copy files & directories?
The cp command copies a file to a new directory or filename. This is equivalent to the copy command in DOS.
  • Typing cp welcome.php index.phpl at the telnet prompt will copy the welcome.php file to the index.phpl file.
  • Typing cp welcome.php HTML/index.phpl at the telnet prompt will copy welcome.php to the index.phpl located in the HTML directory.
    Typing cp * /home/your_user_name/HTML at the telnet prompt will copy all the files in the current directory to your HTML directory
How do I move (rename) files?
The mv command moves a file to a new location or renames it. This is equivalent to the move, ren, rename commands in DOS.
  • Typing mv * /home/your_user_name/HTML at the telnet prompt will move all the files in the current directory to your HTML directory
  • Typing mv welcome.php index.phpl at the telnet prompt will rename the welcome.php file to the index.phpl file.
  • Typing mv welcome.php HTML/index.phpl at the telnet prompt will rename welcome.php to index.phpl located in the HTML directory.
How do I remove files?
The rm command removes (deletes) a file.
Please be careful removing files; there is no un-remove command!
This is equivalent to the del command in DOS.

Typing rm test.php at the telnet prompt will remove the test.php file.

How do I search within files?
The grep command finds lines in files that match specified text patterns.
The syntax is as follows grep text filename
  • Typing grep welcome index.phpl at the telnet prompt will find any lines in the index.phpl containing the text welcome in them.
  • Typing grep hello * at the telnet prompt will find any files in the current directory that contain the text hello in them.

How do I change file and directory permissions?
The chmod command sets the permissions of a file or directory. There are 3 sets of permissions for files and directories: owner, group and other which are controlled by read, write and execute permissions. This is equivalent to the attrib command in DOS.
  • Type chmod 755 *.cgi to make your cgi scripts executable.
  • Type chmod 755 cgi to set the permissions on your CGI directory.
How do I back up & restore files & directories?
The tar command is an archiving utility for packing many files into a single archive file while retaining file permissions and ownership.
  • Type tar cvf backup1.tar HTML in your home directory to archive the contents of your HTML directory into backup1.tar
  • Type tar xvf backup1.tar in your home directory to restore (replace) the contents of your HTML directory from backup1.tar
How do I compress & uncompress files & directories?
The tar command can be used with gzip to compress many files into a single archive while retaining file permissions and ownership. Please note that these files can be decompressed with WinZIP.
  • Type tar czvf backup2.tgz HTML in your home directory to compress the contents of your HTML directory into backup2.tgz
  • Type tar xzvf backup2.tgz in your home directory to restore (replace) the contents of your HTML directory from backup2.tgz