User Tools

Site Tools


opus:fall2014:jcliteur:start

Julian's Fall 2014 Opus

I am cooler than you

Introduction

My name is Julian Cliteur, I enjoy snowboarding and working with computers. I'm Japanese and Dutch. I like playing League of Legends and deleting Emperyn (Michael Gleason). I like food and sleep. I work at BestBuy's Geek Squad which is better than Staples' Easy Tech (Which is where Mike works). I am currently pursuing a Computer Information Science degree at CCC in hopes of transferring to RIT or something of that sort.

UNIX/Linux Fundamentals Journal

August 26, 2014

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • What action or concept of significance, as related to the course, did you experience on this date?
  • Why was this significant?
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

September 11, 2014

Notes: Containers capsulate things, basically a file that contains many files

Lossless formats that preserve all the data, unlike JPEG that loses quality

Unix does not have file extensions

.zip doesn’t mean its a zip file in Unix, its just a name

Programs can still make use of the file extension

.tar.bz2, the bz2 is the compression

after bz2 uncompress its in tar format

Vi:

i = insert, I = insert at the end

a = append, A = append at the end

VIM = VI improved, tells you what mode youre in

HJKL are also arrow keys

W = skips words, 4W = skips 4 words

w thinks punctuation is a space too whereas W isnt

B is back

$ goes to the end of the line

3G, goes the third line

X is delete, x is backspace

dw, db, dW, dB - delete by word

d^, d$, dd

p is paste

S - substitute

cw, cb, cW, cB - change word

c^, c$

o = insert new line below, O = insert new line above cursor

y = yank, yw = yanks into a buffer

/”char” brings the cursor to the word, n goes to next, N goes back

:w “filename” saves files

:w if you already put filename when starting Vi “filename”

:q exit Vi

If you dont want to save and just exit :q!

September 16, 2014

Notes: file system test magic number test language test

vi part 2:

cp /etc/motd ~ < absolute path for home dir

   ^ absolute path

cp /etc/motd ~/src/unix

: extended command mode

.co$ ,

. current line co copy $ to the end

2,4co9 takes 2-4 lines and copies them into line 9-11

3m7 takes line 3 and moves it to line 7

.,+4m16 current line to the next 4 lines to line 16

3,9s/lab46/LAB46/ search lines 3-9 for lab46 and change to LAB46

3,9s/lab46/LAB46/g globally replace lab46 with LAB46

%s/#/:/

September 18, 2014

Notes: Ctrl - S locks the terminal Ctrl - Q unlocks the terminal

Cat -n / #s in front of every line Cat -e / $ at the end of every line

$ means end of line

od / octodump of the file

asciitable.com

ASCII 8-bit 2^8 = 256

grep - globally search regular expression print

grep ‘the’ / - looks for the expression the in the give files

grep ‘\<the\>’ / looks for just the word the

grep -i ‘’ - looks for upper and lowercase version of given

grep -o ‘’ - just shows the matching text

grep -n ‘’ - also displays line # in front of occurrences

Dont pipe vi/nethack/a game Pipe anything that will spit out information : ls/who

September 23, 2014

Puzzlebox Discussion!

So I found the files in the /var/public/unix/projects/puzzblebox directory. From there I used cp file.txt /home/jcliteur/Documents to copy it into my home directory.

The Base file.txt turned out to be: ASCII text

When I Cat'd it: This is a simple text file. It contains ASCII text.

Using the command gzip file.txt I compressed it into file.txt.gz

File.txt turns into a gzip compressed data, was “file.txt”, last modified: Tue Sep 23 12:42:07 2014, from Unix

Using the command gzip -d file.txt.gz I uncompressed it and using gzip -1 file.txt to compress it the fastest I get: gzip compressed data, was “file.txt”, last modified: Tue Sep 23 12:42:07, max speed, from Unix.

September 25, 2014

ps shows PID

Spawning /forking process when a process creates another process. Theres no limit except for software and hardware. Basically a ddos.

getent passwd - shows

getent passwd | cut -d ’:’ -f1,7 | grep ‘th’ | tail -n 16 | wc -1

Quotes:

‘ - full quote, literal quote “ - half quote, allow for expansion (variable) ` - backquote, command expansion

echo - prints things

$ - how a shell denotes a variable

$ means access

echo “${USER}, you are logged in `who|grep “$USER”|wc -l` times”

uol=$(/usr/bin/who | wc -l)

t=`echo “There are $ud users on this system”)

getent passwd | cut -d ‘:’ -f1,7 | grep ‘th’ | tail -n 16 ;clear;echo -n “Processing…”;sleep21600;echo”done”

September 30, 2014

Went over Data Processing project

Do not used text editor to change values (no manual editing)

Commands to use: wc, head, tail, grep, cut, |, sort, cat

New commands:

uniq - ???

tr - translates given input to the second given input

printf - printf “\tHello\tthere\n” |tr ‘\t’ ‘ ‘

Wildcards:

? - matches any single character

ls ???? - shows all files with 4 characters

* - matches 0 or more of an character

ls l* - shows all files that start with l

ls *zip* - shows all files with zip inside of it

[ ] - matches any of enclosed characters

ls ?[aeiou]? - matches any file with any of the letters aeiou in it

[^ ] - doesnt match any of the letters in it

October 2, 2014

