Unix Operating System
The first line in any shell script begins with a _____
#
Which of the following symbol is used with chmod to assign permission to a file?
+
Which of the following symbol is used to indicate the absence of a permission of a file?
-
Which option is used with rm command for interactive deletion?
-i
Which option is used for displaying the line numbers containing the pattern along with lines?
-n
Which option is used for counting the number of words in a file only?
-w
What kind of interface do you use to interact with Unix tools
A Command Line Interface
____ key is used for switching to command mode from input mode
Esc
What if the destination file specified in mv command (file renames) already exists?
It will be overwritten
If you type nothing at the prompt and you press Enter, what happens
No command is executed and you get a new prompt under the old prompt
It's very important to note that any commands under a target must be indented with a _______.
Tab
What does the exit status of a program indicate?
The exit status of a program indicates whether the program was executed successfully or whether an error occurred.
What directory does your shell start in?
The home directory
What's the purpose of the local keyword?
The local keyword allows you to assign the value of a variable within a function without changing the global value of that variable.
The path that is printed as the result of the pwd command is
The path to the working directory
Which of the following are requirements for variable names?
The variable name starts with a letter. Every character in the name is lowercase.
What would be printed to the console as the results of the following commands? echo 'Todo list:'>todo.txt echo '-Email Jeff'>>todo.txt cat todo.txt
Todo list: -Email Jeff
The commands are only run when the dependencies or change, or when the target doesn't exist at all, in order to avoid running commands unnecessarily. T/F
True
The following command will match 'Agarwal', 'agarwal' and 'agrawal'. grep "[aA]g[ar][ar]wal" emp.lst T/F
True
We can delete multiple files using a single rm command, T/F?
True
Wildcards are special characters which are used to replace or represent one or more characters. T/F?
True
Which editor is used by the UNIX system to edit files?
Vi
What is one reason you might want to modify the PATH environmental variable?
You can add a directory containing your own programs to the PATH which allows you to access them on the command line.
Which of the following symbols are used for matching a pattern at specified locations?
^ and $
Which character is used to replace 'ugo' string in chmod command?
a
What is a shell script?
a file containing a series of commands
One of the most common commands used in a ~/.bash_prole is the _______ command, which creates a shorter name for a command.
alias
In order to simplify the make experience, we can create a rule at the top of our makefile called ______ where we can list all of the files that are built by the makefile
all
Bash has a very handy tool for creating strings out of sequences called _________________, which uses the curly brackets and two periods { .. } to create a sequence of letters or numbers.
brace expansion
The command to go back to the home directory from any directory is:
cd
Which of the following files will not be deleted using "rm chap??"?
chactd
The cd command...
changes the current directory
Which of the following files will not be listed using the following command? ls chap0[1-4]
chap05
Which command is used to change the permissions of a file?
chmod
To remove write permission from group and others, which one of the following commands will be used?
chmod gow file01
To assign execute permission to the user (owner) for a file named file01.txt, which of the following command will be used?
chmod u+x file01.txt
What is the function of cp command in UNIX?
cp is a command used for copying files and directories
Which command is used to display the differences between files?
diff
When you want to retrieve the value of a variable in Bash programming you must use the ________ before the name of the variable
dollar sign ($)
In bash programming, conditional expressions are always between __________________
double brackets [[ ]]
Providing a backslash (\) before the wild card to remove its special meaning is called _____
escaping
-a option is used with ls command for what purpose
for showing all the files including hidden files
Which one of the following command is used for searching for a pattern in one or more file(s)?
grep
We can use _______ command to track all of your recent commands.
history
Which one of the following key is used to switch from command mode to insert mode?
i
To run the make utility, what file must exist in the directory where you are compiling?
makefile
Which of the following commands can you use to create a new directory
mkdir
Which command is used for renaming files?
mv
What does the following command do? $ vi file001
open file if it exists else creates a new file
The exit status of a program is an integer, the exit status of the last program run is stored in the
question mark variable $?
Permissions of a file are represented by which of the following characters?
r,w,x
Which command is used for making the scripts interactive?
read
Which command is used for removing/deleting files in UNIX?
rm
To remove the file named my document.txt, which one of the following commands will be used?
rm my\ document.txt
In order to make the changes to our bash prole take eect, we need to use _________ command to run the bash prole in the console.
source
To get all of the elements of an array, you need to use a ________ between the square brackets.
star *
What is printed to the console by the following command? my_name=sean [[ $my_name =~ ^s.+n$ ]] && echo t || echo f
t
Which of the following commands can you use to create a new file?
touch
How can we copy an entire directory under another directory?
using r option
Which command is used for counting words, lines and characters in a file?
wc
Which of the following symbol can be used to take the output to another program?
|
The _______ le lists commands we've used in the past.
~/.bash_history