Thank you for purchasing through links and ads on this site.
OWC / MacSales.com...
diglloyd Deal Finder...
Buy other stuff at Amazon.com...
Upgrade the memory of your 2019 iMac up to 128GB
877-865-7002
Today’s Deal Zone Items... Handpicked deals...
$849 $489
SAVE $360

$950 $380
SAVE $570

$2799 $2499
SAVE $300

$1499 $899
SAVE $600

$799 $639
SAVE $160

$1180 $1050
SAVE $130

$150 $90
SAVE $60

$2399 $2159
SAVE $240

$1999 $1799
SAVE $200

$1099 $899
SAVE $200

$259 $209
SAVE $50

$1199 $1079
SAVE $120

$599 $199
SAVE $400

$819 $649
SAVE $170

$348 $298
SAVE $50

$2799 $2149
SAVE $650

$750 $450
SAVE $300

$299 $169
SAVE $130

$1099 $899
SAVE $200

$280 $220
SAVE $60

$1299 $1169
SAVE $130

$250 $250
SAVE $0

$998 $498
SAVE $500

Basics of Command Line

Last updated 2013-01-08 - Send Feedback
Related: command line, how-to, software

The command line is a powerful tool which can shorten and simplify many tasks.

However, the command line requires some investment in learning. This page covers a few very basic ideas in using the command line.

  • Lines preceeded with '#' are explanatory comments.
  • The prefix “diglloyd:MPG lloyd$ ” is a prompt emitted by the command line; do not type this; your system will have something of the same form reflecting your own system names.
  • Commands to type are shown in bold.

Very quick general tips for the command line

  • Spaces matter; they are used as separators on the command line. Hence “Macintosh HD” is a nuisance name for a volume, as is any file name with spaces (enclose in straight quotes ""). Hence I name my boot volume “Boot”, which is also shorter and easier to type.
  • Directory paths are separated by a forward slash "/".
  • Case sensitive: Boot ≠ boot ≠ BOOT.
  • The tab key will auto-complete filenames.
  • There are a variety of special characters to be aware of, but the main useful one is the "*" character which can be used to wild card file names instead of typing them out (e.g. “ls *.jpg” to list all .jpg files).
OWC Sizzling Savings

Hot Deals all Week Long

4TB SSD only $348.

LIMITED TIME OFFERS, quantities limited, new deals every day!.

Very brief examples of commands

The very, very basics.

Change directory

# change to home directory
diglloyd:MPG lloyd$ cd
# change to top level of the volume 'Master'
diglloyd:MPG lloyd$ cd /Volumes/Master
# change to top level of boot volume
diglloyd:MPG lloyd$ cd /
# change to Applications folder on boot volume
diglloyd:MPG lloyd$ cd /Applications

List files

# list files in current directory
diglloyd:MPG lloyd$ ls
# list files in current directory, recursively
diglloyd:MPG lloyd$ ls -lR
# list files in directory Photos on volume Master
diglloyd:MPG lloyd$ ls /Volumes/Master/Photos
# list all .jpg and .JPG files in current directory (wild card)
diglloyd:MPG lloyd$ ls *.jpg *.JPG

Run a command in the current directory

# run the command verifyVolumes.sh, found in the current directory
diglloyd:MPG lloyd$ ./VerifyVolumes.sh

diglloyd.com | Terms of Use | PRIVACY POLICY
Contact | About Lloyd Chambers | Consulting | Photo Tours
Mailing Lists | RSS Feeds | Twitter
Copyright © 2020 diglloyd Inc, all rights reserved.
Display info: __RETINA_INFO_STATUS__