David Herd wrote:
Hello there slug members
It's me, David Herd again. I had a go with my assignment and had difficulties. Here is the assignment and some of my incomplete answers. Please help, this assignment is due tonight 12pm, show some mercy.

It might help to put your answers near the questions.  For the bash
commands you are asked to write answers to, try them on your own home
Linux machine.  If you don't have a Linux machine at home then you
should probably ask someone in SLUG about getting one set up, but
probably do that before you tackle a course on Linux.

a) show the lines of the online manual page for sort that contain the word order.

Read the man page for "grep"

b) show how many characters the date command outputs.

Read the man page for "wc"

c) copy all C source files (the filenames end in .c) from the present working
  directory into a subdirectory called Cfiles.

Check the case (C/c) in the answer you gave.

d) list all files in the present working directory that have filenames
  that match:
                                starts with either t or T
                                the extension is a single digit

"Extension" means something after a dot.  So a file with a single
digit extension might be ttt.0, or TtT.7

e) compress all the files in the directory Docs/ and store them in an
 archive called Docs.tar

Read the man page for "tar".

f) sort the file /etc/passwd in reverse alphabetical order by username.

sort is a good start, but what are you sorting?  Read the man page for
sort.

g) append all the lines of m1 that contain "name" to m2

Read about > and >>.  Also look up the man page for grep.

h) Mail the present working directory contents to the current user
  with subject Directory.

You haven't made an attempt at that.  What command might you use
to send mail?  Try "man -k mail" or "man -k send".

Question 2. (4 marks)

Read the man page for bash, especially around the area where it talks
about file descriptor numbers.  2b is a tough-ish question, do that one
last and don't sweat if you don't figure it out.

Question 3. (4 marks)

m1, m2 and m3 are text files.
What do the following commands do under tcsh?
Answer in English.

a) ls -l | grep admin |tee m1 | lpr -Pp1

What does the lpr command do?

b) zcat m.z | head -20

This should be easy to answer, you have the commands, just read the
man page for each.  In fact the first half dozen or so lines of "man
zcat" and "man head" should give you the answer to this question.

e.g.

       gzip, gunzip, zcat - compress or expand files

       head - output the first part of files

... so, perhaps ... uncompress your neighbour's cat, and chop off its
head 20 times?  Or something else maybe.  What does the "m.z" bit mean?

--
Del
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to