by Sophie Engle on Aug 2013
You have the option of creating a website tied to your CS account. You have to write your own web code, but basic HTML and CSS should be easy for a computer science major to pick up. It is an excellent way to advertise your web programming skills and create a professional web presence.
Every CS account has an associated web directory. This is located at (replace test
with your CS username):
/home/web/test
For example, my web directory is /home/web/sjengle
since sjengle
is my CS username. You can enter this directory by running the following command when logged into one of the lab computers (again, replace test with your username):
cd /home/web/test
Any HTML files you place here will show up on your website. You can create a quick index.html
file by entering the following at the command line (NOT including the $
prompt character):
$ cat > index.html <html> <head> <title>Welcome!</title> </head> <body> <p>Hello world!</p> </body> </html>
When done typing, type CTRL + D
. Alternatively, you can create an index.html
file in any text editor, or transfer HTML files from your local computer to your web directory.
You need to make sure you set the file and directory permissions of all files in your web directory so that anyone may view (but not modify) those files. Otherwise, nobody will actually be able to see the webpages you have created. The easiest way to do this is to execute the following command from your web directory (NOT your home directory!):
chmod -R go=rX *
You can verify that the above setting worked by running ls -l
from the command line. You should see r--
permissions for all files, and r-x
permissions for all directories. For example:
-rw-r--r-- 1 sjengle faculty 3.8K Jan 26 2012 contact.html drwxr-xr-x 4 sjengle faculty 8.0K Jan 7 2011 courses drwxr-xr-x 2 sjengle faculty 8.0K Oct 31 2011 css drwxr-xr-x 2 sjengle faculty 1.0K Aug 18 2010 images -rw-r--r-- 1 sjengle faculty 3.7K Jul 14 11:43 index.html -rw-r--r-- 1 sjengle faculty 1.9K Jan 11 2012 research.html -rw-r--r-- 1 sjengle faculty 3.2K Jan 11 2012 teaching.html -rw-r--r-- 1 sjengle faculty 21K Apr 20 02:23 vitae.html
Using the settings above, if you do not have an index.html
(or similar) file in each subdirectory, the web server will automatically generate a page showing all the files in that directory. If you do not want this behavior, you need to remove read (r
) access from all the directories. Run man chmod
to learn more about how the chmod
command works.
If you placed your html
files in the correct location and have properly set the file permissions, you should be able to view your CS website at the following link (replace test
with your CS username):
http://www.cs.usfca.edu/~test/
If not, double check you followed the steps above. (The ~
character is called a tilde or swung dash.)
There are several resources on the web on writing webpages, HTML, and CSS. My personal favorites are:
HTML Help (http://htmlhelp.com/)
Provides a clean and easy to access HTML and CSS reference.
W3C Markup Validator (http://validator.w3.org/)
Validates your HTML, CSS, and more.
W3 Schools (http://www.w3schools.com/)
Provides interactive tutorials for HTML, CSS, and more.
Elements of Typographic Style (http://webtypography.net/)
A practical guide to web typography.
Web Style Guide (http://webstyleguide.com/)
Basic web design principles.
You can also check out the CS Resources page, which has a little more information about the web.