DANIEL O'BRIEN'S HUMBER GAME PORTFOLIO

UNIX OPERATING SYSTEMS (2008)








INDEX
WEB & DATABASES

TYPED: 02/16/2015
ORIGINAL DATE: 09/15/2008

[][][][][][][]][][]][][][][][][][][][][][][][][]

PuTTY UNIX (Eunichs)

[][][][][][][]][][]][][][][][][][][][][][][][][]


LEGEND

These are lecture papers from 2008
Redacted Personal Information is Symbolized with #####
each command is separated with a
------------------------------------------------

and underneath, additional notes with each command
is within a set of ()

we learned about the history of UNIX and UNIX System V
during first lecture

[][][][][][][]][][]][][][][][][][][][][][][][][]

ACCOUNT CMDs

[][][][][][][]][][]][][][][][][][][][][][][][][]


------------------------------------------------
ls (Lists)
------------------------------------------------

------------------------------------------------
cd (Changes directory)
------------------------------------------------

------------------------------------------------
more passwd
------------------------------------------------

------------------------------------------------
q
------------------------------------------------

------------------------------------------------
cat passwd
------------------------------------------------

------------------------------------------------
grep
------------------------------------------------

------------------------------------------------
grep hello
------------------------------------------------

------------------------------------------------
cat passwd | grep #######
------------------------------------------------

------------------------------------------------
cat passwd | grep ########
------------------------------------------------

------------------------------------------------
wc word count
------------------------------------------------

------------------------------------------------
cat passwd | wc (This counts accounts)
------------------------------------------------

------------------------------------------------
cat passwd | grep students | wc -l (This counts student accounts)
------------------------------------------------

------------------------------------------------
cat passwd | grep students | grep -v disabled | wc -l (Count enables student accounts)
------------------------------------------------

------------------------------------------------
echo (Put quotes to make it 1 argument
------------------------------------------------

------------------------------------------------
cp /etc/passwd . (Dot symbolizes extensions)
------------------------------------------------

------------------------------------------------
mv passwd public_html (mv Moves)
------------------------------------------------

------------------------------------------------
cd public_html
------------------------------------------------

------------------------------------------------
mv passwd passwdFile
------------------------------------------------

------------------------------------------------
mv passwd "passwdFile_"
------------------------------------------------


------------------------------------------------

COMMANDS THAT ARE DANGEROUS
THESE ROLL THROUGH AND ERASE EVERYTHING

rm -r *

rm -r * .*

(Dot symbolizes extensions)

------------------------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

MAIL

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 09/22/2008
Redacted Personal Information is Symbolized with #####

Hi Scott
My real name is Daniel O'Brien.
Today's date is Monday September 22 2008.
Your Birthday in 20 years will be on Tuesday October 17 2028.
61 people are currently online.
Your home account path is
fielder:#:###:###:Scott Fielder:/home/staff/fielder:/bin/bash.
The command I would use to give you the permission to read the letter
is chmod otr "Letter to Scott".
-------------------------------------------
echo Hi | Mail brnd0445 (brnd0445 is my account name)
-------------------------------------------

-------------------------------------------
cat "Letter to Scott" | Mail fielder
-------------------------------------------

-------------------------------------------
cp/var/spool (to copy a file
-------------------------------------------

-------------------------------------------
cat user | grep "From" | cut -d " " -f2 | cut -d0 -f1 | sort > students
-------------------------------------------

-------------------------------------------
rm/var/spool/mail/user (to remove mail)
-------------------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

TROJAN HORSE

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 10/03/2008

During this lecture we learned about
Malware and Viruses and how Trojan Horses work.
This was for educational use only.

--------------------------------------------

UNIX BOURNE SHELL TROJAN HORSE

#!/bin/sh
java -cp . echo $*

:w echo
---------------------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

TRASHCAN CMDs

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 10/10/2008

-----------------------------------------------------------

#!/bin/sh
if test !-d $HOME/.Trashcan
then
mkdir $HOME/.Trashcan
fi
if test $# -eq 0
then
echo $O: missing operand
fi
if test $# -gt 0
then
mv $HOME .Trashcan
if test $1 = -r
then
echo this is easy
fi
fi
:w demo
-----------------------------------------------------------


--------------------------------------------------

mv $*.Trashcan
$* = anything
$O = filename
$? = argument status
$# = all arguments in sequence (number)
$1
$2
--------------------------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

WEBSITE

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 10/17/2008

vi game130.html
<"html">
<"head">game130
<"body">
Here's a list of all the commands
you need to know for the test
<"br"/>
<"ol">
<"li"> ls, ls -a, ls -l, ls -c
<"li"> cd, cd path, cd., cd../../../../
<"li"> cat filename (files)
<"li"> pwd
<"li"> grep (pattern), grep -i, grep -v
<"li"> wc, wc -l, wc -c, wc -w
<"li"> man, man man
<"li"> chmod (permissions filename or name)
<"li"> who (who's online)
<"li"> mv
<"li"> finger
<"li"> sort, sort -r, sort -n
<"li"> touch
<"li"> cut, cut -d, cut -f
<"li"> format of the password file
<"br"/>
user:password:user id number:
group id: finger information:
home directory: startupshell
<"li"> mkdir
<"li"> rm, rm -r, rm -f
<"li"> echo, echo -c, echo -e
<"li"> cp
<"li"> test
<"li"> more
<"li"> head, tail
<"li"> how to edit with vi
<"li"> shell scripts
<"li"> variables $?, $*, $#, $1, $2
<"li"> if tests
<"li">



[][][][][][][]][][]][][][][][][][][][][][][][][]

TRASHBIN CMDs

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 10/20/2008

In this version, myrm is able to move
directories into my trashbin only
if the -r flag is included in my argument

-----------------------------------------------------------

#!/bin/sh
if test !-d $HOME/.Trashbin
then
mkdir $HOME/.Trashbin
fi
if test $# -eq 0
then
echo moron
fi
if test $1 = -r
then
if test -d $2
then
mv $2 $HOME/.Trashbin
else
echo moron
fi
fi
:wq
-----------------------------------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

EXPRESSIONS

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 11/07/2008

-------------------------------------------
expr 5 + 7
-------------------------------------------
expr 7 "*" 5
-------------------------------------------
expr 35 / 7
-------------------------------------------

-------------------------------------------

#!/bin/sh
VAL=0
while [$VAL -ne 10]
do
VAL'expr $VAL + 1'
echo $VAL
sleep1
done
:wq
------------------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

PROCESSES

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 11/14/2008
---------------------------------
ps (process selection)
---------------------------------

---------------------------------
ps -ef
---------------------------------

---------------------------------
ps -ef | more
---------------------------------

---------------------------------
ps -e | grep fielder
---------------------------------

---------------------------------
kill (kill process)
---------------------------------

---------------------------------
kill -l (list kill process)
---------------------------------


[][][][][][][]][][]][][][][][][][][][][][][][][]

