Professional Documents
Culture Documents
2016 Answers Assignment1 Software Development Tools Usq Csc2408 PDF
2016 Answers Assignment1 Software Development Tools Usq Csc2408 PDF
answers
Question 1:
If a files permissions is rw, and the directory which the file is in has r only,
you can perform ls on the directory and see all files name in the directory, but
you can not view the file, not edit the file, nor delete the file.
However, if the directory has x only, you would not be able to perform ls on
the directory, but you are still able to view, edit the file if you somehow knew
the name of the file, not delete the file.
Question 2:
a) What is the difference between ab.cd and ab*cd?
ab.cd will match a string with only one character between ab and cd.
Example: ab1cd will match
ab*cd will match a string when there is zero or more characters between ab and
cd.
Example: ab12345cd will match
b) what is the difference between ab.*cd and abb*cd ?
Question 4:
Create a big file (If you dont know how to create a big file,
try ls -l /usr/bin > bigfile). Make a copy of it using cp, and
call them big1 and big2.
a) The command-line to compress big1 using gzip.
Command gzip -c big1> big1.gz
b) The command-line to compress big2 using bzip2
Command bzip2 big2
c) The compression ratio of each compression method Using command diff
or zdiff to compare the compressed files and diff to compare the original
file.
d) Give the command-line of checking the file type of compressed files and
the original.
Command: file <original file> and file <compressed file>
e) The command-line to list top 10 lines of the content of big1.gz and
big2.bz2
Command: zcat big1.gz | head -10
Command: bzcat big2.bz2 | head -10
Question 5:
a) Use tar to create an archive (don't use the z or j option) of all the files
in the current directory.
Command: tar -cvf myfile.tar /home/CSC8421/
\([0-9]\) is the first part of Regular expression , \([0-9]\) is the second part of
Regular expression . The regular expression is a pattern to any strings like s13t, 212-313, etc. \1 is what the first part of the Regular expression , \2 is the
second part. After the execution, the matched strings will be put back, but the
- is removed. For instance, string a1-3t is substituted by a13t, and 212-313
by 212313.