LINUX/Unix Assignment

Part 1

  1. A hidden file in Unix begins with characters

a) $

b) ?

c) .

d) ~

  1. To display the content of a file on the console screen, the command to use is

a) cat

b) cp

c) ls

d)

  1. To find out the number of lines in a file, thte command to use is

a) lp

b) ls

c) wc

d) ps

  1. the command to paginate files and add line numbers to those files is

a) lp

b) ls

c) pr

d) grep

  1. The command to display a list of running processes is

a) man

b) which

c) netstat

d) ps

  1. In Unix, the command to alter the permissions associated with files and directories is

a) mv

b) chgrp

c) chown

d) None of the above

  1. Which cursor key moves the cursor up one line in the vi editor

a) k

b) j

c) h

d) i

  1. Which command is used to erase the character at the current cursor position

a) r

b) dd

c) x

d) xx

  1. Which command does not exit vi and return to the Unix prompt

a) q!

b) wq!

c) w!

d) none of the above

  1. A user's .profile file

a) can be used to dump a profile

b) is seldomly used

c) is a good place to set environment variables

d) all of the above

  1. The command ls -s

a) lists files beginning with '.'

b) list files recursively

c) lists files in alphabetical order

d) lists files and sizes in blocks

  1. The command ls -t

a) lists the directory contents recursively

b) lists directory contents sorted by filename

c) lists directory contents with no sorting

d) none of the above

  1. The command head

a) is not a valid Unix command

b) prints out the first lines of the file

c) prints out the file headers

d) None of the above

  1. The Domain Name Service provides

a) user identification

b) hostname to IP translation

c) routing information to other named hosts

d) hostname to domain translation

  1. With a umask value of 113, what are the default permissions assigned to newly created files?

a) ---x--x-wx

b) -rw-rw-r--

c) -r-xr-x-r--

d) ---x--xrwx

  1. What is a shell in Unix

a) a window management system

b) a program through which users can issue commands tp Unix

c) the login screen

d) all of the above

  1. Which of the following pieces of information is not contained in the passwd file?

a) a user's unencrypted password

b) a user's login name

c) a user's preferred shell program

d) a user's group ID

  1. Which of the following commands is used to search for patterns in a file

a) sort

b) split

c) tee

d) grep

  1. Which of the following symbols represents redirection

a) -

b) #

c) >

d) &

  1. The following is a directory listing of a UNIX home directory for the user brian. Study the listing carefully then answer the following questions.

$ ls -la

total 50

drwxr--r--7brianstaff288Feb 01 08:42.

drwxr-x---9authstaff144Sep 22 12:00..

-rw------1brianstaff0Aug 09 08:23.addressbook

-rw-rw----1brianstaff1068Oct 14 08:37.cshrc

-r------1brianauth0Feb 01 08:42.lastlogin

-rw-rw----1brianstaff911Jul 29 1994.login

-rw------1brianstaff4115Aug 09 08:23.pine-debug1

-rw------1brianstaff7783Aug 09 08:22.pinerc

-rw------1brianstaff874Jul 29 1994.profile

-rw------1brianstaff0Nov 04 08:17.prwarn_time

drwxrwxrwx2brianstaff128Jul 29 1994awk

drwx------2brianstaff48Jul 29 1994cfiles

drwx------2brianstaff64Aug 09 08:22mail

-rw------1brianstaff596Nov 01 15:44mbox

drwx------5brianstaff80Oct 06 12:58os202

drwx------2brianstaff128Nov 04 08:22wwwstats

$

how many subdirectories are there

a) 3

b) 4

c) 5

d) 6

  1. What is the size (in bytes) of the file .pinerc

a) 7783

b) 874

c) 08:22

d) 1

  1. Who is the owner of the file mbox

a) staff

b) root

c) brian

d) 64

  1. What are the owner permissions of the file mbox

a) rw-

b) rwx

c) r-x

d) --x

  1. What are the group permissions of the file .login

a) rw-

b) rwx

c) r-x

d) --x

  1. What is the name of the group to which the user brian belongs

a) brian

b) staff

c) root

d) auth

  1. Assuming ENV=.kshrc, the file that is executed in the Korn shell whenever a Korn shell program is executed is called the:

a) .profile

b) .kshrc

c) .cshrc

d) .login

  1. What kind of display prompt do you get if your .profile contains the following entry? (Assume your server name is myserver and your current command number in your history list is 1019).

PS1="`uname -n`-\!>"; export PS1

a) uname -n\!>

b) myserver-1019>

c) myserver!>

d) myserver-1019

  1. Assuming you have the value ENV=.kshrc set in your environment, the following entry in your .kshrc is executed whenever your login or execute a Korn shell program:

function myfunc { let result=`expr $1 + $2` echo $result }

What are the results when you execute the command:

myfunc 7 5

a) You get 12

b) You get 2

c) You get 35

d) The following character string inside the quotes is displayed "7 + 5"