This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
user:aforce2:portfolio [2013/12/06 19:39] – [Case Studies] aforce2 | user:aforce2:portfolio [2013/12/13 03:58] – [Labs] aforce2 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Case Studies====== | ||
+ | |||
+ | ===Case Study 0x1: Archive Handling=== | ||
+ | |||
+ | | ||
+ | * learned how to compress files with **gzip** | ||
+ | |||
+ | Used <cli> cp -r / | ||
+ | |||
+ | Looking through the manual pages **man gzip** | ||
+ | <cli> gunzip archive1.tar.gz </ | ||
+ | and\\ | ||
+ | <cli> unzip archive2.zip </ | ||
+ | |||
+ | <cli> tar -xf arc.tar archives </ | ||
+ | created the archive | ||
+ | |||
+ | I dont believe tar, gzip and zip are all that different just different forms of archiving. | ||
+ | |||
+ | |||
+ | ===Case Study 0x2: Unconventional Naming=== | ||
+ | |||
+ | Using | ||
+ | < | ||
+ | |||
+ | Typed: | ||
+ | <cli> lab46: | ||
+ | and it returned | ||
+ | <cli> spaces, commas, two types of quotes... oh my! </ | ||
+ | |||
+ | Typed: | ||
+ | <cli> lab46: | ||
+ | and it returned | ||
+ | <cli> This file has spaces and ?'s in its name. </ | ||
+ | |||
+ | Typed: | ||
+ | <cli> lab46: | ||
+ | and it returned | ||
+ | <cli> will the weird filenames ever end? </ | ||
+ | |||
+ | Using | ||
+ | <cli> \ </ | ||
+ | |||
+ | Typed: | ||
+ | <cli> lab46: | ||
+ | it returned | ||
+ | <cli> Simple, but simpler without the spaces!</ | ||
+ | |||
+ | Typed: | ||
+ | <cli> lab46: | ||
+ | it returned | ||
+ | < | ||
+ | |||
+ | Typed: | ||
+ | < | ||
+ | it returned | ||
+ | < | ||
+ | \\ | ||
+ | Its Interesting on how the " | ||
+ | \\ | ||
+ | |||
+ | Using | ||
+ | < | ||
+ | |||
+ | Typed: | ||
+ | < | ||
+ | it returned | ||
+ | < | ||
+ | \\ | ||
+ | I had to use the slashes to remove the quotes from " | ||
+ | \\ | ||
+ | |||
+ | Typed: | ||
+ | < | ||
+ | it returned | ||
+ | < | ||
+ | \\ | ||
+ | |||
+ | Typed: | ||
+ | < | ||
+ | it returned | ||
+ | < | ||
+ | \\ | ||
+ | |||
+ | |||
+ | Typed: | ||
+ | < | ||
+ | it returned | ||
+ | < | ||
+ | \\ | ||
+ | Had to use the slashes to remove the " | ||
+ | |||
+ | I was able to remove "- challenge round -" with -- by looking in the man pages: | ||
+ | < | ||
+ | |||
+ | ===Case Study 0x3: The Puzzle Box=== | ||
+ | \\ | ||
+ | File.txt appears to be ASCII text\\ | ||
+ | When using cat it says it appears to be a simple text file and contains ASCII text.\\ | ||
+ | When compressed with gzip and ran with file(1) it returns | ||
+ | < | ||
+ | |||
+ | When compressed with the fastest speed | ||
+ | <cli> gzip -1 file.txt</ | ||
+ | it returns | ||
+ | < | ||
+ | |||
+ | |||
+ | Using cat on abcd.txt returns random symbols, when running file(1) on it it returned it was a .tar file\\ | ||
+ | used <cli> tar -xf abcd.txt </ | ||
+ | |||
+ | ===Case Study 0x4: Unix Messaging Tools=== | ||
+ | \\ | ||
+ | 1. lwall1 and jkosty6 | ||
+ | \\ | ||
+ | 2. a. jkosty6 has messages disabled. | ||
+ | \\ | ||
+ | b. Write permissions turned off. | ||
+ | \\ | ||
+ | 3.a. can accept invites but cant join | ||
+ | \\ | ||
+ | b. lwall1 and jkosty6 | ||
+ | \\ | ||
+ | 4. | ||
+ | c. lwall1 and jkosty6 | ||
+ | \\ | ||
+ | e. Esc, S\\ | ||
+ | |||
+ | ===Case Study 0x5: Web Pages=== | ||
+ | My URL:\\ | ||
+ | http:// | ||
+ | \\ | ||
+ | My EX0 URL: | ||
+ | http:// | ||
+ | \\ | ||
+ | My Page Made From Scratch: | ||
+ | http:// | ||
+ | |||
+ | |||
+ | ===Case Study 0x6: Device Files=== | ||
+ | |||
+ | 1.Some files in the /dev folder are: | ||
+ | |||
+ | *MAKEDEV | ||
+ | *core | ||
+ | *hvc4 | ||
+ | *ppp | ||
+ | *tty | ||
+ | *vga_arbiter | ||
+ | |||
+ | Block:\\ | ||
+ | 202:1 \\ 202:2 \\ 202:3 | ||
+ | \\ | ||
+ | Character: | ||
+ | 10: | ||
+ | \\ | ||
+ | |||
+ | |||
+ | 2.Filesystems in use:\\ | ||
+ | / | ||
+ | tmpfs | ||
+ | udev 738M | ||
+ | tmpfs | ||
+ | / | ||
+ | nfs:/ | ||
+ | nfs:/ | ||
+ | |||
+ | 4. crw--w---- 1 5841 5 136, 8 Dec 10 15:41 8 \\ | ||
+ | didn't change... \\ | ||
+ | \\ | ||
+ | |||
+ | 6. It does the same thing outputs it to the string except outputting it to \\tty compacts it more and outputs it to the terminal a different way. It seems to run it like a script. | ||
+ | \\ | ||
+ | |||
+ | 7. It just displays it to the terminal. Might be useful for multiple \\terminals, | ||
+ | \\ | ||
+ | |||
+ | ===Case Study 0x7: Scheduled Tasks=== | ||
+ | \\ | ||
+ | d. my bot name is mybot | ||
+ | \\ | ||
+ | e. I used .w 14830 and it told me corning' | ||
+ | \\ | ||
+ | 2. | ||
+ | <cli> | ||
+ | if [ `pgrep -u aforce2 python | wc -l` -eq 0 ]; then | ||
+ | cd Downloads/ | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===Case Study 0x8: Data Types in C=== | ||
+ | |||
+ | |||
+ | ===Case Study 0x9: Fun with grep=== | ||
+ | |||
+ | 1. grep -o " | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ======Labs====== | ||
+ | |||
+ | |||
+ | |||
+ | ==Lab 0x0== | ||
+ | |||
+ | |||
+ | * Learned was Unix was and that it was created Bell Labs in the early 1970's and just progressed from there. | ||
+ | |||
+ | * Unix is CASE sensitive!! | ||
+ | |||
+ | * Learned how to log into lab46 from home, thrugh windows and linux. | ||
+ | |||
+ | * Learned some of the command prompt, what lab46:~$ is... | ||
+ | |||
+ | - lab46 is the hostname of the system. | ||
+ | |||
+ | - The ”~” (tilde) is a representation of your home directory. | ||
+ | |||
+ | - The “$” symbol represents the end of your prompt. | ||
+ | |||
+ | - The superuser (also known as root) would have a ”# | ||
+ | |||
+ | * Pwd shows where you are. | ||
+ | |||
+ | * Navagation with " | ||
+ | |||
+ | * ls lists the files in the directory | ||
+ | |||
+ | * mkdir creates directories, | ||
+ | |||
+ | |||
+ | ==Lab 0x1=== | ||
+ | |||
+ | * Learned the command **ls** which means list, displays all the files in the directory you're in. | ||
+ | |||
+ | *Learned the command **cp** which means copy. | ||
+ | |||
+ | *Learned the command **mv** which means move. | ||
+ | |||
+ | *Learned the command **rm** which means remove. | ||
+ | |||
+ | *Learned the command **ln** which means link. **ln -s** creates a soft link. | ||
+ | |||
+ | *Learned the command **man** which followed with what your looking will open up the manual for that topic. | ||
+ | |||
+ | |||
+ | |||
+ | ==Lab 0x2== | ||
+ | |||
+ | **/bin** - Essential basic tools for normal system usage \\ | ||
+ | **/etc** - Configuration files\\ | ||
+ | **/home** - Location of the system' | ||
+ | **/lib**, - /lib64, /lib32 Contains important system libraries\\ | ||
+ | **/mnt** - Common place to mount additional filesystems\\ | ||
+ | **/root** - The superuser' | ||
+ | **/sbin** - Essential system administration utilities\\ | ||
+ | **/tmp** - Temporary directory\\ | ||
+ | **/usr** - Additional (secondary) system functionality & userspace tools\\ | ||
+ | **/var** - Misc. items (mail files & databases) \\ | ||
+ | |||
+ | **pwd** prints working directory. | ||
+ | |||
+ | |||
+ | ==Lab 0x3== | ||
+ | |||
+ | *Learned about cat, head and tail commands\\ | ||
+ | *cat - concatenate files and print on the standard output\\ | ||
+ | *head -16 then filename would show the first 16 lines in the file.\\ | ||
+ | \\ | ||
+ | To enter insert mode, one of the following commands can be used:\\ | ||
+ | i insert before cursor\\ | ||
+ | o insert line below\\ | ||
+ | O insert line above\\ | ||
+ | a insert after cursor\\ | ||
+ | To exit insert mode and return to command mode, hit the escape (ESC) key once.\\ | ||
+ | \\ | ||
+ | When in command mode, you may use the following to alter the current file:\\ | ||
+ | :wq save and exit\\ | ||
+ | :w save the file\\ | ||
+ | :q! quit without saving\\ | ||
+ | ZZ quit and save only if changed\\ | ||
+ | |||
+ | |||
+ | |||
+ | ==Lab 0x4== | ||
+ | |||
+ | |||
+ | *Kernel - the core of the OS. It handles everything- manages I/O, etc.\\ | ||
+ | *Drivers - components that instruct the kernel how to function or deal with a piece of hardware.\\ | ||
+ | *Userspace - non-kernel level. System applications, | ||
+ | |||
+ | |||
+ | Control Code - System Code - Description: | ||
+ | CTRL-C - INTR - interrupt\\ | ||
+ | CTRL-D - EOF - issue end of file character\\ | ||
+ | CTRL-G - sound bell\\ | ||
+ | CTRL-H - BS - send backspace\\ | ||
+ | CTRL-J - LF - send linefeed\\ | ||
+ | CTRL-L - refresh screen\\ | ||
+ | CTRL-M - CR - send carriage return\\ | ||
+ | CTRL-Q - XON - start code*\\ | ||
+ | CTRL-S - XOFF - stop code*\\ | ||
+ | CTRL-V - escape the following character\\ | ||
+ | CTRL-Z - SUSPEND - suspend current job\\ | ||
+ | CTRL-[ - ESC - send escape character \\ | ||
+ | \\ | ||
+ | *ls -a shows hidden files called dotfiles\\ | ||
+ | |||
+ | **dotfile - | ||
+ | .bash_profile - The first personal initialization file bash searches\\ | ||
+ | .bashrc - Session personalization file called by .bash_profile\\ | ||
+ | .cshrc - A personal initialization file for the csh/tcsh shells\\ | ||
+ | .exrc - A configuration file for vi/ex\\ | ||
+ | .signature - Text file containing a signature banner for e-mail\\ | ||
+ | .plan - A personal banner file that is displayed on finger(1) lookups\\ | ||
+ | .forward - A file used in automatic e-mail forwarding\\ | ||
+ | .pinerc - A configuration file for pine\\ | ||
+ | .vimrc - A configuration file for vim\\ | ||
+ | \\ | ||
+ | *The .bash_history file shows all of you bash history. | ||
+ | |||
+ | | ||
+ | |||
+ | $PATH | ||
+ | $HOSTNAME | ||
+ | $USER | ||
+ | $TERM | ||
+ | $SHELL | ||
+ | |||
+ | Personal Variables are distinguished with lower-case letters. | ||
+ | |||
+ | SHELL=/ | ||
+ | MAIL=/ | ||
+ | TERM=xterm \\ | ||
+ | PATH=/ | ||
+ | |||
+ | echo $PATH \\ | ||
+ | |||
+ | alias ls='ls --color=auto' | ||
+ | |||
+ | Removing the alias removed the color from the ls command. \\ | ||
+ | |||
+ | |||
+ | ===Lab 0x5: More UNIX Shell Explorations=== | ||
+ | |||
+ | |||
+ | 1. b/ | ||
+ | \\ | ||
+ | d.< | ||
+ | \\ | ||
+ | 2. | ||
+ | \\b.< | ||
+ | file1 file1234 | ||
+ | \\ | ||
+ | d. <cli> ls file? </ | ||
+ | \\ | ||
+ | f.It lists file2 and file3 because the search ask's for only a 2 or 3 character after file. | ||
+ | \\ | ||
+ | h. lists File2 file4 file41 and filea because the search tels it to search file following either a 2, 4 or an a following anything. | ||
+ | \\ | ||
+ | 3. | ||
+ | \\b.File1 now returns the message of the day! | ||
+ | \\d. File1 changed into "-This is text-" | ||
+ | \\ | ||
+ | 4. | ||
+ | \\ | ||
+ | b. It changed into More text... | ||
+ | \\ | ||
+ | d. This put file1 and file1234 into file2. | ||
+ | \\ | ||
+ | 5. | ||
+ | \\ | ||
+ | b. < | ||
+ | ls: cannot access file555: No such file or directory</ | ||
+ | \\ | ||
+ | d.The error didn't go away because the file555 doesn' | ||
+ | \\ | ||
+ | f. The error went away because of the STDERR redirection operator. | ||
+ | \\ | ||
+ | g. This just used STDIN with cat into file 2 | ||
+ | \\ | ||
+ | |||
+ | 7. | ||
+ | \\ | ||
+ | b.< | ||
+ | / | ||
+ | \\ | ||
+ | d. nothing changed because it means the same thing. | ||
+ | \\ | ||
+ | f. The '' | ||
+ | \\ | ||
+ | 8. | ||
+ | \\a. wc is word count | ||
+ | \\ | ||
+ | b. wc -l | ||
+ | \\ | ||
+ | 9. | ||
+ | \\ | ||
+ | b. < | ||
+ | \\ | ||
+ | c. 19 lines | ||
+ | \\ | ||
+ | 10. | ||
+ | \\ | ||
+ | a. ls ???? | ||
+ | \\ | ||
+ | b. ls [amf]* | ||
+ | \\ | ||
+ | c. ls [abc]*[rst] | ||
+ | \\ | ||
+ | 11. <cli> lab46:/ | ||
+ | Good work! You're done! </ | ||
+ | |||
+ | ===Lab 0x6: Shell Scripting Concepts=== | ||
+ | |||
+ | 1. a.ls -l shows the permissions | ||
+ | \\ | ||
+ | b. -rw-r--r-- | ||
+ | \\ | ||
+ | c. \ d. chmod 744 script1.sh | ||
+ | \\ | ||
+ | e. It ran! | ||
+ | \\ | ||
+ | 2. <cli> echo "Enter your birth year" | ||
+ | read birth | ||
+ | |||
+ | let age=2013-$birth | ||
+ | |||
+ | echo $age | ||
+ | </ | ||