CS 3377 Exam 1 Review(236***)

¡Supera tus tareas y exámenes ahora con Quizwiz!

With ls command, use this option to list all the "dot" files (configuration files that begin with a period, such as .login or .profile).

-a

This "find" command option will go and look at all the files first before hitting any of the directories or sub-directories.

-depth

What is the official name of the passwd file ?

/etc/passwd

What represents an absolute path?

/usr/bin/cat

Only Others can execute the file

0001

Only Others can write the file

0002

Only Others can read the file

0004

Only Group can execute the file

0010

Only Group can write the file

0020

Only Group can read the file

0040

Only Owner can execute the file

0100

Only Owner can write to the file

0200

Only Owner can read the file

0400

With this option of chmod command, Owner can read, and write the file; group can read the file, and other cannot access the file.

0640

With this option of chmod command, Owner can read, and write the file; group and other can read the file.

0644

With this option of chmod command, Owner can read, write, and execute the file; group and other can execute the file.

0711

With this option of chmod command, Owner can read, write, and execute the file; group and other can read and execute the file.

0755

With this option of chmod command, Owner, group, and others can read, write, and execute the file.

0777

PID of init process is

1

What would be the result (the number of the output lines) of the following grep command with the data.txt as shown below. grep '^[0-9][0-5][0-6]' data.txt where the content of data.txt is: 48 Dec 3BC1997 CPPX 68.00 LVX2A 138 483 Sept 5AP1996 USP 65.00 LVX2C 189 47 Oct 3ZL1998 CPPX 43.00 KVM9D 512 219 dec 2CC1999 CAD 23.00 PLV2C 68 484 nov 7PL1996 CAD 49.00 PLV2C 234 483 may 5PA1998 USP 37.00 KVM9D 644 216 sept 3ZL1998 USP 86.00 KVM9E 234

1

Sticky bit

1000

Consider the following program code. How many times will it output "Hello"? main() { fork( ); fork( ); fork( ); fork( ); printf("Hello"); }

16

What would be the result (the number of the output lines) of the following grep command with the data.txt as shown below. grep '[Ss]ept' data.txt where the content of data.txt is: 48 Dec 3BC1997 CPPX 68.00 LVX2A 138 483 Sept 5AP1996 USP 65.00 LVX2C 189 47 Oct 3ZL1998 CPPX 43.00 KVM9D 512 219 dec 2CC1999 CAD 23.00 PLV2C 68 484 nov 7PL1996 CAD 49.00 PLV2C 234 483 may 5PA1998 USP 37.00 KVM9D 644 216 sept 3ZL1998 USP 86.00 KVM9E 234

2

What would be the result (the number of the output lines) of the following grep command with the data.txt as shown below. grep '^[^48]' data.txt where the content of data.txt is: 48 Dec 3BC1997 CPPX 68.00 LVX2A 138 483 Sept 5AP1996 USP 65.00 LVX2C 189 47 Oct 3ZL1998 CPPX 43.00 KVM9D 512 219 dec 2CC1999 CAD 23.00 PLV2C 68 484 nov 7PL1996 CAD 49.00 PLV2C 234 483 may 5PA1998 USP 37.00 KVM9D 644 216 sept 3ZL1998 USP 86.00 KVM9E 234

2

Sets the group ID when the program is executed

2000

What would be the result (the number of the output lines) of the following grep command with the data.txt as shown below. grep '48[34]' data.txt where the content of data.txt is: 48 Dec 3BC1997 CPPX 68.00 LVX2A 138 483 Sept 5AP1996 USP 65.00 LVX2C 189 47 Oct 3ZL1998 CPPX 43.00 KVM9D 512 219 dec 2CC1999 CAD 23.00 PLV2C 68 484 nov 7PL1996 CAD 49.00 PLV2C 234 483 may 5PA1998 USP 37.00 KVM9D 644 216 sept 3ZL1998 USP 86.00 KVM9E 234

3

[Unix&Shell4grep] What would be the result (the number of the output lines) of the following grep command with the data.txt as shown below. grep '[0-9][0-5][0-6]' data.txt where the content of data.txt is: 48 Dec 3BC1997 CPPX 68.00 LVX2A 138 483 Sept 5AP1996 USP 65.00 LVX2C 189 47 Oct 3ZL1998 CPPX 43.00 KVM9D 512 219 dec 2CC1999 CAD 23.00 PLV2C 68 484 nov 7PL1996 CAD 49.00 PLV2C 234 483 may 5PA1998 USP 37.00 KVM9D 644 216 sept 3ZL1998 USP 86.00 KVM9E 234

4

Sets the user ID when the program is executed

4000

