February 23rd, 2007

Part 3: Helpful Command-Line Commands (Mac OS X)

By Kyle Reasons

Contributing Writer, RealTechNews

Mac OS X
General

  • cat
  • Displays the contents of a file to the screen
  • cd
    • Changes to another directory
  • chgrp
    • Changes the group associated with one or more files to a different group
  • chmod
    • Controls file security
  • chown
    • Changes file ownership
  • chsh
    • Sets your login shell
    • cmp
    • Used to compare two files
  • cp
    • Copies a file to another directory
  • df
    • Shows a report of how the disk space is used
  • dump
    • Backs up files
  • edquota
    • Used to edit disk quotas associated with user accounts
  • fdisk
    • Formats and partitions a disk
  • file
    • Displays the file type

    • find
    • Used to find specific files
  • fsck
    • Performs a verification of the file system
  • grep
    • Looks for a string of characters in a file
  • kill
    • Stops a process
  • less
    • Shows the contents of a file with the ability to go back or move ahead in the file
  • ln
    • Creates symbolic file links
  • lpq
    • Used to check a print queue
  • lpr
    • Prints a file
  • lprm
    • Removes print jobs from the queue
  • ls
    • Lists the contents of a directory
  • man
    • Displays documentation
  • mkdir
    • Creates a directory
  • more
    • Displays text in a file one screen at a time
  • mount
    • Lists the disks currently mounted; also mounts file systems and devices
  • mv
    • Moves a file to a different directory
  • newfs
    • Creates a new file system
  • passwd
    • Used to change a password
  • pr
    • Used to format a file into pages or columns for printing
  • printenv
    • Prints environment variables that are already set up
  • ps
    • Shows currently running processes
  • pwd
    • Displays the directory you are in
  • quota
    • Displays the disk quota for users
  • quotacheck
    • Verifies the disk quota files, including reporting disk usage
  • quotaon/quotaoff
    • Enables or disables disk quotas
  • rcp
    • Performs a remote copy
  • repquota
    • Makes a report of disk quotas
  • restore
    • Restores files (from a dump)
  • rm
    • Removes a file or directory
  • rmdir
    • Deletes a directory that is empty
  • scp
    • Secure version of ftp or rcp
  • sort
    • Sorts the contents of a text file
  • ssh
    • A secure version of ftp
  • sync
    • Forces information in memory to be written to disk
  • tar
    • Used to archive files
  • telnet
    • Used to remotely connect to another computer
  • top
    • Shows a report of the main, current processes engaging the CPU
  • touch
    • Creates an empty file
  • unmount
    • Dismounts a file system
  • uname
    • Shows information about the machine and operating system
  • vm_stat
    • Displays a report about virtual memory use
  • whereis
    • Locates a specific file

    Network Commands

    • finger
    • Provides information about a user
  • ftp
    • Enables file transfers
  • ifconfig
    • Used to set up a network interface
  • netstat
    • Shows network connection information
  • nfsstat
    • Shows statistics for NFS file upload and download activity
  • nslookup
    • Used to query information on Internet DNS servers
  • ping
    • Used to poll another TCP/IP node to verify you can communicate with it
  • route
    • Displays routing table information and can be used to configure routing
  • showmount
    • Shows clients that have mounted volumes on a NFS server
  • who
    • Shows who is logged on
    Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
    • del.icio.us
    • digg
    • Fark
    • NewsVine
    • Reddit
    • YahooMyWeb
    You can leave a comment, or trackback from your own site. RSS 2.0

    4 comments to "Part 3: Helpful Command-Line Commands (Mac OS X)"

    1. Mantawolf says:

      Doesnt an operating system need to be used by real people before the commands can be considered useful?

      :p

      wait for it…

      February 23rd, 2007 at 11:26 am

    2. ed3 says:

      See my comments back on Part 2… :)

      Most of these commands are some 20/30 years old and are not limited to Mac OSX.

      Heck, install Cygwin or GNU Coreutils and you too can have a very powerful UNIX-like shell on your Windows system. Write a script once in ksh and it’ll run practically anywhere.

      Write a bat script in Windows/DOS commands and it’ll run on… Windows/DOS systems.

      February 25th, 2007 at 7:18 am

    3. Kyle Reasons says:

      Thanks for the tip ed3. :)

      February 25th, 2007 at 8:51 am

    4. Druid says:

      Ed3, I am a Cygwin user at work and would also recommend it to Windows users who need a touch of Unix. BUT, having said that, my real recommendation to anyone wanting Unix is: get a Mac. As I rummage around the config files in OS X I see a lot of references to FreeBSD due to OS X’s roots. The Mach kernel is not “Unix-like” is IS Unix. My recent switch to being a Mac user wasn’t me running ‘from’ Windows, it was me running ‘to’ OS X (and ‘from’ Linux).

      February 27th, 2007 at 1:12 pm

    Leave a comment