OSX Terminal Fun I: The Basics
Pretty basic stuff here, but it might help some new users get their bearings if they're used to traditional applications. When you open up the terminal (under /Applications/Utilities/) in OSX, the first thing you see is "Welcome to Darwin" followed by a prompt. The terminal is just a graphical tool to use Shells... in this case, the terminal automatically logs you into the system as the admin user.
Where you see the "%" sign, type "ls" and you will see a listing of files of the directory the shell has automatically logged you into, most usually the "Home" folder of the user you are logged in as (which is shown as a "~"). It's good to bear in mind that when you type "ls" the Terminal.app isn't following your command and showing you the list of files, but rather you are invoking the ls application located at "/bin/ls".
The ls application launches, looks at the directory you, retrieves the list of files and then displays them to the shell, which the Terminal.app then shows to you. This lets you do uber-cool stuff, such as piping commands together. For instance, assuming you haven't changed directories, type this:
% ls | grep "Pictures"
If you compare that to the output you got by using 'ls' the first time, you'll see that you now only see the directory called "Pictures". What you've done is piped (the "|" key) the output from the first application (ls) to the second application (grep) and told grep to find anything that has "Pictures" within it and display it.
Make sense? You aren't controlling the Terminal.app per se, but rather using the Terminal.app to control unix applications which then deliver their output to the terminal, which then shows you the result. Understand will make it a lot easier to wrap your head around using shells and the Terminal.app in the long run.
Comments (2)
Posted by: sophia at June 15, 2004 07:47 PM
haha i keep forgetting i have terminal on here.








OK, now on to lesson 2.
Thanks!