How many times printf() is executed in the following program code? main() { for (int i=0;i<3;i++) fork(); printf("pid= %d\n",getpid()); }

8

This points out the one which is not a section of "man" page

BRIEF

What is not an advantage or a feature of CVS?

CVS can manage well a complex distributed source control

What will the following command do? chmod og+r *.jpg

Change the permissions on any file ending with .jpg to be readable by all others

Which expression shows the proper way to add the directory /usr/bin to your path?

PATH=$PATH:/usr/bin

Which of the following signals cannot be handled or ignored?

SIGKILL

Default action of SIGSEGV is

Start Core dump

Which of the following values for STAT (status) column of ps command is NOT correct?

Status E means exited

Make the file executable only if it is a directory

X

A Graphical User Interface supported by every Unix system is generally known as

X Windows

A new line (in echo) will be done with this

\n

When you use the ln command, which of the following occurs?

a file is created that points to an existing file

What is a shell in UNIX?

a program through which users can issue commands to UNIX

*

a single character followed by an *

Mark one (of the choices below) which is not a help facility. man about info --help

about

Which command option (of ar command) is used to add a file to the library?

ar -r

Which of the following is not a UNIX file type? plain file special file batch file directory file

batch file

This will print a calendar for a specified month and/or year.

cal

Which command will print the contents of all files in the current directory whose names start with the character "a" and end with a period (".") followed by any two characters followed by a number?

cat a*.??[0-9]

To create a new file "new.txt" that is a concatenation of "file1.txt" and "file2.txt" is done by which command?

cat file1.txt file2.txt > new.txt

Change the current directory to /usr/local/bin

cd /usr/local/bin

chmod

change file security setting

cd

change to another directory

[]

characters inside will be matched

This changes the permission information associated with a file

chmod

The file "mypage.html" has permissions set for read and write only for owner. Which of the following command will change the permissions so that the file can be viewed on the WWW?

chmod og+r mypage.html

This displays the differences between two files on a byte-by-byte basis

cmp

Which command is used to check out the files in RCS?

co -l

The delimiter (to separates one piece of path name from other path name) in PATH variable is a

colon

This compares sorted files

comm

What is the generic syntax for all UNIX commands?

command name, followed by options, followed by arguments

Which command is used to update the files in CVS?

commit

This configures the source code automatically

configure

cp

copy a file

Make a copy of file "upper" in the directory two levels up.

cp upper ../..

This creates an archive, restores files from an archive, or copies a directory hierarchy

cpio

Keeps a set of programs current (to compile, link edit, clean, etc).

current

This selects characters or fields from input lines and writes them to standard output

cut

Which is NOT a version control tool used in UNIX?

cygwin

This displays the current day, date, time, and year

date

To show only the current month-name is:

date +%h

In Unix, if you wanted to allow a user to delete a file, you would give the file the what permission?

delete

rmdir

delete a directory

This reports file system disk usage (i.e., the amount of space taken up on mounted file systems).

df

Which command is used to display lines of source code in gdb debugger?

display

pwd

display current working directory

This reports disk usage (i.e., the amount of space taken up by a group of files).

du

The directory "a" contains its subdirectory "b" and there is no other entry in the directory "a". You want to display "the contents of directory a are: b". The contents are to be displayed using "ls" command. Which command helps you accomplish that?

echo "The contents of directory a are: `ls a`"

There is a variable "var". Its value is set to the number 5. If one tries to print "The value: 5". Which one of the commands will do that?

echo "The value: $var"

The file "assign4.html" has permissions set as: "r w x r w x r w x". This means what ?

everyone can read, write, and execute the file

This (utility) evaluates an expression and sends the result to standard output

expr

(T/F) Consider a file abc which can be "read, write, execute" only by the owner. After the command "chmod o+x abc", the file "abc" is executable by group.

false

(T/F) The command "grep -i hello" prints all the lines in file, not containing the string "hello".

false

(T/F) The command pwd is normally used to change the password.

false

The command history prints ALL the commands you typed.

false

This displays the classification of a file

file

This is most commonly used to find all of the files that have a certain name.

find

_____ is a very powerful tool and command, searching through the system or just current directory, locating all or certain files or directories.

find

This command is to find all '*.txt' files in the current directory you are in and any sub-directories,

find . -name "*.txt" -print

This is ___ to find files with a permission of ____ which is "read, write and executable" by owner and "read and execute" by everyone else.

find . -perm 755 -print