REFORMATTER

[][][][][][][]][][]][][][][][][][][][][][][][][]


TYPED: 02/16/2015
ORIGINAL: 11/21/2008

Scott Fielder's Reformatter

#!/bin/sh
VAL=0
echo -n WARNING - Reformatting your hard drive
while [SVAL -ne 10]
do
VAL = 'epr SVAL + 1'
echo -n
sleep1
done
logout

[][][][][][][]][][]][][][][][][][][][][][][][][]

UNIX UMASK DEFINITION (COPY & PASTE)

[][][][][][][]][][]][][][][][][][][][][][][][][]


Date: 12/31/2008
Author: D.O.B

Unix UMask


umask: (abbreviated from user mask) is a command and a function in POSIX environments which sets the default permission modes for newly created files and directories of the current process. After files and directories are created, the chmod command can be used to change the permissions to allow or disallow access as before. The umask is set when you login to a Unix machine. It is, however, possible to change your umask and put the umask in your login files so that your default permissions are always set for files when you create them. Just like chmod, a umask works on a number. However, instead of the numbers being added like chmod, with a umask the numbers are subtracted from 7.
So from chmod -
Read - 4
Write - 2
Execute - 1
If a user wants all directories to be created with rwxr-xr-x, that is
Owner == Read, Write, Execute == 7 - 4 - 2 - 1 == 0
Group == Read, Execute == 7 - 4 - 1 == 2
Others == Read, Execute == 7 - 4 - 1 == 2
Then the umask would be 022
There is one important difference with the umask and files and directories - the execute part will be set on directories, but they have to be manually changed on files after the file has been created. The read and write parts remain the same. You can change your default umask using the command 'umask'. For example, the command: umask 022 Will change your umask to the permissions stated above. To make your new umask be the default for your next login, you will have to edit your .login file and place the umask command down the bottom of that file. The next time you login to your Unix system, your default umask will be set to that which you have specified in your .login file.
Modern Unix systems allow umasks to be specified in two ways:
A default permission, also called a Symbolic Umask. E.g. u=rwx,g=rwx,o=
An octal number that controls which permissions will be masked (not set) for any newly created file, e.g. 007.
In both cases bear in mind that most Unix systems do not allow new files to be created with execute permission turned on, regardless of the umask.

[][][][][][][]][][]][][][][][][][][][][][][][][]

<< E-N-D >>

[][][][][][][]][][]][][][][][][][][][][][][][][]


Website By Daniel O'Brien 2008 2017