Both sides previous revisionPrevious revisionNext revision | Previous revision |
classes:psyc410_s15:unix [2014/12/26 14:52] – admin | classes:psyc410_s15:unix [2014/12/26 19:50] (current) – removed admin |
---|
====== Getting started with the Mac Terminal ====== | |
| |
The Mac operating system is a Unix-based on graphical user interface. You can therefore interact with your Mac computer using many (most) of the same commands used in Unix/Linux systems. Many of these commands achieve the same things that you can achieve using 'point and click' methods. For instance, if you wanted to create a new folder on your Mac desktop you could click on your desktop, select ''File'' > ''New Folder''. But you can also create a new folder using Unix commands in Mac's ''**Terminal.app**'' (which can be found in ''Applications/Utilities/Terminal''). This will open a "command line" interface (meaning that you interact with the computer by typing out commands rather than pointing and clicking with your mouse/trackpad). By typing the following commands (press enter/return after each line) you will change the directory of your command-line interface to your desktop and create a new folder entitled "mynewfolder" | |
<code> | |
cd ~/Desktop | |
mkdir mynewfolder | |
</code> | |
| |
<note important>EVERY Apple computer running OS X is built on the Unix platform and comes with the Terminal app pre-installed. If you have a Mac, you have Terminal! So you can get familiar with the Terminal on your own machine.</note> | |
| |
At this point you are undoubtedly thinking "It was way easier to just use the trackpad, so why would I ever want to use the command-line!?" However, the command-line gives you direct control over many aspects of your computer that would be hard (or impossible) to access via the graphical interface. More importantly for our purposes, we can write our commands into a text file and then tell the computer to read the commands from that file (this file is called a "bash script" because the particular Unix language that we'll be using is called "bash".) This is great because it means that every time we do whatever task we've "scripted", we can be certain that we're doing it //exactly// the same way we did it last time. Moreover, if we need to run the task 100 times (e.g. we want to create 100 new folders), we can just tell the computer to read the bash script 100 times. Imagine creating those same 100 new folders by pointing and clicking! | |
| |
The majority of what we do in this course will rely on controlling your computer using the command-line. You should therefore dedicate a sufficient amount of time to getting comfortable with basic Terminal/Unix commands and behaviors. There are tons of useful OS X Terminal and Unix tutorials online. I've selected a few below that you can use to get started. | |
| |
===== OS X Terminal Tutorials ===== | |
*[[http://www.davidbaumgold.com/tutorials/command-line/|Getting to know the command line]] | |
*[[http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line|Introduction to the Mac OS X command line]] | |
*[[http://www.maclife.com/article/feature/25_terminal_tips_every_mac_user_should_know|25 Terminal Tips Every Mac User Should Know]] | |
| |
===== Unix Tutorials ===== | |
| |
*[[http://snap.nlc.dcccd.edu/learn/idaho/unixindex.html|UNIX Introduction]] | |
*[[http://www.ee.surrey.ac.uk/Teaching/Unix/|UNIX Tutorial]] | |
*[[http://unixhelp.ed.ac.uk/|UNIX Help]] | |
*[[http://www.linux.org/lessons/beginner/toc.html|Linux.org tutorial]] | |
*[[http://www.linux-tutorial.info/|Linux tutorial - includes glossary and forums]] | |
*[[http://articles.techrepublic.com.com/5100-10878_11-5827311.html|Top 10 bash shell tips]] | |
| |
===== BASH Tutorials ===== | |
bash is just one of many different Unix "shells" available. Shells are basically different languages for interacting with your computer. We will use bash because it is common, user-friendly, and the default shell on OS X machines. | |
*[[http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html|BASH Programming - Introduction HOW-TO]] | |
*[[http://tldp.org/LDP/abs/html/|Advanced Bash-Scripting Guide]] | |