Upgrade to remove ads
Terms in this set (62)
The GNU rewrite of the pico editor is called nano. The feature that nano has that pico doesn't is:
Syntax highlighting for several programming language
Nano is a typical text editor, and has these characteristics
No typeface formatting such as bold or italics.
Optional language syntax highlighting.
This makes Nano handy for editing configuration files and computer language source code files.
The program that gives a full-screen interactive view of the processes running on a linux host is
top: Use top to see a full-screen interactive view of all the jobs running on the host. By default it's sorted by share of CPU that each job is consuming. You can also kill processes using top
top is used to
See all the processes running on a host.
Filter to see just your own processes.
Sort processes by how much CPU or memory resources they use.
Send "signals" to a process to shut it down.
You can signal a process to shut down normally, or signal the operating system to forcibly kill a process
To use top to see your processes, you have to know which host the process is running on. top can't see beyond a single host
To ask a process to shut down nicely, we use signal 15 the SIGTERM termination signal - but a process can ignore this signal. To tell Unix to "pull the plug" on a process we use a signal that some call the "Hammer". What signal is this?
Signal 9 SIGKILL - is the kill signal, the "kill hammer". This signal tells Unix to remove all resources from a process and delete it from the list of executing processes. Poof! Gone. A process can ignore other signals, but not Signal 9.
Use > to redirect a command's output to a file: cal > myFile
Use | to redirect a command's output to a program: cal | mail
The redirect operator > empties a file before redirecting output to it.
What's the symbol to append output to the end of an existing file
emptying it first?
> Intercepts output destined for the screen and sends it to a newly created file (or empties an existing file).
>> Appends output to the end of an existing file. (Creates the file if it doesn't exist).
ls > dirListing Creates a new file (or empties an existing one) and puts the directory listing into it.
date >> dirListing Tacks the date onto the end of our directory listing.
How many Standard Streams are there?
The "Streams" are streams of text, so there is no "standard graphics".
"Standard Error" and "Standard Output" are output streams, separated for convenience.
"Standard Input" flows into a program.
"Standard Output" and "Standard Error" flow out of a program
A File Link is
A File Link (which can be a Hard Link or a Symbolic Link) is an additional name for a file, a "shortcut" to a file.
We use a Link to cause a file:
to appear to reside in a more convenient directory.
to appear to have a different name.
The command to make a Symbolic Link is:
ln -s fileName linkName
Things to remember about the syntax:
-s is for a Symbolic Link. If you leave it out, you get a Hard Link.
The Real File is named first, the Link second
The editor vi has two modes of operation, Command Mode, and Insert Mode. Insert Mode is used for:
vi's Insert Mode is normal typing mode. When the bottom left corner of the screen says -- INSERT -- then you're in this mode
Vi's command mode
Command Mode, in which you can enter codes for functions such as undo, cut-and-paste, and save.
Command Mode has two forms: Single-key mode in which you press a letter key or control key combination; and Last-line mode in which a colon prompt appears and accepts more lengthy save and quit commands.
What is grep used for?
grep is handy when you have a bunch of files and you can't remember which is the one you need.
grep reads each file line-by-line looking for a match to the text you specify. When it finds a match, it prints the file name along with the line with the matching text.
Which is the proper grep command for searching a file?
grep searchString filename
grep is case sensitive by default. How do you make it case insensitive?
To make grep case insensitive, use the -i option, which goes right after the command.
grep -i searchString filename
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 to find only the times you entered nano at the command line?
To pass the output from one command to the input of another, use the pipe | operator.
history | grep nano
To examine the permissions (such as "executable") of a file, use this command:
To see the permissions of one or more files, use the "long" parameter of the ls command: ls -l
The permissions are the letters on the lefthand side of the display. Notice below that the file "hello" is executable, indicated by the "x" in the permissions, and the green filename coloring.
-rw------- 1 lockwood CS-Faculty 93 Aug 30 16:06 factorial.cpp
-rw------- 1 lockwood CS-Faculty 43 Aug 30 16:27 functions.h
-rwx------ 1 lockwood CS-Faculty 10388 Aug 30 19:03 hello
-rw------- 1 lockwood CS-Faculty 93 Aug 30 16:25 hello.cpp
-rw------- 1 lockwood CS-Faculty 194 Aug 30 16:26 main.cpp
-rw------- 1 lockwood CS-Faculty 241 Aug 30 16:38 makefile
can you undo a patch if you change your mind?
Use patch -R < patchFile to undo a patch. You don't have to specify the name of the file to be unpatched - it's coded within the patch file.
sdiff is for ________
diff is for ________
sdiff produces output for visually comparing differences between two files side-by-side on the screen.
diff produces output intended to be read by another program, usually patch.
To make a patch, use ________
To apply a patch to a file, use ________
diff -u originalFile changedFile > patchFile makes the patch.
patch < patchFile applies the patch. The name of the file to be patched is coded in the patchFile.
Pressing Enter in Unix inserts ________
Pressing Enter in Windows inserts ________
Pressing Enter while editing a text file in Unix (e.g. Linux & Mac) inserts a single LF (Line-Feed) character.
Pressing Enter in Windows inserts two characters: CR + LF (Carrage-Return + Line-Feed).
What is a Script (also called a Shell Script)?
An executable file that you write.
It contains commands that you would ordinarily enter at the command line.
It's handy to make a script to automate a task that you perform over and over.
A compiler translates ________ into ________
Correct. A Compiler translates Source Code Files into Object Code Files. Object code is machine code that's almost ready to run, except that addresses to other object code files aren't established yet.
These other object code files may come from source code that you wrote, or "library" files that contain functions belonging to a programming language.
A Linker does this:
Correct. A Linker reads multiple separate object code files which have been separately compiled, computes their addressing to each other, and combines them into a single executable file that's ready to run.
The two steps in transforming source code into an executable file are:
Compile - the compiler translates the source code to machine language
Link - the linker resolves addresses (calculates the addresses of function calls from one file to another)
A dependency is:
Dependency occurs when the code in file A uses (calls) something in the code of file B. If you change and recompile file B, then you must recompile file A, too.
A depends on B.
By default, the make program gets its instructions from a file named:
Makefile: Unless instructed otherwise, make looks for its instructions in a file named makefile or Makefile in the current directory
In a makefile, every action line (Unix command) begins with:
Tab: In a Makefile, a Unix command (the action line) must start with a Tab character. Make looks for this to find it's bearings.
To recompile only the source code files that were changed (or depend on other files that were changed) you use a program called:
Correct. Make: The idea behind make is efficiency; it recompiles only what is necessary.
How does make know that a source code file needs to be recompiled?
Freshness Check: Speed is the reason we use make. For maximum speed, make does the least amount of work to determine the freshness of the compiled object code.
It just compares the timestamp of the source code file against the timestamp of the object code file. make doesn't do any deep analysis.
You used touch in your homework. touch performs these functions depending on whether the filename you specified exists or not:
The touch command shows up all the time, usually to create a new, empty file. Here's what it does:
If the file exists, changes its date/time stamp to the current date/time.
If the file doesn't exist, creates a new, zero-length file.
We used the g++ compiler to compile our C++ source code. The letter "g" pops up all the time in the Linux world. What do you think the "g" in g++ stands for?
G" is for "GNU".
The full-screen editor that Richard Stallman wrote is called
Why do we compile source code files before we can link them? Why this order?
To make an executable program, we compile first and link second because linking is performed on object code, not source code. (The linker doesn't work with source code).
You write source code files.
The Compiler converts source code files to object code files (individual binary files).
The Linker combines the object files into a single executable file by setting the object files' memory addressing.
Source code files >> Compile >> Object code files >> Link >> Executable file
The linker uses the output of the compiler.
grep a file
grep -options searchSrting fileName
What piped commands do the same as grepping a file but using cat piped to grep? (Useless use of cat)
cat jw | grep bb
to make case insensitive
grep -i searchSrting fileName
What gives us line number options in grep?
grep - n example: grep -in jabberwock jw
What commands allow us search for to select only the lines containing matches that form whole words?
grep - w searchSrting fileName
To remove a patch
patch -R < b_patch
Grep - how do you print a count of matching lines?
grep -c searchSrting fileName
What command will search for all lines ending with the letter e:
grep e$ fileName
This searches the file for all lines beginning with B
grep ^B fileName
Using only grep, what is the command to display the lines of jw containing the text Jabberwock
grep -i jabberwock jw
What is a dependency?
Files the target depends on, Dependency occurs when the code in file A uses (calls) something in the code of file B
What is a text editor?
An application for typing text from a keyboard into a file
Finds files in all sub directories
Searches for strings
| - The pipe operator starts another program and sends data to it.
USE this command to return all the processes running in the system
> - The redirection operator sends
> - The redirection operator sends output to another file.
What does finger do?
returns information fields about a user's account.
To create a symbolic link use
ln -s filename linktoCreate
to create a hard link
ln exisitngFile myLinkH -hlink
ln myFile myLinkH
What is a hard link?
A hard link is a second directory entry that points to the same inode.
What is a symbolic link?
symbolic link is a second file that points to (contains the path of) another file.
s the command that changes file permissions.
What is a script?
A script is a program made of Unix commands.
Shows the difference between original and new versions of a file
A tool used to apply a patchfile
YOU MIGHT ALSO LIKE...
Chapter 10 Vocabulary Exercise
Code quiz 1
Integrated Development Environment (IDE)
OTHER SETS BY THIS CREATOR
MCAT Review test 2 Psychology
Review test 2 Chemistry / physics
review test 2 biology
Coagulation Cascade Factors