Updated: 2017-11-22 04:24 EST
You will elect a student Class Representative from among your classmates in each of your CST8207 theory classes on Monday September 11 (section 010 and 030) or Tuesday September 12 (section 020). (That’s one student representative elected in each section.)
Students who would like to be candidates for election must be ready to put forward their names in their CST8207 theory class on Monday or Tuesday this week (Week 3).
Details about why this position is important may be found in the Class Representative Job Description PDF.
You may also examine all the related documents.
pwd
pwd
, ls
, hidden filescd
, TAB filename completion, absolute/relative pathstouch
vi/vim, nano
head, tail
cat, more, less
head, tail
mkdir
mv
(including using ..
)cp
rm, rmdir
find
using “wildcard” (GLOB) patterns - same as shell GLOB.bash_history
fileCheck the due date for each assignment and put a reminder in your agenda, calendar, and digital assistant. Just like in the Real World, not all due dates are on the same days or at the same times.
PS1 find mkdir mv cp rm touch file
PS1 find mkdir mv cp touch file
Worksheets are preparation for your assignments. You can’t do the assignments without having done the worksheets first, and you can’t do the worksheets without having first read the Course Notes: 1. Read. 2. Worksheets. 3. Assignment.
Make notes from the worksheets on how each command works. What do the options used in the worksheets mean, for each command? (See the weekly Command List.)
Form a small study group to do the worksheets. Each person tries the example given, and you make sure you all get the same answers. Worksheets are not for hand-in; they are not worth marks; the assignments test your knowledge of the lectures and worksheets.
The worksheets are available in four formats: Open Office (ODT), PDF, HTML, and Text. Only the Open Office format allows you “fill in the blanks” in the worksheet. The PDF format looks good but doesn’t allow you to type into the blanks in the worksheet. The HTML format is crude but useful for quick for viewing online.
Do NOT open the Worksheet ODT files using any Microsoft products; they will mangle the format and mis-number the questions. Use the free Libre Office or Open Office programs to open these ODT documents. On campus, you can download Libre Office here.
These first two worksheets require you to have read File System and Pathnames:
PS1, cd, find, less, ls, man, mkdir, passwd, pwd, rmdir
cat, clear, cp, find, fgrep, history, less, man, mv, rm, sleep, touch
alias, sum, unalias
vim
vimtutor
program on the CLS.Worksheets prepare you for the upcoming assignments.
For full marks, read the Test Instructions (all the words) before your midterm tests. Put these dates into your phone! Use the Algonquin Registered Name Game link to test your name before the test. I don’t answer questions about the instructions during the test.
Tests take place in your 50-minute lecture class, not in your lab period. Each midterm test is 45 minutes long and contains approximately 45 multiple-choice questions similar to those found in Practice Tests and Answers. You must write the test in the lecture class in which you are registered.
Only two students used the wrong file name this time:
Bad file name: cal.txt
Bad file name: assignement02.txt
Two students did not upload the output of the checking program.
Please Read All The Words.
Take notes in class! Keep a pad open on your desk.
This week, we learn how to use absolute and relative pathnames and then learn how to find files.
Draw File System Diagrams on paper to understand where files are when you do the worksheets, the assignments, and the tests and exams!
See the note in Assignment #03 HTML about drawing file system diagrams on paper. Do it!
Students will have their CLS accounts disabled if they have not changed their default password. (I do not want people breaking into my machine because of you.)
See my online timetable for how to make an office appointment to see me if you want your account back.
Keep a notebook with a List of Commands in it.
- You need to write down yourself what each command does.
- Check the updated list of commands each week.
- I will check for this list in your lab periods.
- Bring your notes to class! Stop wasting time looking up commands.
You can tell whether a file system name is a directory or a file by using the file
command or by looking for a letter d
on the left in the output of ls -l
. Ordinary files are indicated by a dash -
character on the left. The first two output lines, below, are files. The last three output lines are directories.
$ ls -l /
-rw-r--r-- 1 root root 22528 Sep 4 11:01 aquota.group
-rw-r--r-- 1 root root 73728 Sep 4 11:01 aquota.user
drwxr-xr-x 2 root root 4096 Sep 3 15:57 bin
drwxr-xr-x 147 root root 12288 Sep 17 14:30 etc
drwxr-xr-x 1586 root root 36864 Sep 15 12:23 home
rmdir
command will only remove an empty directory.
The copy command cp
will not copy directories unless you use the right option. You know this option from doing Section 3 of Worksheet #03 HTML.
cp
and rename/move command mv
can both accept a directory as the destination, and will put all the source files into that destination directory using the source file name(s):
bar
is a directory, then cp foo bar
creates file bar/foo
bar
is a directory, then mv foo bar
creates file bar/foo
(and removes file foo
)bar
is not a directory, then cp foo bar
creates file bar
bar
is not a directory, then mv foo bar
creates file bar
(and removes file foo
)You learn this in Worksheet #03 HTML.
You can use pathnames anywhere you can use a file name, even for output redirection, e.g.:
$ date >date.txt # date.txt in the current directory
$ date >../date.txt # date.txt in the parent directory
$ mkdir foo
$ date >foo/date.txt # date.txt in the foo directory
$ mkdir foo/bar
$ date >foo/bar/date.txt # date.txt in the foo/bar directory
You will need to know this for Assignment #03 HTML.
The stupid nano
text editor. (Learn vim
instead!)
-name
arguments to find
find
GLOB patterns to hide them from the shell!cp cal.txt >calnew,txt # WRONG: error message from cp
mv cal.txt ../../ >cal.txt # WRONG: what is now in cal.txt ?
cp
or mv
together. These commands do not produce anything on standard output that is worth redirecting. Usually, the commands produce no output at all. Do not use redirection with mv
or cp
.cp file.txt ../../../ file.copy # WRONG
cp file.txt ../../../file.copy # RIGHT
These do not produce the same output file:
$ find . >foo ; mv foo dir/foo
$ find . >dir/foo
If the assignment asks you to redirect the output into a file in a specific directory, then only the second answer above is correct. The first answer, using mv
, will have the wrong pathnames in it.
Stop using cd
Windows People! Use pathnames! This is very inefficient:
$ cd CST8207-17F
$ cd Assignments
$ cd assignment03
$ cd topdir
$ cd other
$ cat foo.txt
This is all you need to do (using the TAB key to help you):
$ cat CST8207-17F/Assignments/assignment03/topdir/other/foo.txt
No employer wants to pay you to type six commands when one will do the job. Work smarter, not harder.
Stop using cd
Windows People! Use pathnames! This is very inefficient:
$ cd dir1
$ cd subdir
$ touch file
$ cd ..
$ cd ..
$ cd dir2
$ cd subdir
$ touch file
$ cd ..
$ cd ..
[...etc...]
This is all you need to do (using the TAB key to help you):
$ touch dir1/subdir/file dir2/subdir/file [...etc...]
No employer wants to pay you to type ten commands when one will do the job. Work smarter, not harder.
If a pathname doesn’t work, use ls
to find out why. Usually it’s because you’re spelling it wrong. Use the TAB key and the shell will complete the pathname for you, with no spelling errors.
This student below (from a previous term) didn’t do the worksheets and doesn’t know about any options to the mkdir
command. Instead of typing one command to make the directory tree, he has to use ten (!), and gets the name wrong, too. He also didn’t hear me talk about not using cd
all the time, so he marks himself as a Windows newbie. This won’t look good in a job interview:
$ mkdir 1ldIr
$ cd 1ldIr
$ mkdir one
$ mkdir two
$ mkdir one/0neOne
$ cd one
$ ls
$ cd ..
$ ls
$ mkdir two/tw0two
Don’t be this guy. No employer wants to pay you to type ten commands when one will do the job. Work smarter, not harder. Do the worksheets!
Commands to show the number of locked out IP addresses and attempts to use locked-out IP addresses in /etc/hosts.evil
:
$ wc /etc/hosts.evil
$ fgrep -c 'refused connect' /var/log/auth.log
$ fgrep 'refused connect' /var/log/auth.log | less
Count the unique locked-out addresses, and then show the top twenty:
$ fgrep 'refused connect' /var/log/auth.log | awk '{print $NF}' | sort -u | wc
$ fgrep 'refused connect' /var/log/auth.log | awk '{print $NF}' | sort | uniq -c | sort -nr | head -n 20
Password failures:
$ fgrep -c 'Failed' /var/log/auth.log
$ fgrep 'Failed' /var/log/auth.log | less
Userid failures:
$ fgrep -c 'input_userauth' /var/log/auth.log
$ fgrep 'input_userauth' /var/log/auth.log | less
You can use the whois
command on Linux to identify which country is responsible for an IP address, or use a Web Whois Lookup.
The Linux
whois
command is blocked from use at Algonquin College, except if you are on the CLS. You can’t use thewhois
command in your own Linux machines while you are on campus. Usewhois
on the CLS or do a lookup via the web interface instead.
When you are locked out, follow the directions in the notes to get your IP address re-enabled.