• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Mac Terminal help

5.00 star(s)
the other cool way to learn unix commands is to cd into the directories /usr/bin and /usr/sbin and run the ls command

now look at all the commands and pick several per day and read the man page for them

for instance for a starter i would look at
man ls
man ifconfig
man grep & zgrep
man awk
man sed

Although Sed and Awk are redundant because you have perl installed and it has far better pattern and string manipulation :D


(stands back and waits for a holy war to start!)
 
the other cool way to learn unix commands is to cd into the directories /usr/bin and /usr/sbin and run the ls command

now look at all the commands and pick several per day and read the man page for them

for instance for a starter i would look at
man ls
man ifconfig
man grep & zgrep
man awk
man sed

Although Sed and Awk are redundant because you have perl installed and it has far better pattern and string manipulation :D


(stands back and waits for a holy war to start!)

Not a bad suggestion.

(There, that surprised the sh!t out of you, didn't it?)
 
If you're interested in learning more about the MAC command line, I recommend you get a copy of Mac OS X Unix 101 Byte-Sized Projects - Adrian Mayo - Google Books

A mate of mine wrote it.


Mac OS X Unix 101 Byte-Sized Projects

Peachpit Press, Dec 15, 2005 - 614 pages
Unix is no longer someone else's OS. With Mac OS X built on top of it, Unix is becoming a household name, and more and more Mac users are ready to take it on. This book is for them! Based on a popular series of Unix tips, this book promises to deliver what most other Unix guides fail to: comprehensive tutorials and instruction on specific Unix subjects, commands, and projects, not just a handy reference guide. Arranged into 101 mini tutorials in 11 key technology areas, this book provides all the tricks, techniques, and training that you need to understand how the system works and start using it immediately. You will quickly learn the basics to working with the Unix command line as well as work on specific tutorials/exercises, including: browsing and searching the directory file-system; viewing, searching, and processing file content; using text editors; shell scripting; cool commands; and more.

Using Mac OS X is indeed a good way to learn Unix, because you can do it at your own pace.

That book looks excellent. I wish I'd come across it when it was first published.
 
the other cool way to learn unix commands is to cd into the directories /usr/bin and /usr/sbin and run the ls command

now look at all the commands and pick several per day and read the man page for them

for instance for a starter i would look at
man ls
man ifconfig
man grep & zgrep
man awk
man sed

Although Sed and Awk are redundant because you have perl installed and it has far better pattern and string manipulation :D

(stands back and waits for a holy war to start!)

I'd still get a grounding in Sed and Awk though in case you come across them in existing scripts and examples.

Man reading tip: If you find it hard work scrolling back and forth in the man utility , look for their web equivalents:
Mac OS X Manual Pages
Yet another way to read beautifully formatted man pages
 
Last edited: 14:44
I've got the O'Reilly Sed and Awk which is quite comprehensive (Second Edition which came out in 1997 - don't suppose much has changed; it was the equivalent of 25 quid then).

The BBEdit folks reckon that Chapter 8 of their User Manual is good for learning regular expressions. PDF available from the BBEdit Support Page. BBEdit is the paid version of TextWrangler, with a pile of extra goodies that folks obviously find worth the price.
 
Not sure what you mean mate? it's a manually typed command, not a script. (sorry, new to the Mac terminal...)

If you want to know if a particular command is a shell script or a proper binary you can use 'which' and 'file':
Code:
bash-4.2$ which firefox
/usr/local/bin/firefox
bash-4.2$ file /usr/local/bin/firefox 
/usr/local/bin/firefox: symbolic link to `/opt/firefox/firefox'
bash-4.2$ file /opt/firefox/firefox
/opt/firefox/firefox: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
Code:
root@local:~# which slackpkg
/usr/sbin/slackpkg
root@local:~# file /usr/sbin/slackpkg 
/usr/sbin/slackpkg: POSIX shell script, ASCII text executable

EDIT: the above was done on Slackware, on the Mac you'll have different results of course.
 

Advertisers

Back
Top