User Tools

Site Tools


Boaz's spring2019 Unix Journal

Hello there…


My name is Boaz Mather and I am studying Computer Science here at CCC. I really enjoy computer programming and hope to be able to make a career out of it. I am a big fan of Sherlock, Star Wars (not the new trilogy though) and especially Tolkien (I have even begun learning a little elvish). So aside from reading on those topics, I spend most of my free time playing video games, primarily Destiny 2.

unix week13

April 25, 2019

Finished spf0 with Brenen, Justin and Benjamin. Now to get to work on the End Of Course Experience! :D

I have already done the first portion, and it was pretty easy, but I know the others won't be the same.

unix break2

March 28--April 10, YEAR

Finally finished spf0 as well as upf1.
Over break usr0 was assigned. It is a game of sorts based on knowing the proper octal values of file permissions. I need to do 196 but am only allowed 12 at a time with 2 hours in between.


'x' is worth 1 (executable)
'w' is worth 2 (write)
'r' is worth 4 (read)

There is a value that comes before the user, group and other fields. This single value gets its number from SetUID, SetGID, and Sticky Bit.

An 's' in the 'x' field of the user section ('S' if there is no 'x' under it)

An 's' in the 'x' field of the group section ('S' if there is no 'x' under it)

Sticky Bit=1:
A 't' in the 'x' field of the other section ('T' if there is no 'x' under it)

unix week12


Nearing the end now, the End of course experience was unveiled as well as the last two projects. One is to be done on my own (pwn0, creating an output table of values in different bases) and the other is a group project I am working on with Benjamin and Brenon.

For this group project we need to create several scripts that control LED's attatched to a raspberry pi

To change the modes of wiring Pins (wPi)
0-7 wPi are where the led's are plugged in

initialize by making them all mode out and off

unix week11

April 11, 2019

You can make arrays in bash with “declare” (-a makes a normal indexed array, while -A makes an associative array)

They work quite normally as compared to other languages.

When you call an array with a '*' or '@' as the index, it will expand the entire array (all of the values)

The “let” command allows you to do integer math in your variable assignments as well as use a var's old value in calculating its new value.
I.E. “let total=total+value”

But when non integers are concerned you need to echo the operation into “bc -lq” via a pipe

unix week10


Filler text- your entry goes here; remove this line to receive full credit.

unix week9

March 21-27, 2019

