|
|
CS205 Introduction to UNIX
Review for Second Quiz: Chapters 4, 5, and 6
- To start vi you can...
- click on the vi icon
- click on a file it wrote and it opens by itself
- type "vi" and the name of the file to work on
- type "run vi"
- vi is described by the book as
- a line editor
- a screen editor
- a graphic editor
- editor of a great metropolitan newspaper
- The two modes of vi are
- input and output
- input and correction
- input and command
- prickly and nasty
- Commands to vi
- are usually single keypresses
- always require you to press enter
- are executed in batch mode
- were thought up by wise Tibetan monks
- Explain what each of these keystrokes would probably do in vi:
- Escape key _______________________________________________
- the letter i _______________________________
- the letters h,j,k and l ______________________________________
- You may exit vi in several ways. Assume you want to save and then
leave vi. Which way?
- :qw
- :q
- :q!
- :wq
- vi is described by the book as
- a line editor
- a screen editor
- a graphic editor
- editor of a great metropolitan newspaper
- Explain what each of these keystrokes would probably do in vi:
- Escape key _______________________________________________
- the letter i _______________________________
- the letters h,j,k and l ______________________________________
- You may exit vi in several ways. Assume you want to leave without
saving. Which way?
- :qw
- :q
- :q!
- :wq
- vi has the ability to search for a text phrase in a document. In command
mode,
- you press :S to search
- you press / to search forward
- you press ? to search backward
- you press your rosary and pray it works
- You should know what each of these commands does in command mode:
- x
- dd
- r
- R
- To enter vi in the Read Only mode, you might type
- vi filename R
- vi filename RO
- vi -ro filename
- vi -R filename
- Like most UNIX commands, vi can take a series of arguments, like
vi file1 file2 file3 file4
What would this command do?
- open four copies of vi
- open four windows in vi, each with one file
- open vi with file1, ignoring the other arguments
- open vi with file1, holding the other files in buffers
- Pressing a command key twice, when the command can be modified by
scope, means
- carry out the command twice
- carry out the command with the default scope
- carry out the command, and ask for confirmation
- undo the last such command
- When you use the DD command the text that is cut is
- lost forever
- gone but can be brought back with a special utility
- placed in the next buffer available
- placed in Buffer 1
- The yank command
- copies from Buffer 1 and clears it
- copies from Buffer A
- copies to Buffer 1
- copies from the hard drive
- The paste command
- will paste above the current line, if a P is used
- will paste above the current line if a p is used
- will paste to the screen and clear the buffer
- will stick to your fingers: lick them frequently
- In terms of vi commands, scope means
- the programmer should stop eating garlic
- we can modify how far and which direction
- we can watch the command take place
- we can hit a target much farther away
- Buffers are important to vi. There are
- 26 numbered buffers you can use
- 10 numbered buffers you can use
- 35 buffers you can use
- very good reasons to leave the buffers alone
- vi can be customized by the user or the system administrator. The
file to save settings in is
- .vicnf
- .uservi
- .exrc
- .viset
- There are three kinds of environment settings for vi. All but
- Boolean options - either on or off
- Numeric options - set to some number value
- User options - set to do whatever the user wants
- String options - set to remember a string of characters
- The wraparound option inserts line returns. This means
- vi has the same kind of word wrap as most word processors
- lines are actually one long line that looks like many
- the user does not have to press ENTER at the end of a line
- vi will reformat the page when text is inserted
- Vi is capable of passing a command to the shell by pressing a colon
and
- the Esc key in command mode
- the Bang (!) key in command mode
- the enter key twice in text entry mode
- the r key in command mode
- UNIX considers almost everything in it to be a
- file
- tag
- pointer
- measure
- UNIX considers regular files to be
- data files only
- data files and program files only
- most files, except directories and special files
- all files except directories
- A home directory is the one
- the user spends the most time in
- the user goes to when logging in
- the user creates in an assigned directory
- the system administrator keeps everyone out of
- A current directory is
- where a user goes on log in
- where the user wants to go next
- where the user is at any given time
- where the user saves all files
- Absolute path names
- contain a reference to the root directory
- cannot contain a reference the the root
- depend on where the user is right now
- cost a buck more than regular, but are worth it
- Characters that are allowed in file names do not include
- lowercase letters
- uppercase letters
- numbers and underscores
- spaces, stars and slashes
- You should know what each of these commands will do:
- pwd
- cd
- ls -R
- rm -r
- Ls -al
- mkdir -p
- cat
- Hidden files in UNIX
- are hidden from everyone at all times
- are hidden unless you know the password
- are hidden because of a dot in their names
- cost a buck more than regular, but are worth it
- True or False:
- The vi editor is considered as a line editor.
- The vi editor modes are adding mode and delete mode.
- Some of the basic editing jobs are: entering text, deleting text,
and modifying text.
- The vi editor command mode is not case sensitive.
- The vi editor uses temporary buffers for the files you are editing.
- The commands Z and zz both save your file and exit the vi editor.
- You can start the vi without indicating the filename.
- Pressing the letter i in command mode places the vi in the insert
mode (text mode).
- One way to exit vi is to turn the terminal off.
- The command I places the text you enter at the beginning of the
current line.
- The vi editor default mode is the command mode.
- Pressing the Esc key places the vi in the command mode.
- Pressing the Esc key twice terminates the vi editor.
- Pressing the 0 (zero) key in command mode places the cursor in
the middle of the page.
- Entering 2x in command mode deletes 2 lines, starting from letter
x.
- Pressing letter R in command mode makes vi repeat the last command.
- Pressing letters U or u in text mode makes vi undo the last change/changes.
- You can start vi by giving it a list of filenames
- You can invoke vi with the ?R option to prevent accidental changes.
- vi lets you read (import) other files into your current editing
file.
- vi lets you save your entire file but not any portion of it.
- You can copy one or more lines of text from one place in your
file to another.
- vi lets you move lines from one place in your file to another.
- The vi editor uses 9 temporary buffers named 1 to 9.
- The contents of the numbered buffers are out of your reach.
- The alphabetic buffers and numbered buffers are the same buffers
named differently.
- More True and False:
- The vi editor is the only editor that UNIX supports.
- The directory structure is arranged in levels and is known as
a hierarchical structure.
- Your login name and your home directory name are usually the same.
- Every UNIX file structures has a root directory named / (slash).
- Files in your current directory are immediately accessible. Files
on the other directories must be identified by their pathnames.
- Absolute and relative pathnames are the same and indicate the
same pathname.
- If you have just logged in, your home, current or working directories
are the same.
- In UNIX filenames XYZ and xyz are indicating the same filename.
- In UNIX filename extension is absolutely necessary.
- The pwd command prints your working directory on the printer.
- The cd command returns you to the root directory.
- The invisible files are the files that only the owner can see.
- You can use only one command option at a time on the command line.
- You can use the vi editor or the cat command to look at the content
of a file.
- You can use the vi editor or the cat command to create a file.
- After the print command is issued, there is no way to cancel the
print job.
- The rmdir command (with no options) can only remove empty directories.
- The / at the beginning of a pathname stands for the root directory.
- The name .HIDDEN is an example of a hidden file.
- . (dot) and .. (dot dot) represent the current and a level higher
directories respectively
- To cancel a print job, you only have to turn the printer off.
|