ls ???? - shows how many files are in cd with 4 characters in it

ls ?????* - shows all the files with 5 or more characters

ls -d - prevents ls going into another directory

ls -d [rstlne][rstlne]?*[rstlne] | wc -l - lists the number of files with four or more characters and the first two and last characters being rstlne

ls -d [^aeioy] [^aeioy] [^aeioy] | wc -l - lists the number of files with three characters that exclude aeiouy

ls -l | egrep ‘^(l|d)’ | wc -l - shows how many links and directories there are

October 7, 2014

ls -l /bin/ls

process - program in action

PID

ps - shows processes

kill -1 PID - hangs up a process

kill -2 PID - interrupts a process

ps aux | grep $USER

top - current running processes (ranks in order of activity)

AT&T sh - bourne shell

bash - bourne again shell

ps -ef

pg

SYSTEMV

SYSVRG

LSD\BSD csh - c shell

rps aux

sleep 3600

October 9, 2014

ls -a = shows you all the files in cd

alias = shows all alias

alias bob=’echo boo’ = next time you type in bob it’ll return boo

unalias = unalias’s something

PS1=’C:\w> = changes prompt to C:~>

echo $PATH = path the shell uses to look for commands

op=$PATH, PATH= = obliterates commands

PATH=$op = unobliterates them

shell scripting:

vi myscript.bash

df who ls

save and close.

bash myscript.bash = runs the bash file you just created

chmod 700 myscript = gives it permissions to execute

bash is extremely high level

vi something.bash

echo -n "What is your name?"
read name
echo "Hello, $name, nice to meet you"
exit 0

October 21, 2014

 echo $RANDOM
 % Modulus
 / Division
 Modulus is the remainder
 echo $(($RANDOM%100)) - gives a random value from 0-99
 echo $((($RANDOM%100)+1)) - gives a random value from 1-100
choice=$((($RANDOM%100)+1))
guess =0
while [$guess-lt 6 ]; do
echo -n “Guess a number”
read number
if [$number-eq$choice]; then
echo “You have correct now”
exit 0
elif [$number-lt$choice]; then
echo “Higher”
else
echo “Lower”
Fi
let guess=$guess+1
done

October 23,2014

bc = binary calculator

answer=`echo “2+2”|bc`

echo $answer


#!/bin/bash
total=0
evens=0
for number in `cat db.data`;do
evenchk=`echo "$number%2"|bc`
if [ "$evenchk" -eq 0 ]; then
let evens=$evens+1
fi
let total=$total+1
done
echo "Out of $total numbers, there are $evens even numbers"
exit 0

      take status output
      calc project points
      opus points
      attendance
      project % - 36%
      opus % - 36%
      attendance % - 28%
      calculate current grade
      display stuff

October 28, 2014

echo “6/7” | bc -l : calculates 6/7 at a floating point

echo “6/7” | bc -l | cut -d’.’ -f1 : gives the answer before the .

echo “6/7” |bc -l | cut -c 1-5 : gives the first five characters

echo “$(echo “(6/7)*100”|bc -l|cut -c 1-5)%” gives the first five characters followed by a percent sign


Attendance calculation:

Make it vertical

October 30, 2014

We took a knowledge assessment!

November 4, 2014

Regular Expressions (RegEx)

. - Match any single character

* - 0 or more of the previous

[ ] - matches one of enclosed

[^ ] - do not match one of enclosed

\< - match start of word

\> - match end of word

$ - match end of the line

Extended RegEx

( ) - grouping → \( \)

+ - match one or more of the previous


cat words | grep '^[a-z][a-z][a-z][a-z]*$' | wc -l - matches 3 or more, only lowercase


cat words | grep '^.*[aeiouy].*[aeiouy].*[aeiouy].*$' | wc -l - matches all lines with at least 3 aeiouy


egrep = grep + more

fgrep = fast grep, no regex (literal string matches

cat words | egrep 'ed$|ing$' | wc -l - matches any words that end with ed and ing

November 6, 2014

status unix | grep ‘opus’ | grep ‘week[02468]grep[02468]entry$’
			      egrep ‘week([02468]|[0-9][02468])
status unix | grep 'opus' | grep 'week[02468]' | sed 's/^.*\([01]\):\([a-z][a-z]*\):\(week\)\([02468]\)\(.*\)$/\5 for\3 \4 \2 [\1]/g'
getent passwd | grep '^[jc]' | sed 's/^\([a-z][a-z0-9]*\):x:\([0-9][0-9][0-9][0-9]\):5000:\(.*\):\/home.*$/\3 is user \1 with userid \2 /g'

November 11, 2014

Absent

November 13, 2014

at commands

at - executes command at specified time

atrm - deletes job by job number

at 16:16 - sets command at 4:16 Linux time

ls > out - command that will run at 4:16

atq - shows the list of commands that you set to run

crontab -e - lets you choose an editor to create a repeating command

*/4 * * * * /usr/bin/who - runs that command every 4 minutes of every hour, day, week, month

After a successful crontab command it should say: crontab: installing new crontab

last - shows when a user logged in

last | grep $USER | wc -l - shows how many times you logged in

last | grep $USER| grep Oct | wc -l - shows how many times you logged in October

opus/fall2014/jcliteur/start.txt · Last modified: 2014/12/21 16:16 by 127.0.0.1