Continued to work on spf0 with the group (because the whole class didn't finish on the expected schedule) and I also started working on upf1. I can't seem to get the delimiters to work, I can do one, but not two.

unix week8


Working on spf0 this week with Justin, Breton and Richy.

unix break1


Add the making of the project directory to the steps file of projects.

An absolute path to a command must be given in calling it unless said path is in the PATH variable.

chmod the task files in upf0 to make executable?
Read the instructions for the project especially the steps file part.

unix week7

March , 2019

Example scripts here: /var/public/spring2019/unix/examples

Regular Expressions

Basic Regular Expresions (regex)

$ end of line
\? match 0 or 1 of the previous
. match any single symbol
* match 0 or more of the previous (prev char is part of this call)
[] match any one of the enclosed
[^ ] do not match any one of the enclosed
\< match start of word
\> match end of word

tools that use these include:
vim, grep, sed, awk

Extended regex
+ one or more of the previous

() goup
\( \) regex group

tools that use these include:
vim, egrep, sed, awk



chmod 755 for world readable and searchable
dir 701
file 604
recursive chmod (use * for files?)

wpa0 requirements
1 start, 1 final, and 9 pages in between
map from the start room
3 fails ( )
3 sub-directories ( )
4 images (1, )

Format requirements:
bold text
underline or italics
font size or color change

Ideas for wpa0
Awakened guardian
ghost image
boss image
rez image
hive image
map image


start(in base folder paths are subs) awaken with a sharp breath sitting straight up, ghost looks at you “are you ok, takes some getting used to, among other things, the powers you have now allow you to be rezed from death we gotta get a ship and get outta here” (generic for beginning and after death) [ghost image]

one way for map [image](also in base dir)

ghost points out the cabal base and strange readings from the abyss

way for guns

find armory (Cabal inside)\\
  grab grenade launcher to attack (not read info, bouncy grenades u 

way for getting to boss

dead patrol "getting close" (rasputin level devestation)\\
mess w/ terminal, call backup and get crushed by pod (enemies now 
here rez elswhere)\\

walk past\\
  get to boss\\
    punch him (you arent a titan)\\
      promptly cleaves you in two\\
    "did you say something about super powers?"\\
      flaming revolver kill everything [image], get codes,enter 
    sneak to the ship\\
    psion lookout spots you and snipes you, dead instantly\\

way for explore (death by hive)

deep abyss (dark presence)

jump straight down (miss double jump and die)(darkness supresses 

safe way down\\
  see hive bowing before green rune covered ring with wizards 
  hovering around [image] (ghost "bad feeling about this")\\
    go back\\
    get closer\\
    ear piercing screams, mostrous ogre [image] quick death, thralls 
    feed on your corpse\\

Unix Week6

Feb 26- Mar 5, 2019

Extended Command Mode -':' this enters this mode

-'set' commands

-'number' gives line numbers without adding them to the file itself
-'tabstop=(number)' sets tab length usually should be 4
-'shiftwidth=(number)' something else to do with formating, usually the same as tabstop length
-'smartindent' auto indents code
-'cursorcolumn' highlights the current column
-'cursorline' highlights the current line

Other commands
-'syntax on' color coded based on the file type

-'colorscheme (scheme)' you can tab thru the options

-'(number[,range])copy(number)' copies the first number line to the line after the second number

-'move' works the same ^^

-'(range % does all)s/(search)/(replacement)/' search and replace (normally only does it for the first occurrence, add g to do it for all)

can use regular expressions like '.' (all) '[a-z]' (all lowercase letters)

-'r' read in the contents of whatever you specify


You can add a no before some of these to turn off (i.e. smartindent)

You can call vi with more than one file to open all then cycle through with :n and :N

~/.vimrc is a config file so you can have certain settings run every time you open vi

Shell scripting

start with '#!/bin/bash' this makes sure bash runs the script

for math operations

If statement

if [ condition ]; then
elif[another condition]; then
# if preceding conditions are false commands
#do this if nothing is true

Spacing Matters
When comparing vars, spaced comparison sign
When assigning vars, no spaces near assignment operator

Other Notes

For loops preserve their variable outside the loop (so be mindful of naming)

How to generate a random number

(Between 1 and 100)

How to receive input
read (var for storage)

- 'break' will break a loop in the middle

Double parentheses is a pocket of arithmetic

How to check for additional command line inputs
if [ ! -z “${1}” ]; then (if the additional argument is not nothing)

unix week5

Feb 26, 2019


if [condition]; then
#stuff happens for when you run it

#stuff that always happens


for ( (variable;condition;increment) ); do

(the greatest text editor known to man…)

-'vi (filename)' starts editing
-'vi (line number) (filename)' this will open the file on that line

Vi is a moded editing system, invented before the mouse and when keyboards had less keys.


Command mode
- This is the starting mode
- All other modes are accessed from here
- Escape usually brings you here
- Nearly every key stands for a command
- (see below for commands)

Insert mode
Typing of text happens in this mode
These are some ways to start insert mode from command mode:
-'i' starts insert mode (starts before the current cursor position)
-'I' starts insert mode (starts the cursor at the beginning of the line)
-'a' starts insert mode (starts after where the cursor is)
-'A' starts insert mode (starts the cursor at the end of a line)
-'o' starts insert mode (starts by creating a new line under the cursor line)
-'O' starts insert mode (starts by creating a new line above the cursor line)

Other Commands
-'v' for visual mode (for selecting large portions visually)
-'/' starts a search (like a man page)
-'h' moves cursor left
-'j' moves down
-'k' moves up
-'l' move right
-'w' moves right one word (w counts . : and the like, but W only spaces) [e does the same but to the end of the word]
-'b' moves back a word (b, B like w and W)
-'{' and '}' navigates by paragraph
-'(number)G' goes to that line number
-'~' toggles the case where the cursor is

-'yy' yank line (copy, there are multiple buffers use “(letter) to select)
-'dd' cut line
-'cc' change line
-'p' is paste (P like o and w)
-'x' deletes by character
'y', 'c' and 'd' can be used to do by any amount (word line etc)
i.e. #yl yanks # of characters to the right
-'.' repeats the last command
-':wq' saves and exits
-':q!' exits without saving

You can prefix many of these commands (i.e. with numbers for repitition)

unix week4


ps aux | grep tet
shows how many people are playing tetris ;)

Some commands have slightly different behavior when the absolute path is called.

-a for ls shows files that start with a .

In /var/puclic/spring2019/templates there is .Xsession a file that configures the display and window manager of the terminals
You can use comments to choose which one you want
fvwmrc file determines how the fvwm manager works and displays

.bash_history is where the command history (up and down arrows) comes from


Look at the man page for bash under prompting, these can be used when reassigning PS1 (the normal prompt)
If you like the changes then apply the changes in this file

Change mesg n to always turn messaging off

You can tell it to always tag a -a to the end of ls
You can make your own command shortcuts with alias both inside and outside this file (only will be saved when inside the file)
Like to always enable mouse support on nano.

See also .ssh

Control Commands:
“^d” signifies end of file
“^c” interupts the currently running process
“^a” moves to beggining of the line
“^e” moves to the end
“^h” is backspace
“^g” is the ding sound
“^k” deletes from your cursor to the end of the line
“^s” stops all output
“^q” turns is back on
“^r” starts a past command search, type what you are looking for and it will begin to show you (use ^r to show the past match)
“^t” swaps characters
“^u” deletes from the cursor to the beginning of line
“^v” can be used to capture things like ^g (like for using it in a script)
“^z” pauses a program

links2 is a text based web browser
wget is a non-interactive network downloader (downloads the files found at the given URL)
curl is compatible with more protocols tho

ps shows your running processes
kill -l shows ways to kill
-1 hangs up like a phone
-2 is like ^c
-3 is like pressing close
-9 is the all-powerful kill nothing can stop it (use it sparingly, interupting some processes can corrupt data)
-19 is like ^z

unix week3



Tutors: Rana TR 12:30-5:00 CHM123
MW 12:30-2:20 CHM125

Ben MWF 1-3 Learning Commons


Got some games here: '/usr/games'

Some Commands and things:

'write (name [tty])' send a message
'mesg (y/n)' to turn messages on or off for your terminal
'status (classname) [detail]' used to show info about your classes and scores
\ toggles the meaning of the next character (like with enter to continue the command line)

Unix Quotes: “ ” half quotes variable expansion
' ' full qotes literal quote, NO expansion
` ` or $() back quotes command expansion

They are unique to the terminal

Setting (declaring)
no ^ spaces around it

Expand (access)
example: echo “name's value is ${name}”

Command expansion [` `] allows commands to be stored in variables or called directly in a line
example: echo “there are `usr/bin/who | wc -l` users online”

? match 1 of any character
* match 0 or more of any character
[ ] match 1 of any enclosed characters (character class)
[^ ] do not match 1 of any of enclosed characters (inverted character class)

? examples:
ls ??? (Lists all files 3 characters long)
ls c?? (Lists all 3 letter files starting with c)

* examples:
ls c* (Lists all files that start with c)
ls *c* (Lists all files with a c in them)

[] examples:
ls [ct]* (Lists all files starting with c or t)
ls [c-h]??? (Lists all files starting with c through h that are 4 characters long)

[^ ] example:
ls [^aeiou]* (Lists all files that don't start with a vowel

unix week2

January 24, 2019

Unix is a multi-user, multitasking os
And the class uses a customized version of linux debian

Unix Philosophy:
-Everything is a file
-Small is beautiful
-Do one thing and do it extremely well

Types of files:

Various Symbols and Options:

'.' means current position
'..' means previous dir
'~' means home dir
'-l' option for listing info
'-v' for verbose, explain what is going on
'-f' to force command without prompt
'-i' to give you a descriptive prompt
'/dev/null' a place you can redirect things to to discard them

Various commands:

-'man' for manual (can add option to search manual for)

  1. '/' to search and use 'n' and 'N' to go to next an previous instances of search

-'touch' makes a file
-'echo' displays things to terminal
-'cat' show what is in a file
-'mv' when both options are same type it renames, but can be used to put a file in a dir

Redirecting data:
<,«,«< STDIN file for input (keyboard)
1>,1»,1»> STDOUT file for output (terminal)
2>,2»,2»> STDERR file for

Single for write (overwrite)
Double for append (new line when used with echo or cat)

Managing File Permissions:

When using 'ls -l (filename)', the first character of output shows the file type:

'-' for regular regular files
'd' for directory directories
'l' for link
's' for socket special files
'p' for pipe
'b' for block
'c' for character device

The next three represent the user's permissions
The next three are for the group
And the last three for other

Each space shows a permission on that file for that user/group/other

'-' nothing 0
'x' execute/search 1 these are the
'w' write 2 octal permissions
'r' read 4

Octal permissions are added together for each section and put together to make a code to use with the
'chmod (permission, filename)' command to change permissions
(i.e. 600 = “- rw- — —” read\write only for user)

'tty' shows your terminal number found in /dev/pts
Then you can ls your number from that directory and chmod the permissions (changing write for group disables messages)

The Pipe: '|'
It uses the output of the left side as input for the right

1. Only use non-interactive commands
2. Only commands that make standard output on left
3. Only commands that use standard input on right

Commands commonly used with a pipe are:

'more' stops output at the end of a page
'less' same as more (but way better) allows more control of view and for searching
'wc' shows info, lines, words, characters (-w for words -l for lines and -c? for characters only)

unix week 1

January 22, 2019

How to claim participation points:

-type: wcp unix wcp(week number)

How to get into the class chat

-login to lab 46

-type: screen -ls

-if no sockets type: screen

-type who

-type: '^A' then: 'd' to detatch

-type: 'screen -r' to reatatch

-type: 'irssi'

-type: '/connect irc'

-type: '/join unix'

-use alt and a number to switch channels

Other various commands

-pwd (lists current directory)

-cd with dirictory name (change directory, alone for home, .. for last)

-hg add (alone adds all, tag filename to the end to add that file to repo)

-hg status (shows status of files in dir)

-hg commit -m “text here” (tracks changes with a comment)

-hg push (adds commits to repo)

-mkdir to make new directory

journal/spring2019/bmather2/start.txt · Last modified: 2019/01/21 12:06 (external edit)