Unix: Difference between revisions

From bradwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
* MIT gurus (e.g. Rich Stallman) made a GNU (''G''nu's Not Unix) version of UNIX, which is freely available. Free, meaning you can improve it and sell it, but the source code of whatever you sell is to be free to modify, sell, or give away (in turn, that product is also GNU).
* MIT gurus (e.g. Rich Stallman) made a GNU (''G''nu's Not Unix) version of UNIX, which is freely available. Free, meaning you can improve it and sell it, but the source code of whatever you sell is to be free to modify, sell, or give away (in turn, that product is also GNU).
* A shell is a unix program that takes commands at the terminal
* A shell is a unix program that takes commands at the terminal
* There are 2 main shell origins, one by a guy named Bourne and another by Bill. Bourne made the Bourne shell (resulting in <big><code>ksh</code></big> or <big><code>bash</code></big>) and Bill made the C shell (<big><code>csh</code></big>)
* There are 2 main shell origins, one by a guy named Bourne and another by Bill. Bourne made the Bourne shell (resulting in <big><code>ksh</code></big> and <big><code>bash</code></big>) and Bill made the C shell (resulting in <big><code>csh</code></big> and <big><code>tcsh</code></big>)
**Bourne shell prompts use a <big><code>$</code></big>
**Bourne shell prompts use a <big><code>$</code></big>
**C shell prompts use a <big><code>%</code></big>
**C shell prompts use a <big><code>%</code></big>
* An exclaimaiton point (a BANG -- !) means do a command again, two (!!) mean do the last command again. One followed by a we letters (!cp) means run the last command that started wit h"cp"
* To stop a UNIX command press ctrl+c
* How to pronounce Linux: http://wunsite.unc.edu/LDP/links.html
* GUI means Graphical User Interface while WIMP means Windows, Icons, Mouse Pointing
* Xerox made the first GUI, MIT made the second called X Windows
* At the prompt type %xeyes
* To open a new xterminal type {%xterm}
* UNIX commands take options (aka flags or switches) which are typed after a command and use a dash like:
** %ls -l
** %ls -a
** %ls -a -l
** %ls -al
* Putting a period (.) before a file name will hide the file, but you can see hidden files using the ls command with flags:
** %ls -al
* Preview a text file using 'cat' or 'head'
** %cat filename
** %head filename
* Find your user rights (permissions) using the 'id' command:
** %id
* Find the permissions of a file using ls with flags
** %ls -l filename
* The permissions of a file will look something like this:
** -rw-r-r-
*** the first dash will tell you it's a file (if it's a 'd' then it's a directory)
*** the first set of letters will tell you the owners permissions
*** the second set of letters will tell you the permissions of people in the same group as the owner
*** the third set of letters will tell you what anyone can do with the file
* You can change a file's permissions using '%chmod'
* Everyone gets a home directory, yours probably looks like this:
** /usr/yourname/
* The command '%pwd' will tell you your current directory
* You can go to, or reference your home directory using a tilde (~)
* A dot (.) references your current folder, two dots (..) references the parent folder
* To see files in the parent folder (aka parent directory) type:
** %ls ..
* Here are some popular directories:
** /bin/ system commands
** /bin/usr/ more system commands
** /user/local/bin/ non-standard add-on commands
** /dev/

Revision as of 19:38, 26 March 2012

After several moments of deliberation, I chose to create the page Unix as a starting point for this beginners guide to programming. More specifically, this project will start as a beginners autobiography on Ruby programming using Apple OSX 7 (Lion). You might be wondering if it's a good idea to follow a beginners guide written by a beginner. The answer is probably no. But, then again, how useful have you found the beginners guides written by expert programmers? Rest assured, steps will not be overlooked do to over-estimation of the prior knowledge of the beginner... Me.


The Overall Goal

  • Learn the proper way to install various programming languages on the Unix back-end of Mac OSX Lion
    • Specifically on an Apple Macbook Pro running Lion 10.7x
  • Do something useful with Ruby or Python like scrape the content of a website
  • Auto-format the scraped content and write a script that loads it into Rstudio
  • Use the R programming language to do some statistical analysis on the web data

Unix Tidbits

  • Once upon a time Bell Labs (the phone company) released UNIX to universities including Berkeley and MIT
  • Berkeley grad students (like Bill) improved the original UNIX system and released versions called BSD (Berkeley Software Distribution) UNIX. Sun (SunOS or Solaris), HP, IBM, Bell SysIV, Novell and others continued to tinker with BSD.
  • MIT gurus (e.g. Rich Stallman) made a GNU (Gnu's Not Unix) version of UNIX, which is freely available. Free, meaning you can improve it and sell it, but the source code of whatever you sell is to be free to modify, sell, or give away (in turn, that product is also GNU).
  • A shell is a unix program that takes commands at the terminal
  • There are 2 main shell origins, one by a guy named Bourne and another by Bill. Bourne made the Bourne shell (resulting in ksh and bash) and Bill made the C shell (resulting in csh and tcsh)
    • Bourne shell prompts use a $
    • C shell prompts use a %
  • An exclaimaiton point (a BANG -- !) means do a command again, two (!!) mean do the last command again. One followed by a we letters (!cp) means run the last command that started wit h"cp"
  • To stop a UNIX command press ctrl+c
  • How to pronounce Linux: http://wunsite.unc.edu/LDP/links.html
  • GUI means Graphical User Interface while WIMP means Windows, Icons, Mouse Pointing
  • Xerox made the first GUI, MIT made the second called X Windows
  • At the prompt type %xeyes
  • To open a new xterminal type {%xterm}
  • UNIX commands take options (aka flags or switches) which are typed after a command and use a dash like:
    • %ls -l
    • %ls -a
    • %ls -a -l
    • %ls -al
  • Putting a period (.) before a file name will hide the file, but you can see hidden files using the ls command with flags:
    • %ls -al
  • Preview a text file using 'cat' or 'head'
    • %cat filename
    • %head filename
  • Find your user rights (permissions) using the 'id' command:
    • %id
  • Find the permissions of a file using ls with flags
    • %ls -l filename
  • The permissions of a file will look something like this:
    • -rw-r-r-
      • the first dash will tell you it's a file (if it's a 'd' then it's a directory)
      • the first set of letters will tell you the owners permissions
      • the second set of letters will tell you the permissions of people in the same group as the owner
      • the third set of letters will tell you what anyone can do with the file
  • You can change a file's permissions using '%chmod'
  • Everyone gets a home directory, yours probably looks like this:
    • /usr/yourname/
  • The command '%pwd' will tell you your current directory
  • You can go to, or reference your home directory using a tilde (~)
  • A dot (.) references your current folder, two dots (..) references the parent folder
  • To see files in the parent folder (aka parent directory) type:
    • %ls ..
  • Here are some popular directories:
    • /bin/ system commands
    • /bin/usr/ more system commands
    • /user/local/bin/ non-standard add-on commands
    • /dev/