Untitled

October 5, 2017 | Author: arthur10892 | Category: Parameter (Computer Programming), Filename, Computer File, Web Page, Hyperlink
Share Embed Donate


Short Description

Download Untitled...

Description

Chapter 1: Files, Directories and Redirection File system commands: ls -[lAa], mkdir, cd, pwd, cp, mv, rm Standard output redirection (>) Viewing files: cat, less, head, tail Commands and their options: touch, cal, wc 1. Create a file Create a file called "hello.world" (without the quotes). Hint: touch Touch hello.world 2. Create a directory Create a directory called "otherworld" (not including the quotes). mkdir otherworld 3. Store a calendar Store the 2008 calendar produced by the "cal" command in the file "calendar" wit h no modifications to the output of the "cal" command. Hint: Standard output red irection using ">". cal 2008 > calendar 4. List visible files List all (non-hidden) files in the directory "/usr/local/linuxgym-data/gutenberg " and store this list into a file called "listvis". Ensure that this is exactly the output of the command "ls". ls /usr/local/linuxgym-data/gutenberg > listvis 5. List all files By "all files" we refer to every file which is not a directory, including hidden files whose names begin with ".". List all files in the directory "/usr/local/l inuxgym-data/gutenberg" and store this list into a file called "allfiles". Ensur e that this is exactly the output of the command "ls". (Hint: consider the "all" and "almost-all" options in "man ls") ls –a /usr/local/linuxgym-data/gutenberg > allfiles 6. Top of file The "cat" function prints out the contents of a file. For example "cat /usr/loca l/linuxgym-data/census/a-j_malenames.txt" shows you an alphabetically ordered li st of male names recorded by the US Census Bureau. Because the list scrolls off the top of the screen, you can not easily read the first 10 names. The "head" co mmand solves this problem. Experiment with the "head" command and store the firs t 10 lines from the file a-j_malenames.txt into a file called "first-ten-names.t xt". (Hint: Redirect the output using ">") head –n 10 /usr/local/linuxgym-data/census/a-j_malenames.txt > ten-names.txt -n : number of lines 7. Merging files The "cat" function which prints out the contents of a file, can be used to print

the contents of several files by giving it more than one argument. In the direc tory /usr/local/linuxgym-data/census/ there are two files: a-j_malenames.txt and k-z_malenames.txt. Use "cat" to print out both of these files and store the out put in a file called "a-z_malenames.txt" in the correct order. (Hint: Redirect t he output using ">") cat /usr/local/linuxgym-data/census/a-j_malenames > a-z_malenames.txt cat /usr/local/linuxgym-data/census/k-z_malenames >> a-z_malenames.txt >> : merge with existing content 8. File size Look at the files in the directory /usr/local/linuxgym-data/teeny and indentify which is the smallest file. Copy this file into your ch1-fdr directory. (Hint: c p, ls -l) ls –l -s /usr/local/linuxgym-data/teeny (or ls –l –s –S) cp /usr/local/linuxgym-data/teeny/filename filename (smallest) /home/stude nt/…. -l : show information for each file -s : size of files -S : arrange from biggest to smallest file Chapter 2: Elementary VIM In preparation for the exercises in this chapter create a directory called "ch2vim" in your home directory. Copy the file "/usr/local/linuxgym-data/vimdata/tut or.txt" into your "ch2-vim" directory, change into the directory and start editi ng the file "tutor.txt" using vim by calling: "vim tutor.txt" and following the instructions within the file. If anything should go awry, just exit vim by (1) hitting Esc - the button at the top left of your keyboard; and then (2) issu ing the command ":q!" To start over again, copy "/usr/local/linuxgym-data/vimdata/tutor.txt" into your "ch2-vim" directory and start editing the file again. For all the questions bel ow, perform the operation on the file indicated and save it before marking the q uestion. 1. Insert text Within your "ch2-vim" directory, create a file called "hw.txt", with only one li ne of text saying: "hello world" (without the quotes) and save the file. mkdir ch2-vim touch hw.txt insert ‘hello world’ Esc

cd mkdir ch2-vim vim hw.txt

press “i” to

:wq (to save changes and exit)

2. Join lines Copy the file "/usr/local/linuxgym-data/vimdata/wordlist.txt" into your "ch2-vim " directory. Edit the file so that all of the text is on a single line with only a space (not a newline) between the words. cp /usr/local/linuxgym-data/vimdata/wordlist.txt wordlist.txt vim wordlist.txt 3. Delete a word Copy the file "/usr/local/linuxgym-data/teeny/1mwsm10.txt" into your "ch2-vim" d irectory. Delete the first word at the beginning of line 6 - and the space which follows it - and save the file, making absolutely no other changes (Hint: dw)

