Instructions: Answer the following questions one at a time. After answering each question, check your answer (by clicking on the check-mark icon if it is available) before proceeding to the next question.
Getting Ready: Before going any further, you should:
[Enter]
refers to the "Enter" key.
[Tab]
refers to the "Tab" key.
[Down Arrow]
, [Up Arrow]
, etc... refer to the
down arrow key, up arrow key, etc...
[Ctrl]
refers to the "control" key and [Ctrl]+k
means that you should press the "control" key and the "k" key at the
same time.
The phrase "Enter the command xyz" means that you should type xyz
in the terminal/command-shell window and then press [Enter]
.
pwd
mkdir cs
cd cs
pwd
mkdir labs
cd labs
cd ~
will change the directory
to your home directory.)
javac Tripler.java
to compile
the source code.
java Tripler
to execute the
byte code.
java Tripler
.
cat test1.inp
to see the contents of the
file named test1.inp
. (More on this command later.)
java Tripler < test1.inp
.
#!/bin/bash java Tripler < test1.inp java Tripler < test2.inp
and note that each of this lines is a valid BASH command.
tests.sh
in the directory
that contains Tripler.class
chmod +x tests.sh
to make this file executable.
./tests.sh
java Tripler > test1.out
.
10
and press cat test1.out
.
test1.exp
(the expected correct output)
and test1.out
.
Tripler.java
so that it no longer produces the correct
output, run the program again (again redirecting the output to a file),
and compare this output with the expected output.
chmod
command to make the .in
and
.exp
files read-only. For example,
chmod a-w *.in
will remove write access on all files
that end with .in
for all users.
nkdir skills_bash
(Note: This is
nkdir
not mkdir
!)
[Up Arrow]
key (or [Ctrl]+p
).
[Ctrl]+a
[Ctrl]+e
[Ctrl]+a
to go back to the first character.
[Ctrl]+d
[Enter]
cd ~
pwd
skills_bash
directory.
Save yourself some work by entering the command cd -
(which takes you back to the previous directory).
cd ..
pwd
skills_bash
directory.
Save yourself some work by typing cd sk[Tab]
(which tries to "complete" the directory name that starts with s).
[Enter]
to change to the skills_bash
directory.
pdw
but do not press [Enter]
. (Note:
This is pdw not pwd.)
[Ctrl]+t
to "twiddle" the last two characters.
[Enter]
.
mkdir temporary garbage
but do not press
enter.
[Ctrl]+w
[Enter]
.
pwd
(to see the name of the
current working directory).
ls
(to list all of the files
in this current working directory).
temporary
directory using
the rmdir
command. You could use the [Up Arrow]
a couple of times to re-type the mkdir
command. However,
save yourself some work by typing [Ctrl]+r
but
do not press [Enter]
.
[Ctrl]+a
to go to the first letter of the command.
[Ctrl]+d
twice to delete the m and k.
rm
to insert the letters r and m.
[Enter]
.
cd
(or cd ~
)
to move to your home
directory.
ls
ls -l
ls > filenames-short.txt
(which
will redirect the output of the ls
command to a file named
filenames-short.txt
)
ls -l > filenames-long.txt
(which
will redirect the output of the ls -l
command to a file named
filenames-long.txt
)
ls -R > filenames-all.txt
(where
the -R
option instructs the ls
command to
look in all subdirectories)
ls filenames*
(where the * is called the
wildcard character).
filenames-long.txt
and
filenames-all.txt
to the directory for this lab.
Save yourself some work by entering the command
mv filenames-{long,all}.txt cs/labs/skills_bash
[Tab]
key to
avoid having to type the directory names?
ls filenames*
rm filenames-short.txt
skills_bash
directory.
ls
command by
entering the command
man ls
. (Note: You can get help on how to use "manual pages"
by pressing h
. [Ctrl]+n
and
[Ctrl]+p
work as expected, q
will quit/exit,
/
and ?
can be used to search forward and
backward.)
clear
command do? (Hint: Use the "manual
pages".)
cat
command do?
grep
command do?
less
command do?
sort
command do?
apropos
command do?
filenames-all.txt
file by entering the command
cat filenames-all.txt
. (Note: Make sure you are in the
correct directory.)
.txt
files in the current working directory by entering the command
grep Feb *.txt
less
command
to search for the first occurrence of the string
"Feb" in filenames-all.txt
.
cd
in the command shell window.
cmd
) and how it differs from BASH
at the course help pages.
MSYS
. Follow the instructions in the section on
the "Graphical User Interface Installer".
(You might as well install some other
programming languages while you are at it, like, Ada, C++, Fortran, abd
Objective-C. You probably won't use them now but you may use them
later.)
Copyright 2020