[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 110: Undefined array key "cached"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 111: Undefined array key "normal"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 112: Undefined array key "total"
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3391: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3393: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3394: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3395: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
Cabrillo College Linux Classes • View topic - Cleaned up quiz questions

Cleaned up quiz questions

Introduction to UNIX/Linux

Cleaned up quiz questions

Postby Rich Simms on Fri Oct 24, 2008 11:33 am

1) What is the numeric version of [b]rw-rw-r-–[/b] that you could use on a chmod command?

2) What command could you use to get an approximate count of all the files on Opus and ignore the permission errors?

3) For the command: [b]sort names > dogsinorder[/b] is sort getting its input from:
a) stdin
b) the command line
c) opening and reading a file called [b]names[/b]

Feel free to work the answers out on the forum,

- Rich
User avatar
Rich Simms
Site Admin
 
Posts: 640
Joined: Thu May 15, 2008 2:44 pm

Re: Cleaned up quiz questions

Postby Michael Wicherski on Sun Oct 26, 2008 6:31 pm

1.
just remember
421 421 421
rw- rw- r --

4+2 4+2 4

664

2.
find /* 2>/dev/null | wc -l

(find all files in the root and pipe it into wc and count the lines
Since the display is 1 line per file, the line count tells you how many files
and 2>/dev/null redirects stderr into the bitbucket or aka THE VOID --eerie area 51 music--) :ugeek:

could also do

ls -lR / 2>/dev/null | wc -l
______________________


(if you leave out the redirect to bit bucket (/dev/null) you would get a more accurate idea of how many files are on the server because you would also get 1 line of "error" per file that you cannot access ... but this question specifically says to omit errors - so use the bitbucket to dump stderr (2>) into bit bucket)

3. **edit** the answer is C (didn't specify the letter of the answer before)**
the sort program opens and reads the file
(notice that stdin is not redirected, therefore the program handles the file itself.
sort <names ... would cause stdin to be redirected to the file and sort would never know it just read from a file in which case the answer for the question would be stdin)
Last edited by Michael Wicherski on Thu Oct 30, 2008 12:53 pm, edited 1 time in total.
Michael Wicherski
 
Posts: 140
Joined: Mon Sep 01, 2008 5:23 am

Answers!

Postby bobbi whitfield on Tue Oct 28, 2008 11:07 pm

You rock,thanks!!!!! :!:
bobbi whitfield
 
Posts: 25
Joined: Wed Sep 03, 2008 7:26 pm

Re: Cleaned up quiz questions

Postby collin seaton on Wed Oct 29, 2008 5:45 pm

[quote="Michael Wicherski"]
2.
find /* | wc -l 2>/dev/null

(find all files in the root and pipe it into wc and count the lines
Since the display is 1 line per file, the line count tells you how many files
and 2>/dev/null redirects stderr into the bitbucket or aka THE VOID --eerie area 51 music--) :ugeek:

could also do

ls -lR / | wc -l 2>/dev/null
[/quote]

The output redirection doesn't help there, you still get all the 'permission denied' errors. The reason is because 2>/dev/null is put after wc -l, which isn't throwing errors, rather find or ls is putting out the errors. The correct syntax, to just get a count, would be
[code]
find /* 2>/dev/null | wc -l
[/code]
or
[code]
ls -lR / 2>/dev/null | wc -l
[/code]

-collin
collin seaton
 
Posts: 24
Joined: Wed Sep 03, 2008 7:26 pm

Re: Cleaned up quiz questions

Postby Marcos Valdebenito on Wed Oct 29, 2008 5:45 pm

Thanks Michael...again....
Marcos Valdebenito
 
Posts: 56
Joined: Wed Sep 03, 2008 7:26 pm

Re: Cleaned up quiz questions

Postby Michael Wicherski on Thu Oct 30, 2008 12:52 pm

[quote="collin seaton"][quote="Michael Wicherski"]
2.
find /* | wc -l 2>/dev/null

(find all files in the root and pipe it into wc and count the lines
Since the display is 1 line per file, the line count tells you how many files
and 2>/dev/null redirects stderr into the bitbucket or aka THE VOID --eerie area 51 music--) :ugeek:

could also do

ls -lR / | wc -l 2>/dev/null
[/quote]

The output redirection doesn't help there, you still get all the 'permission denied' errors. The reason is because 2>/dev/null is put after wc -l, which isn't throwing errors, rather find or ls is putting out the errors. The correct syntax, to just get a count, would be
[code]
find /* 2>/dev/null | wc -l
[/code]
or
[code]
ls -lR / 2>/dev/null | wc -l
[/code]

-collin[/quote]

yea good catch collin; that was just a brainfart on my part - i've fixed it - thanks
Michael Wicherski
 
Posts: 140
Joined: Mon Sep 01, 2008 5:23 am


Return to CIS 90 - Fall 2008

Who is online

Users browsing this forum: No registered users and 0 guests

cron