cp /usr/local/linuxgym-data/teeny/1mwsm10.txt /home/student/ch2… 6G (go to indicated line) esc i dw (delete the word where indicated with the space that follows) :wq 4. Search and line deletion Copy the file "/usr/local/linuxgym-data/gutenberg/07frd10.txt" into your "ch2-vi m" directory. Delete the line containing the word "opera-girls" - and save the f ile, making absolutely no other changes. (Hints: / and dd.) cp /usr/local/linuxgym-data/gutenberg/07frd10.txt vim 07frd10.txt : /opera-girls : / dd :wq

07frd10.txt command to search words dd delete line

5. Deletion by line numbers Copy the file "/usr/local/linuxgym-data/gutenberg/0ws3110.txt" into your "ch2-vi m" directory. Starting at line 50 delete 4000 lines (including line 50) - and sa ve the file. Make absolutely no other changes. cp /usr/local/linuxgym-data/gutenberg/0ws3110.txt 0ws3110.txt vim 0ws3110.txt 50G mber indicated 4000dd :wq

G

GO to line nu

6. Copy and paste by line numbers Copy the file "/usr/local/linuxgym-data/teeny/3mwsm10.txt" into your "ch2-vim" d irectory. Delete the first 10 lines and append them to the end of the file. Save the file and make no other changes. 10yy OR 10dd lly) GP pastes

yy dd GP

