A Digital Age Deserves A Digital Leader

Macintosh OS X Terminal Commands

Macintosh OS X Terminal Commands

Postby gries818 » Sun May 03, 2009 4:15 am

Macintosh OS X Terminal Commands

Created/Updated: 05.02.09
Tested With: Macintosh OS X Leopard

Apple's Macintosh OS X differs from previous Macintosh OS releases (9, 8, etc) in that it uses a FreeBSD/NetBSD kernel UNIX implementation (Darwin), meaning that many of the same commands that can be used in Linux or Unix can also be used in OS X. To access the Terminal (similar to the Command Prompt for Windows users), open Finder and go to Applications/Utilities and double click on 'Terminal'.

Please ignore parenthesis when using these commands

  • ../ - represents one directory higher
  • cat filename - display file contents
  • cat stuff1 stuff2 > allStuff - combine files
  • cat someStuff >> allStuff - append to a file
  • cd dirName - go into the directory dirName
  • chmod [permission mode] file - change the permission of a file
  • chown user file - change the owner of a file
  • clear - clear the terminal
  • cp file1 file2 - copy file1 to file2
  • date - print current date and time
  • df - displays how much space on the disks (harddrive partitions) is free
  • du [-a] [-s] directories - tells you how much disk space your files occupy; the -a option displays the space used by each file, not just each directory; the -s option displays the total space used for each directory but not subdirectory
  • find someStuff - locate a file or directory
  • finger user - get some info about a user
  • ftp - hostname connect to an ftp server
  • gcc (file.c) - compiles C source into a file named 'a.out'
  • gzip - best compression for UNIX files
  • halt - shuts down the machine
  • hostname - display the hostname of the computer
  • killall (application or process name) - Terminates Application or Process Name
  • less file - view file in terminal with ability to scroll up and down
  • ln sourceName destDirectory - create symbolic link to a file
  • locate file - locate a file from a database maintained by the computer
  • login - login to the computer
  • logout - logs you out of a Telnet session
  • lpr - file sends a file to the print spooler
  • ls - list the contents of the current directory
  • ls directory - list the contents of a given directory
  • make - compiles source code
  • man - program display manual pages for a program
  • mkdir directory - create a directory
  • more file - view file in terminal with ability to scroll down
  • mv source target - move a file
  • nslookup (IP address or server alias) - provides conversion of an IP address to an alias of a computer if it is registered in DNS (Domain Name Service) or will provide the IP address for an alias
  • passwd user - change a user's password
  • ping (IP address or server alias) - sends a ping packet to another server; this provides information concerning the time it takes for information to make the round trip to the other computer; it will also tell you whether the other server is on-line at that time
  • pwd - print the full pathname of the current directory
  • quota user - display the disk quota allocated to a user
  • rm file - delete a file
  • rmdir directory - delete a directory
  • rm -rf - anything forcefully delete something (like a directory, recursively)
  • sh - the standard Unix shell, bash
  • shutdown -r now - restarts the machine
  • ssh - hostname open an ssh session
  • sudo su - switch to the superuser's (root's) identity
  • su user - switch to another user's identity
  • tail file - print the last 10 lines of a file
  • talk username@servername - allows you to talk to another user by typing messages to each other on-screen; to prevent someone from talking to you, see the mesg n command
  • tar - combines multiple files into one or vice-versa
  • telnet hostname - open a telnet session
  • traceroute IP address or server alias - provides information concerning the route which packets must take to get from your computer (the server in this case) to a remote computer/server; typically used to diagnose possible problems in packet routing
  • touch file - update the access time and last modified time for a file to the current time and date
  • uname -a - print system information
  • update db - update file database used by locate command
  • vi file - open a file in the vi or vim text editor
  • w - provides information concerning who is logged into the system and some details on how they are connected
  • whoami - gives information about the current user
  • who am i - gives more information about the current user
  • who -uH - gives info and idle times for all users
  • write username - sends a message to another person using the system; to prevent someone from writing to you, see the mesg n command
  • zip - zip for IBM files

This list was inspired by the List of Linux User Commands. Thanks to all the PROnetworks members that contributed to the creation of both lists. :notworthy

Please post any additions or corrections to this list.
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Return to Other Operating Systems

Who is online

Users browsing this forum: No registered users and 4 guests

cron
cron