To find files that are over 10 blocks in length (that's 512 bytes a block) use:

find . -size +10 -print

To find files that are over 10 bytes in length using the character format use:

find . -size +10c -print

To find files in /var/adm directory that have not been modified in the last five days:

find / -mtime +5 -print

To find all files that have been modified in the last five days:

find / -mtime -5 -print

This find command does find all the ordinary files and then test each file for its type

find / -type f -print | xargs file

This is to find all the files in the /apps directory but do not search in /apps/bin:

find /apps -name "/apps/bin" -prune -o -print

To find all files but not directories in /etc

find /etc !-type d -print

This find command does find first for all 'passwd*' files, for example passwd, passswd.old, passwd.bak, then runs grep to see if there is a user 'richard' located in the files.

find /etc -name "passwd*" -exec grep "richard" {} \;

To find all directories in /etc

find /etc -type d -print

To find all symbolic linked files in /etc:

find /etc -type l -print

This find command does find all ordinary files older then 7 days in /var/logs and delete them.

find /var/logs -type f -mtime +7 -exec rm {} \;

This utility displays the usernames of users, together with their full names, terminal device numbers, times they logged in, and other information

finger

Creates a process by spawning a process

fork

Which of these is not a common UNIX shell discussed in class (or textbook or lecture)? bash sh fresh ksh

fresh

This utility verifies the integrity of a filesystem and reports on and optionally repairs problems it finds.

fsck

Sets the specified permissions to those of the group

g

This ___ will compile C and C++ programs

gcc

This searches for a pattern in files

grep

What is the command to search all files in your current directory for the word "hello"?

grep hello *

This displays the beginning of a file

head

How do you print the first 15 lines of all files ending by ".txt"?

head -15 *.txt

man

help manual

A user issues the following command sequence: $ a.out & $ bash $ a.out & If the user kills the bash process, then

init process becomes parent of second a.out process

If a program executing in background attempts to read from the default STDIN (that is, keyboard), then

its execution will be suspended

This reports any programs that you suspended and still have running or waiting in the background

jobs

This joins lines from two files based on a common field

join

Use this as a last resort to destroy any jobs or programs that you suspended and are unable to restart

kill

This displays text files, one screen at a time

less

This lets you read text without it scrolling quickly off your screen

less

ls

list filenames and directories

This makes a link to a file

ln

This sends files to printers

lpr

Displays information about one or more files

ls

This lists all of the files within a directory and its subdirectories that match a set of conditions

ls

To list the permissions on files, which of the following commands will work?

ls -l

To output only the permissions of the files in the working directory, which of the following commands will do it?

ls -l | cut -c2-10

Count the files that you own in all your directories (where your userid is myusername)

ls -lR | grep myusername | wc -l

To match all your .files (that is, any hidden files begins with a period).

ls .*

To list filenames where the first two characters can be any character, followed by an 'R', followed by any string:

ls ??R*

To match filenames that start with 'CPP', followed by any two characters, followed by any non-digit string:

ls CPP??[!0-9]*

To match filenames that start with 'CPP', where the next two characters can be anything, but the next character must be a '1':

ls CPP??[1]

To match only numbered filenames use:

ls [0-9]*

To match filenames starting with an upper case letter only:

ls [A-Z]*

To match filenames starting with a lower case letter only:

ls [a-z]*

To list all filenames that start with an 'i' or 'o':

ls [io]*

To match all filenames that start with 'f', followed by any two characters, followed by any string; the end character must be an 's':

ls f??*s

To list all filenames (log followed by some string) but with no numbers.

ls log.[!0-9]*

To match filenames that begin with 'log.', followed by a single number, followed by any character (including none).

ls log.[0-9]*

Mail utility that POSIX requires all unix systems to support is

mailx

Which command/tool is used for building and maintaining groups of programs from source code?

make

mkdir

make a directory

How do you get help about the command "cp"?

man cp

Which command is used to create the directory "abc" in the previous (parent) directory?

mkdir ../abc

How do you create a new directory called "flower"?

mkdir flower

Creates a filesystem on a device

mkfs

In Unix, if you wanted to allow a user to modify file permissions in a directory, you would give the directory what permission?

modify

This displays the contents of a file one screen at a time, waiting for you to press the Spacebar between screens

more

Which of the following is not a benefit of the fact that many UNIX commands operate on plain ASCII text files? the same file can be used by many programs output to the terminal and to files can be done in the same way most current UNIX installations have a graphical user interface these commands can be used as filters for the output of other commands

most current UNIX installations have a graphical user interface

mv

move a file to another location

Renames or moves a file

mv

To rename the file "a.html" to "b.html", which command do you use?

mv -i a.html b.html

How do you rename file "new" to be "old"?

mv new old

Changes the priority of a command

nice

Numbers lines from a file

nl

Runs a command that keeps running after you log out

nohup

Sets the specified permissions to those of others

o

Dumps the contents of a file

od

Opens files, directories, and URLs

open

cat

outputs content of a text file, read through brief files, concatenate files together

A command used for changing user password is

passwd

Joins corresponding lines from files

paste

Creates an archive, restores files from an archive, or copies a directory hierarchy

pax

Which one of the following methods is NOT correct for two processes to communicate each other?

pipe

Which mode of the gdb debugger ascertains the cause of the crash by examining the core files?

post-mortem mode

Process attributes are stored in

process table

ps fetches attributes from

process table

This displays information about programs that are currently running Displays process status

ps

Which of the following commands displays the full pathname of the directory you are currently positioned in?

pwd

Sets read permission

r

In Unix, the octal number "5" corresponds to which ___ file permission.

r - x

In Unix, if you wanted to allow a user to list the contents of a directory, you would give the directory what permission, at least?

read

Changes the priority of a process

renice

To delete a file called mynotes.txt, which command do you use?

rm -i mynotes.txt

Removes directories

rmdir

Securely copies files and directory hierarchies over a network

rsync

Set the user ID or group ID of the file while the file is being executed

s

Securely copies one or more files to or from a remote system

scp

A Command to record your session is

script

Edits a file noninteractively

sed

This displays or changes various settings and options associated with your Unix session

set

Creates a process that sleeps for a specified interval

sleep

Sorts and/or merges files

sort

Divides a file into sections

split

Securely runs a program or opens a shell on a remote system

ssh

Displays information about files

stat

Which command in debugger is used to execute the next statement but descends into a function?

step

What is the default datatype of variables in bash or ksh shell scripts?

string

Displays strings of printable characters from files

strings

Displays or sets terminal parameters

stty

A Command to display current terminal settings is

stty -a

Sets the sticky bit

t

Displays the last part (tail) of a file

tail

Stores or retrieves files to or from an archive file

tar

Copies standard input to standard output and one or more files

tee

Check file types and compare values

test

gzip

the utility compresses files

zcat

the utility displays files compressed with this utility

gunzip

the utility restores files compressed with gzip

The -follow option with find command is ____.

to chase down the source of the files for symbolic linked files

The -name option with find command is ____.

to find files by filename

The -user option with find command is ____.

to find files by user ownership

The -type option with find command is ____.

to find files that are a certain type

The -newer option with find command is ____.

to find files that are newer than one file but older than the other file

The -mtime option with find command is ____.

to find files that were accessed or modified some days ago

The -perm option with find command is ____.

to find files with different access or permission bits on a file

Dynamically displays process status

top

What UNIX command is used to update the modification time of a file and/or change the file's access?

touch

Replaces specified characters

tr

(T/F) Consider a file abc which can be "read, write, execute" only by the owner. After the command "chmod og+rx abc", the file abc executable and readable by all.

true

(T/F) Consider a file abc which can be "read, write, execute" only by the owner. After the following command: "chmod g+x abc", the result will be is equivalent to the result of command: chmod 710 abc.

true

(T/F) Consider a file abc which can be "read, write, execute" only by the owner. The result of the following command "chmod 700 abc" is equivalent to "chmod og-rwx abc"

true

(T/F) Consider a file abc which can be "read, write, execute" only by the owner. The result of the following command "chmod og+rx abc" is equivalent to the command "chmod 755 abc"

true

(T/F) The command "grep hello file" prints all lines in "file" that contains hello.

true

(T/F) The command "ls" lists the contents of a directory.

true

(T/F) UNIX supports a hierarchical directory structure.

true

This command shows which version of a particular command(example: echo) will be executed.

type echo

What is the effect of the command alias up2="cd ../.."?

typing "up2" at a shell prompt takes you up two levels in the directory tree

Sets the specified permissions to those of the owner

u

Specifies the file-creation permissions mask

umask

A Command to get the version or release of your operating system is

uname -r

Displays unique lines from a file

uniq

List the format of the passwd file in order:

username, password, user identifier, group identifier, gecos (comment), home directory, shell

Displays information about local system users

w

If you use this, you also get a list of what they are doing and who is doing it.

w

Sets write permission

w

Displays the number of lines, words, and bytes in one or more files

wc

Shows where in PATH a utility is located

which

Displays information about logged-in users

who

If you use this, you also get the IP numbers or computer names of the terminals they are using.

who

A Command to get your userid is

who am i

^

will match the beginning of the line only

$

will match the end of the line only

Sets execute permission

x

Converts standard input to command lines

xargs

When creating a directory as an ordinary user, what is true?

you must be in your home directory or in one of its subdirectories

When parent process doesn't wait till child's death, the child enters into a

zombie state


Conjuntos de estudio relacionados

Healthcare Accounting and Budgeting

View Set

Economics Chapter 4 Practice Exam

View Set