yank command which copies the indicated lines delete 10 lines (copies them into cache automatica G command goes to end of the file and P commend

7. Delete to the end of a file Copy the file "/usr/local/linuxgym-data/gutenberg/7wdvn10.txt" into your "ch2-vi m" directory. Delete all the lines from line 1024 to the end, including line 102 4 and save the file. G1024 [Number of lines in file – 1024] dd 8. Search and replace strings In the next two questions we have to distinguish between words and strings. A st ring is a sequence of characters, while a word is a sequence of letters within a string, surrounded by non-word characters. For example, the string "This is a t

esting time" contains the words "This", "is", "a", "testing" and "time". It does not contain the word "test", but it does contain the string "test". Copy the fi le "/usr/local/linuxgym-data/vimdata/hermit.txt" into your "ch2-vim" directory. Replace every occurence of the string "and" with the string "OR". Ensure you mak e no other changes to the file. :%s/and/OR/gc

replace ‘and’ with ‘OR’ for strings

9. Search and replace words [1] Recall that we have to distinguish between words and strings. A string is a sequ ence of characters, while a word is a sequence of letters within a string, surro unded by non-word characters. For example, the string "This is a testing time" c ontains the words "This", "is", "a", "testing" and "time". It does not contain t he word "test", but it does contain the string "test". Copy the file "/usr/local /linuxgym-data/vimdata/7herm10.txt" into your "ch2-vim" directory. Replace every occurence of the word "and" with the word "OR". (Hint: make sure you don t chan ge words such as "sandy" into "sORy".) :%s//OR/gc

replace only words with ‘and’ with ‘OR’

10. Cut and paste by markers [1] Copy the file "/usr/local/linuxgym-data/teeny/4mwsm10.txt" into your "ch2-vim" d irectory. Cut (remove) the lines between (and containing) those with "START HERE " and "UPTO HERE" and insert them at the marker "PASTE HERE". Save the file and make no other changes. yy – copy dd- copy & delete

P – paste

Chapter 3: People and Permissions Chmod 7 = all te

4 = read 1 = execute

3 = write & execute

2 = wri

Topics covered: concepts: users and groups, permissions, standard error redirect ion (2>) Commands and their options: whoami, ls -l, chmod, pwd 1. Who am I The command "whoami" tells you your userid. Store your userid in the file "myuse rid" in your ch3-pp directory. (Hint: Redirect the output using ">") mkdir ch3-pp cd ch3-pp Touch myuserid Whoami > myuserid 2. Permissions Create a file called textperm.txt with permissions as follows: You yourself have permission to read and write; Your group has permission to read; The rest of th e world have no permissions whatsoever. Touch textperm.txt Chmod u +rx

chmod g +r

chmod o –rxw

OR

chmod620 textperm.txt

3. Copy executable There is only one file in the directory /usr/local/linuxgym-data/permissions whi ch is executable. Copy this file into your ch3-pp directory, giving it the name "executable.sh". Cd ls cd Cp

/usr/local/linuxgym-data/permissions –l ~/ch3-pp /usr/local/linuxgym-data/permissions(executable file name) executable.sh

4. Execute Execute the file "executable.sh" which you copied in the previous question, and store the output in the file "ex.out" in your ch3-pp directory. (Hint: Executing a file in the current directory requires the filename being preceeded by "./". Storing the output is to be done using ">".) touch ex.out ./executable.sh > ex.out 5. Copy my group file There is only one file in the directory /usr/local/linuxgym-data/permissions whi ch is assigned to your group. Copy this file into your ch3-pp directory, giving it the name "myfile". ls –l /usr/local/linuxgym-data/permissions cp (group file) myfile ls –l

to view f

ile information 6. Secret file Create a file called "secret.txt" in your "ch3-pp" directory containing your nam e and telephone number. Change the permissions of this file so that you can read and write to it, but no-one else can read or write to it. Also ensure that no-o ne can attempt to execute (run) it. touch secret.txt vim secret chmod 600 secret.txt (there is an easier way) 7. Small Bash script The file "/usr/local/linuxgym-data/permissions/hw.sh" is a bash script. Copy it into your "ch3-pp" directory and change the permissions so that you are able to execute it. cp /usr/local/linuxgym-data/permissions/hw.sh hw.sh chmod 740 hw.sh (there is an easier way) 8. Standard error preparation Create a file called "forgotten.txt" in your "ch3-pp" directory. Change its perm issions so that you are not allowed to see its contents. cat > forgotten.txt chmod 222 forgotten.txt (there is an easier way)

9. Standard error message If you attempt the command "cat forgotten.txt" (as created in the previous quest ion), because you do not have permission to read it, there will be an error. The goal of this question is to store this error in a file called stderr.out in you r ch3-pp directory, making sure there are no additional characters or spaces. (H int: Do not attempt to edit this file by hand. ) cat > stderr.out cat forgotten.txt 2> stderr.out The ">" operator redirects the standard output while the "2>" operator redirects the standard error. Chapter 4: Piping and Wildcards Concepts: pipes (|), appending (>>, 2>>), wildcards(*,?,[]), recursive list and copy. Commands and their options: wc -[mwl], tail -n, ls -[Rrt], cp -r. wc: displays wc –m: Count wc –w: Count wc –l: Count

a count of lines, words, and characters in a file. characters. words delimited by white space characters or new line characters. lines.

tail: Delivers the last part of the file. tail –n: n = number the starting location in the file is measured in lines instead of bytes. The origin for counting is 1; that is, -n+1 represents the first line of the file, -n-1 the last. ls: Lists the contents of a directory. ls –R: Includes the contents of subdirectories. ls –r: Reverses the order of how the files are displayed. ls –t: Shows you the files in modification time. cp: Copies files from one location to another. cp –r: copy directories recursively >> : append standard output to a file (command >> file) *: wildcard match any number of characters ?:wildcard match one character ls | wc -l list word count ls | wc -1 > filename redirect word count 1. Word count redirect Use the command "wc" to count the number of words in the file "/usr/local/linuxg ym-data/gutenberg/0ws0310.txt". Store the exact output of the wc command when us ed with the "word counts" option in the file "count.txt". Ensure that the filena me within the file contains the full pathname. (Hint: Use redirect ">"). wc -w /usr/local/linuxgym-data/gutenberg/0ws0310.txt > count.txt 2. Character count piping Experiment by using the command "cat | wc -m", typing a few lines, and then usin g ctrl-D to return to the command prompt. This outputs a single number indicatin g the number of characters you ve typed. Unlike the previous question, no filena me is printed. Modifying this technique, store the number of characters of the f ile /usr/local/linuxgym-data/gutenberg/0ws0310.txt into a file called "pipecount .txt" with no other text, such as the filename.

cat | wc –m type a few lines ctrl d cat /usr/local/linuxgym-data/gutenberg/0ws0310.txt | wc –m > pipecount.txt wc –m

-m command prints characters from the wc command

3. Wild list List all the files in the directory /usr/local/linuxgym-data/emptystuff/ which c ontain the string ws in their filename, and put the result in a file called "w sfiles.txt". Do NOT include the full path, and ensure that there is only one fil ename per line. (HINT: To avoid getting the full pathname for each file, change directory to /us r/local/linuxgym-data/emptystuff/ so that the ls argument refers to local files. ) touch wsfiles.txt in ch4-pipewild cd /usr/local/linuxgym-data/emptystuff/ *ws* > ~(ect)/wsfiles.txt ls *ws* > /home/student/ch4-pipewild/wsfiles.txt *ws*

OR

search for ‘ws’

4. View the end of a file Store the last 103 lines of the file "/usr/local/linuxgym-data/gutenberg/4mwsm10 .txt" into the file "lastlines.txt". [Hint: Look at the bash function "tail" and its options] touch lastlines.txt tail -n103 /usr/local/linuxgym-data/gutenberg/4mwsm10.txt > lastlines.txt tail

starts from end of the file

5. Append the output Copy the file /usr/local/linuxgym-data/census/a-j_malenames.txt to a file called appendix.txt in your ch4-pipewild directory. Append to appendix.txt the content s of /usr/local/linuxgym-data/census/k-z_malenames.txt making no other modificat ions. [Hint: cat, ">>"] touch appendix.txt cp /usr/local/linuxgym-data/census/a-j_malenames.txt appendix.txt cat usr/local/linuxgym-data/census/k-z_malenames.txt >> appendix.txt 6. Listing according to a regular expression Make a list of all the files from the directory "/usr/local/linuxgym-data/gutenb erg" who s names contain the string "rd" and save this list as "rdfiles.txt". En sure that only the filenames are listed WITHOUT the pathnames as a prefix. touch rdfiles.txt cd /usr/local/linuxgym-data/Gutenberg ls *rd* > path/filename.txt 7. Copying according to a regular expression Create a directory called "s2" under your "ch4-pipewild" directory. Copy all the

files from the directory "/usr/local/linuxgym-data/gutenberg" who s names conta in the string "s2" into your "ch4-pipewild/s2" directory. mkdir s2 cp *s2* /usr/local/linuxgym-data/Gutenberg cific directory)

