COP3353 Exam 2 Review
What is grep used for?
Search for a string of text in a file, even if you don't know what file to look in.
In addition to searching for text in a file, grep can also search for text in Standard Input at the command line): history prints the last hundred or so commands you entered at the command prompt. grep nano searches for all the lines that contain the string "nano". How would you combine these two commands to find only the times you entered nano at the command line, rather than all your history?
history | grep nano
When you press Enter to end a line while editing a file, Linux and Windows act differently: 1. Pressing Enter in Unix inserts _______ 2. Pressing Enter in Windows inserts ________ (CR means Carriage Return) (LF means Line Feed)
1. LF 2. CR/LF
1. sdiff is for ________ 2. diff is for ________
1. Side-by-side viewing of the differences between two files 2. Making patches
1. To make a patch, use ________ 2. To apply a patch to a file, use ________
1. diff 2. patch
What is the purpose of the operating system's "Kernel"? (The Kernel performs a function. What is the Kernel really? A two-word answer would do nicely.)
A *virtual machine* in which programs run
The full-screen editor that Richard Stallman wrote is called
Emacs
The editor vi has two modes of operation, Command Mode, and Insert Mode. Command Mode is used for:
Entering vi commands, such as to save the file
Culture Question - First page of the week's first reading: We used the g++ compiler to compile our C++ source code. The letter "g" pops up all the time in the Linux world. What does the "g" in g++ stand for?
GNU, Richard Stallman's contribution to the GNU/Linux operating system
The "Unix Wars" almost killed Unix. The "Unix Wars" were competition among Unix vendors triggered by an attempt by AT&T to:
Gain commercial licensing and standards control of Unix
Why was the C language created?
It was needed for writing Unix because the other languages weren't adequate
Who originated the Linux kernel?
Linus Torvalds
The dominant Unix variant today is:
Linux
The inspiration for Unix was this operating system:
MIT Multics
The "Open Source" movement is an ideology that holds that the source-code of all computer programs should be available for anyone to use or modify. This ideology was founded by:
Richard Stallman
The alternative to Interactive Computing is:
batch processing
The acronym "GPL" means:
"General Public License" - which guarantees the freedom to study and share a program's source code
Why do we compile source code files before we can link them? Why this order?
- Because the Linker uses the output of the Compiler. Compile >> Object Code >> Link - Because the linker works with object code, not with source code. Source code files >> Compile >> Object code files >> Link >> Executable file - Because the Linker resolves addresses in machine (object) code. Object code files >> Link >> Executable file ALL OF THESE
You used touch in your homework. touch performs these functions depending on whether the filename you specified exists or not:
- Changes the file's timestamp to the current date/time - Creates a new empty file
The two steps in transforming source code into an executable file are:
- Compile - Link
In a makefile, every action line (Unix command) begins with:
A Tab character
What is a Script (also called a Shell Script)?
A program made of Unix commands.
What is an IP address?
An "Internet Protocol" network address for routing packets to their destination
When you write your own shell scripts, it's handy to place them all into one directory and add that directory's name to the $PATH variable. Why is this handy?
Because then you don't have to write out the entire path to the script, you can just type the name of the script instead, as if it was already in the directory you are currently working in.
A Linker does this:
Combines separate object files into a single executable file
There are several variations of FTP (File Transfer Protocol). The one we use is "SFTP" which is
Secure File Transport Protocol Also known as "SSH File Transport Protocol" because the connection to the remote host is authenticated and encrypted using the same mechanisms as SSH.
A compiler translates _____ into ________
Source Code --- Object Code
ARPA is the federal undertaking that funded much operating system research and development. What event triggered the creation of ARPA?
The Soviet launch of Sputnik
A dependency is:
The code in File A uses (calls) something in the code of File B. A depends on B.
Apple's operating system for its Macintosh computers (macOS, previously called OS-X) is licensed to use the UNIX trademark.
True
You can undo a patch if you change your mind.
True
You have to manually set a script's permissions to make it executable.
True
Unix was created by
Two guys with a discarded minicomputer
When Unix was passed around to anyone who asked for a copy, it massively caught on in the academic world. The institution that did more than any other to advance the development of Unix was:
University of California at Berkeley
Why do Windows and Unix use different line endings in text files?
Windows was patterned after CPM which followed the mainframe/teleprinter line ending convention composed of two characters. Unix followed the Multics convention having a simplified line ending composed of a single character.
grep is case sensitive by default. How do you make it case insensitive?
grep -i searchString filename
To examine the permissions of a file (such as the file is "executable"), use this command:
ls -l (lower case "L")
To recompile only the source code files were changed, or depend on other files that changed, you use a program called
make
How does make know that a source code file needs to be recompiled?
make compares the timestamps of the source code file to that of the compiled object code
By default, the make program gets its instructions from a file named:
makefile