Configuring/Troubleshooting OS X Using Command Line

The following are some commands that you can use for Configuration &/or Troubleshooting. This list is by no means exhaustive. Do check the man pages for more information. This article assumes familiarity with Terminal commands. If you are new to the Terminal Application, please read the following articles before reading this one.

Terminal Commands for OS X – Basic
Terminal Commands for OS X – Part 2
Terminal Commands for OS X – Part 3

SYSTEM SETUP

softwareupdate

This command is used to install software updates remotely. View the following support article for more information.

dscl

This command is used to manage the different Users & Groups on your Mac. Using this command one can create, modify & view the different settings related to Users & Groups locally on the Mac. Amongst the other things, User Authentication through passwords can also be managed from here. View the man page for more information on the options available.

createhomedir

This command is used to create & populate home folders on the Mac. View the man page for more information on the options available.

systemsetup

As the name says, this command is used to setup the system. One of the more generic commands, using this we can set the date/time, energy preferences & various other settings. View the man page for more information on the different options available.

SECURITY

security

This is the command line version of the GUI application Keychain Access. Use this command to manage your Keychain. Some of the things that can be done using this command include: creating keychains, locking/unlocking keychains, finding your secure information within the Keychain. View the man page for more information on the options available.

FILE SYSTEM TROUBLESHOOTING

fsck

This command is used for running File System Checks. View the man page for more information on the options available.

diskutil

This command is used to run disk utility options. This is the command line equivalent of  the Disk Utility application. There are many operations available within this command line utility that are not available directly in the GUI version of the tool. View the man page for more information on the options available.

fdesetup

This command is used to control the FileVault settings on the Mac. Again, like the distil command this utility gives a lot more options than the GUI version of the Mac. Including the ability to change the recovery keys. View the man page for more information on the options available.

chmod

This command is used to modify permissions to files & folders. View the man page for more information on the different options available.

ln

This is the command used to create both hard links & soft links in the terminal. View the man page for more information on the different options available.

xattr

This command is used to examine &/or modify the attributes/metadata for a given file or folder. View the man page for more information on the different options available.

tmutil

This command allows you to configure &/or setup the Time Machine service. This is the command line version of the Time Machine settings located within System Preferences. View the man page for more information on the different options available.

locate

This command is used to search for files on the Mac. View the man page for more information on the different options available.

hdiutil

This command is also used to manage storage devices & Filesystems. The diskutil & hdiutil are command line versions of the Disk Utility app. View the man page for more information on the different options available.

NETWORK SETTINGS & TROUBLESHOOTING

networksetup

This command is used to set up & configure your network settings. This is the command line equivalent of the Network Preferences located under System Preferences. View the man page for more information on the different options available.

ipconfig

This command lets you view & control the IP configuration settings. View the man page for more information on the different options available.

ifconfig

This command is used to configure the Network Interface parameters. View the man page for more information on the different options available.

route

This command allows you to manually manipulate the routing tables. View the man page for more information on the different options available.

ping

Used to send ping diagnostic requests. View the man page for more information on the different options available.

scutil

Used to manage the System Configuration parameters. View the man page for more information on the different options available.

START/SLEEP/SHUTDOWN

shutdown

This command is used to shut down the Mac from the command line. View the man page for more information on the options available.

sleep

This command is used to put the system to sleep. View the man page for more information on the options available.

reboot/halt

This command is used for restarting the system. View the man page for more information on the options available.

caffeinate

Used to prevent the system from sleeping. View the man page for more information on the options available.

FILE EDITING

There are various editors available for command line. I am just listing a few. A lot of the editing can also be done in the GUI but in some cases the changes have to be done as a Super User. In Such situations loading one of the following editors using the sudo command can come in handy.

Emacs

https://en.wikipedia.org/wiki/Emacs
https://www.gnu.org/software/emacs/
http://www.xemacs.org

Vi

https://en.wikipedia.org/wiki/Vi

Vim

https://en.wikipedia.org/wiki/Vim_(text_editor)
http://www.vim.org

GEdit

https://en.wikipedia.org/wiki/Gedit

Advertisements

One thought on “Configuring/Troubleshooting OS X Using Command Line

  1. Pingback: Automation on the Mac | Arun Patwardhan's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s