Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

oldschool

macrumors 65816
Original poster
Sep 30, 2003
1,029
0
I've been a Mac user all my life, but I only used OSX for the first time last week (on my new pb). My question is, what is the terminal? I know it has something to do with unix...but could somebody explain what I can do with it, and where i can learn how to use commands in it? basically what is it, and how do i use it?
 
The terminal allows you to interact with the BSD (a flavour of Unix) subsystem in OSX. Unix is a command line based OS at the basic level and the terminal gives you access through this (it is actually a terminal emulator). Back in the dawn of (Unix) time you interacted with the system by typing on a keyboard directly attached to the cpu (no more else really the CPU). This was the terminal. You can think of this like DOS in Windows if you want!

Basic commands:

ls : list the files in your current directory
cd : change directory; no arguements changes back to your home directory give the directory you want to change to as an arguement. / is the root of the entire filesystem (i.e. cd /)
more : show the contents of a file a screen at a time. Also see less anc cat.
man : manual i.e. man ls will tell you all about the ls command
vi : Unix editor. About as basic as it can get (ed really is as basic as it can get). Read about this before using it!
open : OSX (and maybe other bsd's) only command. open the file you pass. Used LauchServices to open the file. i.e. open *.jpeg opens all the files with extension jpeg in the current directory in your default jpeg handler (say Preview).

Enough to get started?
 
I think that the biggest question here is, why do you need the Terminal? Granted, the Terminal is very nice if you know how to use it, but do you have any plans for it, or do you just feel that you need to use it because you have it (you shouldn't have to feel like that). The Terminal is a great tool for using open-source and stuff, but it isn't exactly the most user friendly thing on OS X. :)

P-Worm
 
ok thanks. and yes, i wanted to know how to use it because its there.
 
Originally posted by P-Worm
I think that the biggest question here is, why do you need the Terminal? Granted, the Terminal is very nice if you know how to use it, but do you have any plans for it, or do you just feel that you need to use it because you have it (you shouldn't have to feel like that). The Terminal is a great tool for using open-source and stuff, but it isn't exactly the most user friendly thing on OS X. :)

P-Worm

i use it for several purposes, mostly because it's something i got used to.

1) kill commands for processes issued via terminal usually does a better job than the graphical one. (ctrl-opt-esc.)

2) i still haven't gotten out of using pine for my school's email. so it's easiest for me to launch the terminal, ssh to the account and use pine remotely.

3) 'uptime' and 'top' are commands i use fairly often to check the system status.

i agree it's not really user friendly in that it's not very useful unless you know how to use it already. that's probably one of the reasons why it's tucked under "utilities" folder and not a full blown "application" folder.

i find 2) to be good... i ssh'ed from japan a few times during vacation without worrying about leaving various cached data, which may happen if i were to use a browser based mail program. all i left on the demo mac at an electronics store in japan is the ssh key.

btw, if you get stuck in vi, to get out, press "esc" then ":q!" :D
 
the more i learn about osx, the more i use the terminal. i think i launched it once or twice in the first year of using osx, but now it's one of those apps that's always open.
 
I think that it is really encouraging that Mac OSX is helping people to learn more about Unix. You can learn a lot about what your computer is actually doing and how it works using the Terminal. But you can really screw up as well.

Keep at it!
 
here's a useful quick reference:

http://www.verysimple.com/scripts/support_unix.html

As for text editors, i prefer Pico to Vi/Vim.

I'm a big user of terminal - its very handy when you have multiple computers. For example:

I have a redhat server at home, so when i'm out on the road on my iBook, i can SSH into my server and get at all my files onto my iBook and pick up where i left off on a website.

Its remarkably easy to use - even though it seems a little daunting to start with. I suggest you get a book on unix if you're serious about getting to grips with it.

The fact that OSX is unix based is one of the coolest things about it - OSX itself is so easy to get around, configure and use which appeals to computer n00bs, and switchers, yet there's stuff like the unix core which appeals to hardcore nerds! Very versatile OS.
 
Originally posted by mrjamin
...
As for text editors, i prefer Pico to Vi/Vim.
...

No... Noo.... No Pico please!!! Give me vi!!

:)

As for using top, in Linux land you can hit P to sort by proc usage... Anyone know the OS X counterpart? I tried P and it didn't work.
 
Originally posted by tomf87
No... Noo.... No Pico please!!! Give me vi!!

Amen brother; preach it.

Once you get used to it, vi is slicker and faster then just about any editor on the planet.

One a seperate note, the terminal is WHY I got a mac.
 
Originally posted by beerguy
Amen brother; preach it.

Once you get used to it, vi is slicker and faster then just about any editor on the planet.

One a seperate note, the terminal is WHY I got a mac.

..you could just buy a load of crappy pc bits and install linux on it of course...
 
The terminal is pretty useful but there's no point using it if you don't have anything to do with it.

Granted, you can always have some "fun" by checking stats such as "uptime" and "top" and even "ac -p" but when actually using it for a purpose, it becomes infinitely more useful. (did i just state the obvious?)
 
Originally posted by beerguy
Amen brother; preach it.

Once you get used to it, vi is slicker and faster then just about any editor on the planet.

One a seperate note, the terminal is WHY I got a mac.

i remember the days i used to use vi... switched to pico now, but at the time, vi was pretty good.

a friend of mine is a vi fanatic. he likes it because you don't need to lift your fingers off the keyboard ever to access all the functions in vi.
 
Originally posted by jxyama
i remember the days i used to use vi... switched to pico now, but at the time, vi was pretty good.

a friend of mine is a vi fanatic. he likes it because you don't need to lift your fingers off the keyboard ever to access all the functions in vi.

i have to admit that Vi looks pretty powerful, it just takes a bit too much learning to get to grips with at the moment. I have enough stuff on as it is!
 
The way I've taught people to use 'vi' is to organize the keystrokes they'll use into groups, so they can learn 4 the first day, 4 the next day, etc. The same idea as those "learn a new word every day" desk calendars.

I like 'vi' because it is ubiquitous. Historically, most of the other editors were shipped with some, not all, Unix variants. Being a user of half a dozen versions of Unix, I needed to learn an editor that would always be available.

Do I think that's a reason for beginners to use it under Mac OS? No. I use it because I know it, but since vi is hard to learn and often awkward to use, consider other choices before committing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.