-
By default, which account is the owner of a file or directory?
the account that created it
-
Name the three types of access permissions.
read, write and execute
-
Name the three categories of accounts which are used in assigning access permissions.
owner, group, everyone else
-
What is a process?
a running program
-
What does a program do just before it stops running?
it sends an exit status to the shell
-
What does an exit status of 0 mean?
it means that the program encountered no errors
-
By default, where does Standard Input come from?
the keyboard
-
By default, where does Standard Output go?
to the screen
-
By default, where does Standard Error go?
to the screen
-
What does the PATH shell variable contain?
the list of directories the shell must search
to find the file to run a command
-
If you have a copy of the executable script
bother.sh in your current directory,
what would you type at the command line to run this script in the
background?
./bother.sh &
-
If a command is running in the background, can it take input from the keyboard?
no
-
If you wanted to run the executable file backup.sh in your current directory,
but wanted the error messages to disappear, what would you write at the command line?
./backup.sh 2> /dev/null
-
What would you write on the command line to create the GLOBAL
variable named school and set its
value to UMass Boston.
export school="UMass Boston"
-
What parameter gives the total number of arguments passed to a script from the command line?
#
-
If you wanted to use the value of the variable team inside
quotes, what kind of quotes would you use?
double quotes, ""
-
Name the three things that can be completed at the command line by hitting Tab.
pathnames, commands, shell variables
-
What would you write at the command line to define the alias
ll
whose value was
ls -l
?
alias ll='ls -l'
-
Does the command that follows
if
need to be test
?
no, it can be any command that returns an exit status
-
What do [ and ] mean when used in an
if
statement?
they stand for the test
command
-
Look at the diagram at the back of this exam.
Assume that you are in the directory ghoffman.
Write the ABSOLUTE pathname you would use to reference the directory
proj1 inside the directory jimbo.
I do not want a command, just the pathname.
/home/jimbo/proj1
-
Look at the diagram at the back of this exam.
Assume that you are in the directory it116
under the directory work under the
directory home.
Write the RELATIVE pathname you would use to reference the directory home.
I do not want a command, just the pathname.
../../home
-
Look at the diagram at the back of this exam.
Assume that you are in the directory proj1 inside jimbo.
Write the RELATIVE pathname you would use to reference the root directory.
I do not want a command, just the pathname.
../../..
-
Look at the diagram at the back of this exam.
Assume that you are in the directory home.
Write the RELATIVE pathname you would use to reference the directory it116
under the directory work.
I do not want a command, just the pathname.
ghoffman/work/it116
-
Assume that you are in a directory that contains the files listed at the bottom
of the diagram at the back of this exam.
What ARGUMENT USING META-CHARACTERS would you give to ls
to list all files with an .sh extension in this directory?
I do not want the full command, just the argument to that command.
*.sh
-
Assume that you are in a directory that contains the files listed at the bottom
of the diagram at the back of this exam.
What ARGUMENT USING META-CHARACTERS would you give to ls
to list all files whose name starts with "foo" followed by one character in this directory?
I do not want the full command, just the argument to that command.
foo?.txt
-
Assume that you are in a directory that contains the files listed at the bottom
of the diagram at the back of this exam.
What ARGUMENT USING META-CHARACTERS would you give to ls
to list the "bar" files 2 to 7 in this directory?
I do not want the full command, just the argument to that command.
bar[2-7].txt
-
Write the format string you would give to
chmod
to
give a FILE the following permissions.
Give the owner read, write permissions.
Give the group read permissions.
Give no permissions to anyone else.
I just want the format string NOT the whole command.
640
-
Write the format string you would give to
chmod
to
give a DIRECTORY the following permissions.
Give the owner all permissions.
Give the group permission to see the contents of the directory.
Give everyone else the permissions to cd
into that directory .
741
-
Write the SINGLE the command you would use to change the name of the file
foo.txt to bar.txt.
mv foo.txt bar.txt
-
If you ran the script bother.sh as shown below,
what command would you use to stop this script?
$ ./bother.sh &
[1] 26422
kill 26422 or kill %1
-
Write the command you would use to test whether the value of the variable
number was equal to 0.
test $number -eq 0 or [ $number -eq 0 ]
-
Write the command you would use to find all the lines in the file output.txt
which contain the word "grape" but NOT the word "red".
grep grape output.txt | grep -v red