-
What is the difference between a program and
a process?
-
For each process created by the following command line:
1) identify which portion of the command-line created that
process, 2) give the argv vector for that process, 3) describe
stdin, stdout and stderr for that process. (See
this example
from the lecture.)
cat eliza | tr -s a
-
For each process created by the following command line:
1) identify which portion of the command-line created that
process, 2) give the argv vector for that process, 3) describe
stdin, stdout and stderr for that process. (See
this example
from the lecture.)
cd tmp ; ls -l foo
-
For each process created by the following command line:
1) identify which portion of the command-line created that
process, 2) give the argv vector for that process, 3) describe
stdin, stdout and stderr for that process. (See
this example
from the lecture.)
ps -ef | grep -v crabbe > tmp.txt
-
For each process created by the following command line:
1) identify which portion of the command-line created that
process, 2) give the argv vector for that process, 3) describe
stdin, stdout and stderr for that process. (See
this example
from the lecture.)
./foo -v < dat1 > res1
-
Write a single command line that would write out the number of processes
currently running on a system. Note that
ps -ef
writes a list of all processes currently on the system. Also
note that I won't hold it against you if you're off by one.
Finally, you must actually run this command and see the
result. If you haven't tried it out in a terminal, please
don't write down an answer.
-
Suppose your user name is tonks, and there are three different files
called
wc are readable by
you: /bin/wc,
/home/tonks/bin/wc, and a wc in your
current working directory ~/foo/wc.
which gets executed by the shell if your path is:
/bin:/usr/bin:/home/tonks/bin
How would you change your path so that ~/foo/wc
gets executed instead?
-
There is a special "file" in the filesystem called
/dev/null. It's essentially a black-hole for
data. If you want to run a command but not see any output,
you can redirect the command to /dev/null. Now, why would you
want to do something like that? Here's an example: Suppose I
want to time how long it takes for the system to get a list of
all the files in my homedirectory -- including subdirectories, --
-- sub-subdirectories, etc.
Well, the command ls -R ~ lists every file,
that's fine. And the command time ls -R ~
actually displays how long ls -R ~ takes.
However, it prints loads of stuff to the screen, and I don't
really want to see the list, I simply want to know how long it
takes to generate. I can run this instead:
time ls -R ~ > /dev/null
... and I'll get the timing information but nothing will
print, no files will get created, nothing ... all the results
just die in the black hole that is /dev/null.
Here's another reason to use /dev/null. Suppose
I don't want error messages for a command to print? I could
accomplish this by redirecting stderr to
/dev/null. The command rm ~wcbrown/ggg
prints an error message:
bear[~]> rm ~wcbrown/ggg
rm: /home/wcbrown/ggg: No such file or directory
Do a Google search to find out how to
redirect stderr in bash, and write
down a modified version of rm ~wcbrown/ggg
in which no error messages are printed because
stderr is redirected to
/dev/null.
Note: You must actually try this out on an actual command
line and verify that the error message was supressed. If you
don't actually try it out on the command line and see that it
works, I don't want you to give me an "answer".