User Tools

Site Tools


opus:fall2014:mquesad1:journal

UNIX/Linux Fundamentals Journal

AUGUST 26th, 2014

On this day, the class logged into Lab46 while setting up our password's and explored the class syllabus.Somewhat apprehensive about this class, since I don't have an extensive amount of knowledge when it comes to dealing with computers.

AUGUST 27TH, 2014

Downloaded PuTTY onto my personal laptop and explored Lab46.

August 28th, 2014

The class logged into Lab46 and set up screens where we joined the unix and lab46 chats.

  • This was not super complicated but since I do not know much about the unix terminal I am spending time trying to figure out certain prompts.
  • Then we were given the unix philosophy
    • Small is Beautiful
    • Do one thing, and do that one thing extremely well
    • Everything is a file
      • Definitely helpful, for me at least, to grasp unix with the idea that everything is a file
  • Next, the 3 types of files where described:
    1. Regular/Ordinary
    2. Directory(links)
    3. Special

This mainly concluded the day, with the request that we check out Lab46 more.

September 2nd 2014

Set up our mercurial repositories and learned how to check our lab46 mail, through the prompt alpine. Then we went through our basic commands and learned that the “~” indicates home directory and the “$” indicates a regular user, while a “#” indicates a super user.

September 4th 2014

On this day there was quite a bit of exploring, which was very beneficial for me since I didnt really know a ton of the inner workings, including many of the files that exist in lab46

  • there were also many new prompts given, as indicated in the class notes.

I personally must get more used to file manipulation and have tried doing more work that i have to do through CLI's and exploring unix

September 9th, 2014

We where given the command status today so we could access how we are doing in class. This command is based on our projects and attendance. The attendance is based on day of the year instead of months and days since it is difficult to parse specific dates. Next, we where given the command cal where we can access calendar and dates. There are many different variations we can do of this command that can give us different results; check under man cal for more info. The cool part about this is we can even see the switch of the Julian calendar to the Gregorian. The seconds count in unix are based on the time unix began or as Matt said, “When time began” which was December 31, 1969 - January 1, 1970. Also given command pom. “Phases of the Moon” command: cd pts tty = terminal number we're in, cd pts mesg = accessible to sending messages.

Talked more about the inner workings of unix, all things run with a library, there are different types of passwords =shadow. SInce unix is based on files it is very organized so one can easily isolate things and where problems are.

September 11th, 2014

Archives Project

Due:9/17/14

Vi Editor
  • When unix began it started to be used for text editing, therefore they needed a way to edit text well.
  • That's when Bill Joy came up with the vi editor.
  1. Vi editor maintains a bi-modal way of editing: Through the command mode and Write mode
  2. vi editor first opens in command mode!
  3. almost all letters on the keyboard have significant actions in command mode.
    1. Since there are so many i may have trouble trying to learn them all, I must practice more of vi editor to maintain a healthy knowledge of all the command keys.

September 16th, 2014

Puzzlebox Project

Due: 9/24/14

vi part2

Extended Command Mode
  • :.co$ copies current line to the end of vi file
  • :2,4co9 copies line 2 through 4 to line 9
  • :3m7 takes line 3 and moves to line 7
  • :rfilename opens file
  • :wfilename save file
  • :q exits
  • :x saves and quits
  • :3,9s/lab46/LAB46/ changes first lab46 in lines 3 through 9 with LAB46
  • :3,9s/lab46/LAB46/g changes all lab46 to LAB46
Regular Expressions
  1. patterns we can explain to a computer
  • :%s/[a-z]$/Z/g pattern that describes any word that ends with lower case letter with capital Z
  • :%s/./DEADBABY/g changes every word with DEADBABY
vi specific
  1. config changes to vi
  • :set number
  • :set tabstop=4
  • :set shiftwidth=4
  • :syntax on
  • :set cursorline
  • :set smartindent
  1. gvim is vi for windows, downloaded to home computer, woo!
Archives Project

Since tar is an older command its main function was to create one file out of many, which is optimum for us when we need to create a zip file. Instead of creating many different zip files, tar allows us to create one large file that can be compressed.

September 18th, 2014

Command:submit unix allows us to check for submitted assignments

text processing

Commands
  • cat -n which gave us numbered lines on the /etc/motd
  • cat -e recognized the end of the lines of /etc/motd with $(end of line).
ASCII

ASCII whitespaces are characters that are not visualized such as backspace or transmit off(XOFF, ctrl+s) and transmit on(XON, ctrl+q). The importance of this is if one uses certain commands it could result in these whitespaces to try and be implemented therefore we learned some other commands.

Commands cont.
  • od view /etc/motd in octal,
  • od -x view /etc/motd in hexadecimal.
  • grep or global regular expression print is used to grab certain patterns from a file.
  • grep 'the' /etc/motd grabs first 'the' from message
  • | (pipe) used to combine commands where we take the output from the first command and use it for the input of the second command.
  • od -x and grep: od -x etc/motd | grep '41' used to find all the lines that had the hex pattern 41 in it.
Endianness

When we converted a small section of the hexadecimal info, our class noted that the lettering was flipped. This is where we discussed Endianness; big and little. Big Endian is typically used by intel and reads it analytically from right to left, while Little Endian is the opposite. At first this was a little odd to me but started to make sense when i thought of it analytically, this was significant for me because if i was ever trying to get the right information from hexadecimal i better realize which endian it is or be completely confused.

September 23rd, 2014

Text Processing

In class, we talked about the commands; less and more. Both of these commands show pages of certain text's however less shows us one page at a time and allows us to scroll through it. Less is more!

We then created a file that had 57 lines on it and went through a process of trying to put the first 19 lines into a file called section 1, the last 19 into a file called section 2, and the middle lines into a file called section 3. to do this we used the commands; head and tail. the commands to figure this out was:

cat -n who.dat | head -n19 > section1
cat -n who.dat | tail -n19 > section3
cat -n who.dat | head -n38 | tail -n19 > section2

Next, we used the command; sort. This allowed us to sort each section together correctly

cat section2 section1 section3 | sort | less

Then we discussed the commmand; getent. which we used in getent passwd which displayed our own passwords /etc/passwd. We noticed that our passwords used to be stored here however when computers got faster at decrypting passwords, they replaced this with an x so its not as readily available.

September 25th, 2014

First thing in class we discussed fork bombs or denial of service and how they can really do a number on the servers. However, to keep this from happening we can limit how many processes a user can have, therefore if they set off a fork bomb only they would be locked out from their shell. command ulimit allows us to adjust our own processes so we can allocate certain amounts of processes to certain areas.

we also saw dinosaurs with hats!

More text Processing

In class we discussed about quotes: ' =which is the full quote or literal quote : =half quotes, allow for expansion(variable) ` =backquote,backtick, command expansion

We also discussed how one can create their own variables:

uol=$(/usr/bin/who | wc -l)
echo  "There are $uol users on the system"

-remember for next class; wildcards.

September 30th, 2014

Commands

uniq tr sed These commands are going to be crucial for the next project, Dataproc

man man: allows one to check the man page of man which has some valuable assets, such as man 7 ascii which displays an ascii table.

Wildcards

-watered down forms of regular expressions

October 2nd, 2014

Wildcards
?

matches any single character

*

match zero or more of any character

[]

match any one of the enclosed characters

[^ ]

do not match any one of the characters enclosed

ls -d | wc -w

the -d function of ls keeps the ls function from opening directories and listing everything within Wildcards- can do ranges[0-9] and multiples but don't allow any commas within just add them, [0-9 a-z A-Z]

October 7th, 2014

ZOMBIES EXIST!!!!!!

  1. 2 Types
  2. Zombies created on purpose
  3. Zombies created by accident - much harder to kill and can eventually take over the computer

To Help Combat Zombies and other system problems we need to be able to see our process while we're using it. Therefore we used the command ps that allows us to see our PID From here we can also use kill to end processes.

kill -l
  1. SIGHUP - hang up signal
  2. SIGWT - interrupt signal

Internal bash - ctrl z freezes running processes

October 9th, 2014

Environment Variables

  1. Alias manually sets environment variables that are used only for the currently logged in session
  2. Unalias removes these set environment variables
lab46~$ alias bob='echo bang'

: this manually sets alias

After we played around with alias in class, we then went and wrote some shell script files with bash. I don't have much experience with bash so I hope we get more involvement with it so i can learn much more, this is definitely my weaker side.

October 21th, 2014

Shell Scripting

Modulus

  1. gives the remainder when dividing two numbers.
  2. this never goes above the divisor, always at least less than one.
  3. The modulus helps us to determine how we want to set our random number generator.

Random Number Game

  1. created a random number game, under numbergame.sh in my directory

October 23th, 2014

  1. Sh-bang: #!/bash/bin absolute path for other scripting languages
  2. In this class, we created data and wrote a script that adds all of the numbers in data.txt, a file we just put random numbers in.
  3. After this we start creating a program that calculates all the point when we type the command status opus.
  4. # always for comments in bash

October 28th, 2014

  1. Mainly worked on the scripting program for most of the day, and discussed how to do percentages.

October 30th, 2014

Knowledge Assessment

  1. On this day, we had our knowledge assessment where we had to copy a file from the public directory, open the file, and edit it. Other than this, I only worked on my scripting program.

November 4th, 2014

Regular Expressions

Wildcards are used on files while regular expressions are used with text in the files.

  1. . → match any single character
  2. * → match 0 or more of the previous
  3. [] → character class, match one of the enclosed
  4. [^] → do not match any of the enclosed
  5. \< → match start of word
  6. \> - match end of word
  7. ^ → match start of line
  8. $ → match end of line

Extended RegEx

  1. | → or
  2. () → grouping →\( \) must be used for sed
  3. + -. match one or more of the previous

November 7th, 2014

Regular Expressions cont.

SED

way of manipulating text to fit ones needs, it groups text together using multiple \( \) for each fields which then corresponds to a number starting at 1; by listing these numbers at the end however one needs, sed will manipulate it.

lab46~$ status unix|grep 'opus'|sed 's/^.*\([01]\):\([a-z][a-z]*\):\(week\)\([0-9]\)\(.*\)$/\5 for \3\4\2[1]/g'

November 11th, 2014

  1. 2 Useful abilities that will help with our command abilities: at, cron/crontab

November 13th, 2014

  1. at⇒ queue's up other commands
  2. crontab -l ⇒ show's one's cron table

at 16:16 enter ls > out enter ctrl d at rm⇒ remove atq ⇒ shows which commands are scheduled

cron ⇒ similar to at except can be done every certain number of days

  1. syntax fro cron: minute, hour, day of month, month, date of week
  2. cron can be picky so therefore be explicit

November 18th, 2014

  1. last ⇒ shows the logins
  2. lastlog ⇒ shows where each individual user has logged in last
  3. last | grep 'mquesad1' | grep 'Oct' | wc -l

New project Time Online: write script that returns the amount of time one has spent on Lab46

November 20th, 2014

Worked on our new project time online script the entire class, honestly don't know how to start this one it seems kinda tricky.

  1. accept via command-line argument, or user input if no arg the desired user name to process.
  2. validate that the indicated user exists, proceed only if/when okay
  3. for each month of the semester, determine:
  4. number of logins for the month; histogram
  5. total time spent on the system that month in; days, hours, minutes
  6. provide total logins for semester, total time for semester
  7. create histogram for the number of logins for the month

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?
opus/fall2014/mquesad1/journal.txt · Last modified: 2014/12/02 12:08 by mquesad1