CommandLine

Like any Unix-based operating system, OS X has a command line interface, which exists independently of and prior to the graphical interface. The Unix-based part of OS X is called Darwin. We normally access it through the TerminalApp, in the Utilities folder.

Some other ways:

  • Enter ">console" in the LoginWindow.
  • During start-up, hold down command-S (or option-shift-L for a read-only mode).
  • type 'sudo shutdown now' at a TerminalApp command line, and OS X will shut down to single-user mode.

When you're done, 'logout' or 'reboot'.


New to the command line? [WWW]Command line Interface Tutorial for Newbies


Q. How can I lock/unlock a file on the CommandLine?

A. Mac OS X uses the immutable bit to designate that a file is locked. To lock a file:

[localhost:~] you$ chflags uchg /path/to/file 

And to unlock a file:

[localhost:~] you$ chflags nouchg /path/to/file 


Q. How can I see on the CommandLine if a file is locked?

A. Use the -o flag of the ls command:

[localhost:~] you$ ls -lo 
-rw-r--r-- 1 you staff - 5 Apr 12 14:05 ping.txt 
[localhost:~] you$ chflags uchg ping.txt 
[localhost:~] you$ ls -lo 
-rw-r--r-- 1 you staff uchg 5 Apr 12 14:05 ping.txt 


1 Some Useful Commands

open filenameopens a file as though you clicked on the icon for it
man commandname open the ManualPage for the command, find the exact usage for a command


Q. My Terminal.app (runs a funny script|looks odd|does nor do the right thing|too big|too small| is in the wrong place) when it starts up. How can I stop it doing that bad thing?

A. Like any good OSX app, it keeps it's settings in your Library/Preferences folder. The file is called: com.apple.Terminal.plist This is an XML PropertyList file. If you have PropertyListEditor you can change it's values instantly, otherwise any text editor will do.


Q. Is there a better terminal than Terminal.app?

A. ((iTerm.app)) is what you need. This freeware terminal tool emulates a number of common terminal types and has support for tabs. -- http://iterm.sourceforge.net/


Other pages that may have CommandLine examples:

  1. CommandLine . . . . 4 matches
  2. TerminalApp . . . . 2 matches
  3. ssh . . . . 1 match
  4. VirtualMemory . . . . 1 match
  5. UsersAndGroups . . . . 1 match
  6. ServerAdmin . . . . 1 match
  7. ScreenSavers . . . . 1 match
  8. ResExcellence . . . . 1 match
  9. QuestionAnswerTemplate . . . . 1 match
  10. ManualPage . . . . 1 match
  11. LoginWindow . . . . 1 match
  12. HiddenFeatures . . . . 1 match
  13. FontManagement . . . . 1 match
  14. FileSharing . . . . 1 match
  15. DiveIntoOSX . . . . 1 match
  16. DirectoryServices . . . . 1 match
  17. Darwin . . . . 1 match
  18. BootProblems . . . . 1 match


Other sites that have CommandLine examples: