======UNIX/Linux Fundamentals Journal====== ====August 26, 2014==== This day of class new room same old cooling/heating problem. A new semester has pose a new set of challenges and trials to over come and understand and expand my knowledge. Refreshing my unix/linux and feeling like I'm starting from scratch I started to look around in linux and found that i have forgotten much of what I use to take as "old hat" is now almost as new to me as many people now taking i have found myself once again in the lair being clueless coming in and trying to keep up. ls -list all directories or files man - manual for specified file/function ====August 27, 2014==== 2nd day of Oops and its hot inside and out and Joe is in good humor like always and is surprisingly on topic for the most part. will be posting 3 files and a wiki update on lab46 opus and bit bucket for bit bucket use from command line internet cert fix and a script for ssh link to bit bucket so you don't have to type in the entire lines to add, commit, push, pull and update. ====August 28, 2014==== Ordered List Item irc chat - initialization of irc - screen -ls see if you have any screen running - screen to open the application - irssi to start irc system - /server to join irc - /join "name of channel" to join the irc chat area - to disconnect from a screen is ctrl-a d - resume a irc screen - screen -r - ctrl-a d ====September 2, 2014==== 17 simple steps to making and using your repository from lab46 1. mv src src.bak 2. mkdir src 3. hg clone http://www/hg/user/"yourusername" ~/src 4. to clone remotely such as on home computer or laptop hg clone http://www/hg/user/"yourusername" ~/src 5. cd src 6. mv ~/src.bak/* ~/src 7. rmdir ~/src.bak 8. vi or nano .hg/hgrc 9.*[paths] *defualt=http://www/hg/user/youtusername/ *[web] *push_ssl = false *allow_push =* *[ui] *username = firstname lastname *[auth] *lab46.prefix = http://www/hg/user/yourusername *lab46.username = yourusername *lab46.username = http 10.save and exit 11.nano or vi .hgignore *syntax: glob * *.swp * *.pyc * *.o * ~ 12. hg status 13. hg add 14. hg commit -m "your add and commit comment" 15. hg push 16. hg pull 17. hg update ====September 8, 2014==== finally fixed my mercurial problem on my flash drive and cloned my repository to my lap top and going to do that as well on lab46 errors I received and how i fixed them. *Q1: Error path to specified file not found *A1: Had to re-clone my repository from bit bucket i forgot capital letters first time *Q2: specified file not found *A2: this was partially solved with the first resolution but needed to copy and paste the file to the new repository *Q3: cannot find program in specified path *A3: the path was leading to the C directory first time and the second time it was ending up at the wrong program forgot the exe on the end of hg ====September 11, 2014==== Remembering 9/11/01 is one of the oddest things of my life. I was in class and had no idea that the trade centers were hit by 2 large commercial airliners and had no idea what happened until after school. in honor of that day i am once again in class focusing on studies and writing my opus for linux/unix class. *ls: look in side a directory (see man ls for more info) *cd: change directory back of forth depending on arguments given to cd (see man cd for more info) *mv: move one file or directory from one spot to another (man mv for more info) *mkdir: make a directory (see man mk for more info) *rm: remove /delete a file or directory from existence (man rm for more info) *cp: copy file form one spot to another making 2 copies (man cp for more info) *vi: open a visual text editor for plain txt files used for most programing and as for me notes (man vi for more info) *cat: display contents of a file or directory (man cat for info) *tail: display last 10 lines of a file or directory (man tail for well you know) *head: display first 10 lines of a file or directory (man top for more) *chmod: change the read wright and execute permissions of a file or directory (ditto) *top: display processes in real time(seeing a pattern emerging) *cal: displays a calendar (and more) *date: displays today date (man date for any info for date) *pom: displays the phase of the moon(yes the moon don judge) *status: displays currently attendance and assignments done (no man here its a script from matt) *man: short for manual used for documentation usually followed my a argument asking for the manual of the document (man man for more info |testing mans' limits|) October 16, 2014 This will post will be everything I have done in both OOPS and Unix/Linux fundamentals unix notes September 2, 2014 19 simple steps to making and using your repository from lab46 1. mv src src.bak 2. mkdir src 3. hg clone http://www/hg/user/yourusername `/src 4. to clone remotely such as on a home computer or laptop hg clone http://lab46.corning-cc.edu/hg/user/yourusername ~/src 5. cd src 6. mv ~/src.bak/* ~/src/ 7. rmdir ~/src.bak 8. vi or nano .hg/hgrc 9. [paths] default = http://www/hg/user/yourusername [web] push_ssl = False allow_push =* [ui] username = Fristname Lastname [auth] lab46.prefix = http://www/hg/user/youtusername lab46.username = yourusername lab46.username = http 10. save and exit 11. nano or vi .hgignore 12. syntax: glob *.swp *.pyc *.o *~ 13. hg status 14. hg add 15. hg status 16. hg commit -m "your add and commit comment" 17. hg push 18. hg pull 19. hg update unix notes 09/04/2014 cd= change directory unix command line seqeunce /=top ----------------------------------------------------------------- | | | | | | | | | home mnt | | ---user---- --------- | | | | | | src bin other flash ect.ect. | --------- | | mp3 pictures pwd=path listing relative path: only work for you Absolute path: works for everyone ls -l long list wil show read write permissions cat: posts it contents of a file to the terminal echo: simple print statement stdin: defualt input stdout: defualt output stderr: defualt output for errors >: redirects stdout to file (writes) >>: redirects stdout to file (appeneds) 2>: redirects stderr to file (writes) 2>>: redirects stderr to file (appeneds) tail: lists last 10 lines (-f tells tail to not exit file when done keep posting) /dev/null: nullifies things sent there see opus for comand list 9/11/14 project back to mastering lazy cd /var/public/unix/project/archive_handling lossy: non data safe after save and use jpeg is a lossy digital format losses quality after copy and moving lossless: smaller compresion but more data is saved .tar.bz2 compresion .zip use the man pages 1. figure out teh format 2. figure out how to extract 3. find empty or corruptfiles 4. organizer smallest small big and biggest 5. myarchive.tar 6. use -n argument 7. use submit myarchive.tar.gz September 11, 2014 notes ed line editor early text editor Bill Joy: came up with an idea for a text editor -insert -commands aka visual editor aka vi Commands -------- i: insert h: left by character j: down by character l: right by character k: up by character number+command: takes you that many in the direction w: foward by word b: backward by word W: forward by spaces B: backward by spaces $: end of line ^: start of line number+G: moves to the line <<: indent >>: unindent x: delete X: backspace dw: delete by word db: dW: dB: d^: d$: dd: p: paste above cursor P: paste below cursor s: substitute cw: change word cb: cW: cB: C^: change by line start C$: change by line end y: yank out a word (aka copy) yy: yank by line yb: yB: yw: YW: u: undo U: /: search n: next forward N: next backward :wq: write and quit :w filename: saves a file by filename :q: quit :q!: quit without saving insert ------ i: insert where you last left off a: inserts after current character I: insert at start of line A: insert at ending of line o: open a new line below O: open a new line above September 18 2014 text processing vi= best text editor ever cat= display content of a file ctrl+s = xoff ctrl+q = xon od= octal dump -x: hex dump endianness little endian : lower order big endian : high order grep: global regular expression print \<\> -i: case insenseitive -o: only matchinng no line |: out of left to input to the right wc= word count -l: length September 23 2014 |=pipe : output | input head: defualt display frist 10 lines tail: defualt display last 10 linescd for who.dat section 1 head -19 who.dat>section1 section 2 head -38 who.dat| tail-19 >section2 section 2x1 tail -19 section4>section2x1 section 3 tail -19 who.dat>section3 section 4 head -38 who.dat>section4 cat section2 section1 section3 >who.all who.all orginized cat section2 section1 section3|sort|less sort: sorts by name of file and if linked to cat siplays in order bc: base calculator groups: list groups u are attatched to september 25 2014 vogue.co.uk up,up,down,down,left,right,left,right,b,a,a,a,a,a,a, Dinosuars with hats qoutes '-fullqoute, literal qoute "-half qoute, allow for expansion(varible) `-backtick,command expansion cut - cuts lines and prints them out making cmdline varibles ; seperate commands on a single line sleep wait for so many seconds October 3, 2014 wildcards --------- ?- matches any single character []-character class, match any of the enclosed characters(just one) *-matches zero or more of any character [^]- inverted character class, do not match any of the enclosed logic operations ---------------- |-or operand egerp ----- ''-match anything inside the qoutes October 7, 2014 a process is a program in action (is a running programing) PID max pid is 2^16=65536 starts at 1 reserved for init ps = list of running process kill = signal and system call ends processes: kill -# "PID" top= currently running process october 9, 2014 ls list files in directors -a to ls list hidden files alias lists the preset alias can also set names for commands unalias can undo aliases PS1 sets command line prompt wall send a message to users PATH set or change paths #! - sh-bang tab - partial start a command and its arguments and pressing tab will attempt to complete bash syntex -gt greater then -ge greater then or equal to -lt less then -le less then or equal to -ne not equal to -eq equal to October 10, 2014 largest mv i ever used mv 2darry.c Rockpapersissors.c StatementsSano.c Task4.o array.c array.o array2.c binary.c binary2.c clab.c clab.o cprogtask1 cprogtask2 cprogtask3 cprogtask4 cprogtask4 cprogtask5 cprogtask6 cprogtask7 crpogtask8 cprogtask9 cprogtask A floatapp.c functions.c fwg.c gfxfun.c hello.c hello.o ifselect.c looparry.c nocapes.c notes numberfun7.c numberfun7.o rand.c rand.o shovelingbob sqaures.c srandtime.c taskx.c var1.c var1.o vbs Programs october 23, 2014 #!/bin/bash total=0 evens=0 for number in `cat data`;do evenchk=`echo "$number%2"|bc` if [ "$evenchk" -eq 0 ]; then let evers=$evens+1 fi let total =$total+1 done echo "out of $total numbers, there are $evens even numbers" exit 0 using bash to pull data out of status for current grades November 4, 2014 1 #include 2 #include 3 4 class rectangle 5 { 6 public: 7 int area(); 8 int perimeter(); 9 rectangle(); 10 rectangle(int,int); 11 12 private: 13 int length; 14 int width; 15 }; 16 int rectangle::area() 17 { 18 return((length*width)); 19 } 20 int rectangle::perimeter() 21 { 22 return((length+length+width+width)); 23 } 24 rectangle::rectangle() 25 { 26 width=0; 27 length=0; 28 } 29 rectangle::rectangle(int length, int width) 30 { 31 this->length=length; 32 this->width=width; 33 } 34 int main() 35 { 36 int area=0; 37 int perimeter=0; 38 rectangle rect1; 39 rectangle *rect2; 40 rect2=new rectangle(4,10); 41 area=rect1.area(); 42 perimeter=rect1.perimeter(); 43 printf("rect1 area is: %d\n", area); 44 printf("rect1 parimeter: %d\n", perimeter); 45 area=rect2->area(); 46 perimeter=rect2->perimeter(); 47 printf("rect2 area is: %d\n", area); 48 printf("rect2 parimeter: %d\n", perimeter); 49 return(0); 50 }