(go to that spe

OR cd usr/local/linuxgym-data/Gutenberg ls | grep s2 | xargs cp {} ~/ch4-pipewild/s2 8. Listing files ordered by their modification time List the (visible AND hidden) files in the directory "/usr/local/linuxgym-data/s pacetime" from least, to most recently modified. Store this list into the file " timeordered.txt", with only the filenames. touch timeordered.txt cd /usr/local/linuxgym-data/spacetime ls –at > ~(etc)timeordered.txt 9. Copying a directory Copy the whole directory "/usr/local/linuxgym-data/teeny" and its contents into your "ch4-pipewild" directory. [Hint: You can do it with just one call of cp and recursion.] cp –r /usr/local/linuxgym-data/teeny

teeny

10. Listing files ordered by their size List the (non-hidden) files in "/usr/local/linuxgym-data/gutenberg" ordered by s ize from large to small, and store this list in a file called "large_to_small" i n your "ch4-pipewild" directory. Include only the file names. Do not include the path prefixes. touch large_to_small cd /usr/local/linuxgym-data/Gutenberg ls –S > ~/ch4-piplewild/large_to_small (HINT: To avoid getting the full pathname for each file, change directory to /us r/local/linuxgym-data/emptystuff/ so that the ls argument refers to local files. ) Chapter 5: Introduction to Scripting Scripts are files containing a sequence of commands which can be executed by typ ing the file name - don t forget to ensure the file is executable. The first lin e in a bash script should always be: #!/bin/bash Topics and commands covered: shebang (#!), echo, parameters ($#, $0, $1, $*,...) , assignment (=), arithmetic operators. CHMOD ALL FILES 777 1. Hello world Create a script called "print.sh". This script should print out the string: "Hel lo world" (do not include the speech marks/inverted commas in the output). [hint : echo]

#!/bin/bash echo Hello World nts out a particular string

echo

pri

2. Echo one parameter Write a bash script called arg.sh which will print out the SECOND argument to th e script. For example, if the script was called as ./arg.sh ay bee cee then the script will output bee and NOTHING ELSE. #!/bin/bash echo $2 2 – takes the second argument entered by user

$

3. Echo all parameters Write a bash script called "args.sh" which will print out each argument passed t o it. Each argument should be separated by a space only. #!/bin/bash echo $@ - print out argument with space

@

4. Sum of two parameters Create a script called add.sh in your home directory. This script should add 724 to its first argument and print out the sum. The sum should be the only thing p rinted out. #!/bin/bash let “sd=724” sum= $(( $1 + $sd )) echo $sum KE SURE the spaces are correct..

MA

5. Product of two parameters Create a script called mult.sh in your home directory. This script should multip ly its first argument by 13 and print out the product. The product should be the only thing printed out. #!/bin/bash let “a = ($1 * 13)” If [ $# != 2 ] then Echo $a Exit Else Echo error Fi 6. Number of arguments Write a bash script called numargs.sh which will print out the number of argumen ts to the script. For example, if the script was called as: ./numargs.sh ay bee cee then the script will output: 3 and NOTHING ELSE. #!/bin/bash echo $# out the number of argument inputted

# - prints

7. Echo to standard error Write a bash script called "stderr.sh" which will print out all arguments passed to it on a single line sent to STDERR. #!/bin/bash echo $* 1>&2 OR echo $* @>&2 OR echo $@ls 8. List to standard error Write a bash script called "lsstderr.sh" which will execute ls on the first argu ment and output the result to STDERR. #!/bin/bash ls $1 1> &2 9. Word count script Write a bash script called wcscript.sh which will perform the word count on the first argument (a file), and print out the number of words it contains and nothi ng else. For example, if the script were called on a file a.txt containing 95 wo rds with ./wcscript.sh a.txt it will output: 95 and NOTHING ELSE. [HINT: use "ca t" to provide standard input to wc] #!/bin/bash cat $1 | wc –w 10. Check number of arguments Write a bash script called "checknumargs.sh" which will echo to STDOUT all argum ents passed to it on a single line IF THE NUMBER OF ARGUMENTS IS 3. If the numbe r of arguments is not 3, then it should echo "error" to STDERR. #!/bin/bash Echo $* 1>$2 If [ $# != 3 ] then Echo error 1>&2 Exit Else Echo $* 2>&1 Fi Chapter 6: Data Processing In this chapter we will utilise the skills attained in previous chapters to anal yse statistics on the popularity of female names. The data to be analysed is in the file /usr/local/linuxgym-data/census/femalenames.txt with each line conainin g NAME, FREQUENCY, CUMULATIVE FREQUENCY, and RANK, where RANK=1 is the most popu lar name. The file is ordered by RANK. Topics and commands covered: - searching through data (grep -[lvw]); - comparing contents of files (diff); - data manipulation (uniq, sort, join). 1. List manipulation

Create a file called "table.csv" containing all the lines of /usr/local/linuxgym -data/census/femalenames.txt with all white space between words changed into a s ingle comma. For example, the line: MARY 2.629 2.629 1 will become MARY,2.629,2. 629,1 Make no other changes. Hints: 1. Notice that the regular expression "\s\+" means "a sequence of one of more white spaces". 2. Ensure there is no extra whi tespace in the file :%s/\s\+/,/g \s\+ a sequence of white spaces (delimiter to be replaced) the delimiter desired

/,/

refers to

2. List sorting Create a file called "alphabetical.txt" in your "ch6-data" directory containing the lines of /usr/local/linuxgym-data/census/femalenames.txt ordered alphabetica lly by NAME. Ensure that there are no other changes to the data. (Hint: Use "sor t" and redirection.) vim - insert mode : sort 3. List cut Create a file called "names.txt" containing only the first column of /usr/local/ linuxgym-data/census/femalenames.txt in its existing order. Ensure that there ar e no other changes to the data. (Hint: Use the command "cut" together with its f ield and delimiter options.) cut –f1 –d “ “ (filename/path) > filename.txt -f1 indicates to the column s in this case a space

-d “ “

indicates the delimiter which i

4. Search prefix Create a bash script called searchprefix.sh which takes two arguments, a string and a file (in that order). The output should be each line which matches the str ing *from the beginning of the line*. For example, given a string "ANA" the line starting with "ANABEL" will be printed, but the line starting with "SUSANA" wil l not. (Hint: Use grep and ^ to indicate the beginning of the line). vim #!/bin/bash cat $2 | egrep ^$1 5. Multiple file string detection Create a file called "anne-files.txt" containing the list of names of files in / usr/local/linuxgym-data/gutenberg which contain the STRING Anne inside them (i ncluding Annemarie and Annetta). Ensure there is one filename per line (WITH THE FULL PATHNAME), that there are no extra blank lines in anne-files.txt, and that no filename occurs more than once. Each line should ONLY contain the filename, no additional detail. [Hint: use grep] vim egrep –l “Anne” path/filename/* > filename.txt 6. Grep and words Create a file called "anne-words.txt" containing only the lines of "/usr/local/l inuxgym-data/gutenberg/12frd10.txt" containing the name (WORD) Anne . Note that

Annette and Annemarie do not count. Ensure there are no extra blank lines i n the file "anne-words.txt" and the lines should be in the same order as in 12fr d10.txt. [Hint: use grep and redirection] grep –w “Anne” path/filename > filename.txt -w choose lines containing the whole word 7. Grep and regular expressions Create a file called "natmat.txt" containing, IN THE ORIGINAL ORDER, only the li nes of /usr/local/linuxgym-data/census/femalenames.txt starting with the string NAT or MAT . Ensure there is no extra white space in the file "natmat.txt". [ Hint: use regular expressions in grep and redirection] egrep “^[NM]AT” path/filename > filename.txt [NM] N or M 8. Name frequency Create a bash script called namefreq.sh which takes one argument - a name. The o utput should be the FREQUENCY of that name s use, which is the entry in the seco nd column of /usr/local/linuxgym-data/census/femalenames.txt For example ./namef req.sh ANA will return 0.120 and nothing else, which corresponds to the line "AN A,0.120,55.989,181" of the file "table.csv" you created in the "List manipulatio n" question. Hints: 1. Search "table.csv" instead of "/usr/local/linuxgym-data/c ensus/femalenames.txt"; 2. Grep for "words" rather than strings. 3. Use "cut" to output a particular field. egrep $1 filename.txt | cut –f2 –d, -d, delimiter is a comma “ , ” 9. Single file word detection Write a bash script called gender.sh pt should print "female" if the word a/census/femalenames.txt, and "male" doesn t get printed, or use the grep of grep

which takes one argument - a name. The scri appears in the file /usr/local/linuxgym-dat otherwise. Hints: 1. Redirect stdout so it "quiet" option; 2. View the exit status $?

vim #!/bin/bash egrep –iq $1 path/filename if [ $? == “0” ]; then echo “female” else echo “male” fi 10. Same frequency Challenge question Create a bash script called samefreq.sh which takes one argum ent - a name. The output should be the alphabetically ordered list of all name s with the same frequency (popularity) as measured in the second column of the ta ble: /usr/local/linuxgym-data/census/femalenames.txt For example ./namefreq.sh A NA will return a list of two names (on separate lines) ANA and RENEE, both of wh ich have frequency 0.120. Hints: 1. Instead of "/usr/local/linuxgym-data/census/ femalenames.txt" search "table.csv" (created in the question "List manipulation" of this chapter) using words rather than strings; 2. Store the frequency of the name using backquotes; 3. Search for the frequency while viewing only the first two columns (use cut) - name and frequency; 4. Sort the final list of names. vim #!/bin/bash

  a= grep -w $1 table.csv | sort | cut -f2 -d, grep -w $a table.csv | sort | cut -f1 -d, Chapter 8: Web Development 1. Html elementary Create a web page accessible at the URL http://localhost/~student/text.html and within this page insert five headings from largest to smallest heading types. In sert also at least two paragraphs of text, and make some of the text in this pag e "bold" and some of it "emphasized". vim filename.html x 5 2. Html hyperlink Create an HTML web page accessible at the URL http://localhost/~student/extlink. html with exactly one anchor tag linking to http://www.google.com vim extlink.html < a href = “http://www.google.com”> 3. Html preformat Create a web page accessible at the URL http://localhost/~student/preformat.html and within this page insert two elements: one paragraph, and one block of prefo rmatted text. vim preformat.html 4. Html list Create a web page accessible at the URL http://localhost/~student/list.html. Cre ate within this file only one ordered list with 4 list items. The items may cont ain any text or html. (You can check your answer by browsing to http://localhost /~student/list.html) vim list.html coffee milk hot chocolate tea 5. Html table Create a web page accessible at the URL http://localhost/~student/table.html con taining a table with 2 rows and 4 columns, each cell containing a small amount o

f text. vim table.html x 2 x 4 6. Html picture Copy the image file /usr/local/linuxgym-data/public_html/fish.jpg into your publ ic_html directory. It should be viewable by following the link http://localhost/ ~student/fish.jpg Create an HTML web page accessible at the URL http://localhost /~student/picture.html displaying the fish.jpg image, together with some explana tory text. cp /usr/local/linuxgym-data/public_html/fish.jpg fish.jpg vim picture.html 7. Html index An index.html file is automatically accessed by the browser without specifying t he filename. The goal of this exercise is to create an HTML web page accessible at the URL http://localhost/~student/ As the "front page" of this chapter, give the index.html page links to several other pages in your public_html directory w ithout using "http" in the address. This is called a "relative link". (A link us ing "http" in the address is called "absolute".) vim index.html etc

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF