Terminal For Mac Commands

 

See full list on macpaw.com. While of course, it is not the case, knowing Mac Terminal commands will give you an upper hand in mastering the MacOS environment. As a Terminal emulator, it provides you with text-based access to the operating system. It’s a quicker way of navigating the operating system, provided that you are familiar with the Terminal commands on Mac.

  • Feb 06, 2017 For the modern era, and according to the Terminal command swvers, it’s called “Mac OS X” but I wouldn’t expect a newbie like Christopher who doesn’t know Macs or the command line and instead goes on the latest whims of a marketing team to know that.
  • 1 day ago  Essentially all I have is a loop from 0-1000, but I want to make it so that every time a number is a multiple of 7 occurs, open a terminal window and type the following lines: cd desktop/testfolder; node testScript.js; 7 commands would be: cd desktop/testfolder; node.

This is a complete A- Z index of all Mac commands and the terminal events associated with those commands. We have compiled this list by using official sources and have explained more clearly and elaborately about each of them. We have also added two additional columns specifying whether or not the command is an inbuilt system one. The final column also displays the Mac version support for each of these commands.

IMPORTANT: If you are not an advanced user and have no knowledge on how to use the terminal commands, please do not try to experiment. These are meant for medium and advanced users ONLY.

Mac Terminal Commands – A to Z

Command

InBuilt

Command Action and Event

All

alias

Yes

Creation of a Alias for current User

Yes

alloc

No

Free Memory is Listed

Yes

apropos

No

String search in What is database

NA

awk

No

Scan and overwrite Text inside file and files

NA

basename

No

Change full path name to path name

NA

bash

No

Bourne-Again Shell

NA

bg

Yes

Send to background

Yes

bind

Yes

Read line Key is displayed

Yes

bless

No

Assign Boot and start-up options

NA

break

Yes

Exit a redundant loop

Yes

builtin

Yes

Execute a built in shell command

Yes

bzip2

No

Compress and decompress a file

Yes

cal

No

The calendar is displayed

Yes

caller

Yes

Subroutine call context is returned

Yes

case

Yes

Conditional statement

Yes

cat

No

Append and Display file content

Yes

cd

Yes

Change current Directory

Yes

chflags

No

Change flags

NA

chgrp

No

Modify Group Ownership

NA

chmod

No

Change group permissions

NA

chown

No

Modify File owner and permissions

NA

chroot

No

Execute a command using another root directory

NA

cksum

No

Print and display checksum

NA

clear

No

Clear current terminal screen contents

NA

cmp

No

Simply compares two files

NA

comm

No

Line by line comparison of two sorted lines

Yes

command

Yes

Run or Execute a command

Yes

complete

Yes

Edit or modify completion of a command

Yes

continue

Yes

Resume a loop

Yes

cp

No

Copy Command

NA

cron

No

Run or Execute a prescheduled command

NA

crontab

No

Schedule command for execution after an assigned time

NA

csplit

No

Split a file into context-determined pieces

NA

curl

No

Upload or download data from a server

NA

cut

No

Cut a file into parts

Yes

date

No

Display or modify date time

Yes

dc

No

Display Desk Calculator

NA

dd

No

(Copy a file) Data Dump

NA

declare

Yes

Declare and assign attributes for a variable

Yes

defaults

No

Set visual preference options for hidden files

NA

df

No

Show unused disk space

Yes

diff

No

Show difference between two files

Yes

diff3

No

Show difference between three files

NA

dig

No

Command to lookup DNS details

NA

dirname

No

Convert full path name to path

NA

dirs

Yes

Display cached directories

Yes

diskutil

No

Disk utility command

Yes

disown

Yes

Remove a job from current session

Yes

ditto

No

Same as copy command

Yes

dot_clean

No

Remove dots and underscores from a context files

NA

drutil

No

Disk drive utility command

NA

dscacheutil

No

Flush DNS or cache

NA

dscl

No

Command-line utility for directory service

Yes

dseditgroup

No

Manage groups and users

Yes

dsenableroor

No

Command to enable root access for a terminal

NA

dsmemberutil

No

Show groups and users rights

NA

du

No

File space usage estimation

NA

echo

Yes

Display an entered message on the screen

Yes

ed

No

A text editor program

Yes

enable

Yes

Enable or disable system shell commands

Yes

env

No

Display or Modify environment variables

Yes

eval

Yes

Evaluate one or more commands or arguments

Yes

exec

Yes

Execute command

Yes

exit

Yes

Exit shell

Yes

expand

No

Expand a Tab

NA

expect

No

Pre assigned dialogue exchange for interactive programs

NA

export

Yes

Assign environment variable

Yes

expr

No

Evaluate an expression or set of expressions

Yes

fc

No

Fix command

NA

fdisk

No

Format disk command

NA

fg

Yes

Bring a job to front

Yes

file

No

Analyse file type

Yes

find

No

File search matching requested criteria

NA

fmt

No

Reformat Text in a paragraph

NA

fold

No

Wrap text to automatically adjust with working area

NA

for

Yes

Simple Loop command

Yes

fs_usage

No

File system display usage

Yes

fsactl

No

Enable or disable ACL support for File System

NA

fsck

No

Check and repair file systems

NA

ftp

No

FTP manager

NA

getfileinfo

No

Get file attributes

Yes

getopts

Yes

Parse the positional parameters

Yes

goto

No

Jump to an assigned point and then continue program execution

NA

grep

No

Search file with a certain pattern

NA

groups

No

Display a user’s group name

NA

gzip

No

Compress and decompress a file

Yes

halt

No

Shutdown and Restart the system

NA

hash

Yes

Refresh command cache and path names

Yes

hdiutil

No

Hard drive interface Utility Tool

Yes

head

No

Print first line from a text file

Yes

history

Yes

History Command

Yes

hostname

No

Display or modify System name

NA

iconv

No

Convert character set of file(s)

NA

id

No

Display user and group IDs

Yes

if

Yes

Conditional Command statement

Yes

info

No

Display help information

NA

install

No

Copy and assign attributes of a file

Yes

ipconfig

No

Configure network attributes and assign values

NA

jobs

Yes

List all currently active jobs

Yes

join

No

Join command

NA

kextfind

No

List the kernel extension

NA

kickstart

No

Configure and set Apple Remote Desktop properties

NA

kill

No

Terminate a process directly

Yes

l

No

List file in original long format

NA

last

No

Indicate last login information of a users and additional info

NA

launchctl

No

Launch daemons or agents

NA

less

No

Display output on screen accommodating data per window

NA

let

Yes

Evaluate an expression or set of expressions

Yes

lipo

No

Convert binary format

Yes

ll

No

List file in original long format, also display hidden files

Yes

ln

No

Interlink files

NA

local

Yes

Assign local variable

Yes

locate

No

Find a file or files

Yes

login

No

log-in your system

NA

logname

No

Display current users login name

NA

logout

Yes

Exit login shell

Yes

lpr

No

Print file or files

Yes

lprm

No

Remove queued print jobs

Yes

lpstat

No

Printer info and current status

Yes

ls

No

List a file information

NA

lsof

No

List currently opened files

NA

lsregister

No

Reset Launch Service database

NA

man

No

Display Help manual

Yes

mdfind

No

Spotlight search command

Yes

mdutil

No

Spotlight search command utility

Yes

mkdir

No

Create new directory

Yes

mkfifo

No

Build FIFOs

Yes

more

No

Display output data one screen at one time

NA

mount

No

Mount a file system

NA

mv

No

Cut or rename directories or files

NA

nano

No

Bring up text editor

Yes

net

No

Configure network resources

NA

netstat

No

Display network information

NA

networksetup

No

Assign network attributes

Yes

nice

No

Set command priority

NA

nohup

No

Hang-up a command

NA

ntfs.util

No

NTFS utility command

Yes

onintr

No

Control shell action

NA

open

No

Open up a file or location

NA

osacomplie

No

Command to Compile an Apple script

NA

osasdript

No

Execute an AppleScript

NA

passwd

No

Modify user password directly

Yes

paste

No

Merge lines from two or more files

Yes

pbcopy

No

Copy the data to clipboard

NA

pbpaste

No

Paste the data from Clipboard

NA

ping

No

Check a network connection

NA

pkgutil

No

Display or change Installed packages info

NA

plutil

No

Property list command utility

Yes

pmset

No

Configure Power Management settings

Yes

popd

Yes

Restore previous value of current directory

Yes

pr

No

Modify Text files to print

Yes

printenv

No

Display all environment variables

Yes

printf

Yes

Print command

Yes

ps

No

Display Process status

Yes

pushd

No

Save and change current directory

NA

pwd

Yes

Print currently Working Directory

Yes

quota

No

Display disk limitation and usage

Yes

rcp

No

Copy files across machines/systems

Yes

read

Yes

Read first line from an output file

Yes

readonly

Yes

Assign read only attribute to a file/directory

Yes

reboot

Yes

Reboot a system

Yes

return

Yes

Exit Function

Yes

rev

No

Reverse file lines

NA

rm

No

Remove file(s)

NA

rmdir

No

Remove directory(ies)

Yes

rpm

No

Bring up Remote Package Manager tool

Yes

rsync

No

Remotely copy a file

NA

say

No

Text to speech conversion

NA

screen

No

Manage Multiplex terminal and run remote shells via ssh

NA

screencapture

No

Capture the screen image

Yes

sdiff

No

Merge or modify two files

Yes

security

No

Configure security options for a system

Yes

sed

No

Stream Editor Utility

NA

select

Yes

Display list of Items

Yes

set

Yes

Set shell variable

Yes

setfile

No

Set file attributes

NA

shift

Yes

Shift positional parameters

Yes

shopt

Yes

Configure shell options

Yes

shutdown

No

Shutdown/restart Mac OS X

NA

sleep

No

Sleep after an assigned time frame

Yes

softwareupdate

No

Software Update Command

Yes

sort

No

Sort the text files

Yes

source

Yes

Execute command from file

Yes

split

No

Split files into like sized pieces

NA

stop

No

Stop a process or currently running job

NA

su

No

Substitute a user identity

Yes

sudo

No

Execute command as some other user

Yes

sum

No

Print checksum value for a file

NA

suspend

Yes

Suspend shell execution

Yes

sw_vers

No

Print Mac Operating System version

NA

system_profiler

No

Report a system configuration

Yes

tail

No

Display the last lines from a file

NA

tar

No

Archiver Utility

Yes

tcpdump

No

Network Traffic dump

NA

tee

No

Redirect multiple file output

NA

test

Yes

Conditional evaluation

Yes

textutil

No

Modify Text file formats

NA

time

No

Calculate Program Resource Usage

Yes

times

Yes

Print shell along with shell process time

Yes

top

No

Display process related information

Yes

touch

No

Change the file timestamps info

Yes

tr

No

Modify Characters or delete them

NA

traceroute

No

Display Trace Route path to assigned host name

NA

trap

Yes

Execute command when shell receives signal

Yes

tty

No

Print terminal filename on stdin

NA

type

Yes

Describe command name and type

Yes

ufs.util

No

Mount or unmount a UFS file system

NA

ulimit

Yes

Limit system resources usage

Yes

unalias

Yes

Delete an alias

Yes

unamask

No

Mask User file creation

NA

uname

No

Print System Info

Yes

unexpand

No

Space to tab converter

Yes

uniq

No

Uniquify the files

Yes

units

No

Unit scale converter command

NA

unmount

No

Unmount a mounted device

NA

unset

Yes

Remove function or variable names

Yes

until

Yes

Loop command

Yes

uptime

No

Display System Runtime information

NA

users

No

Print all username of the current session

NA

uucp

No

Unix to Unix copy command

Yes

uudecode

No

Decode a file

NA

uuencode

No

Encode a file

NA

vi

No

Visual Text Editor

Yes

wait

Yes

Wait for process completion

Yes

whatis

No

Search what is database

NA

where

No

Report all command instances

NA

while

Yes

Loop command

Yes

who

No

Print all names of the users of the current session

NA

whoami

No

Display or Print current username and info details

NA

write

No

Send a user a message

NA

xargs

No

Execute utility by passing arguments

Yes

yes

No

Print a string value until and unless interrupted by a user

NA

Foot note: N/A – Data not available.

If you feel this list lacks any particular command which has been recently added to the Mac terminal, you can improve this article by mentioning it in the comment section.

Apple's macOS platform includes Terminal, which is equivalent to Command Prompt in Windows OS. Since the macOS is based on UNIX, Terminal might give you a vibe of a dangerous tool where one wrong command can wreck your system. Sure, it is valid only to an extent. There are a bunch of harmless commands that are usable in customizing the interface and other settings of macOS.

The Terminal on macOS can be extremely useful in tweaking the performance of your Mac. Now it entirely depends on what you want to achieve. In case you have been dreading to use it, you can always get comfortable by using simpler tricks. Here are the top 11 terminal command tricks to try on your Mac.

Also on Guiding Tech
How To Speed Up a Slow Mac
Read MoreNote: While selecting/copying a command, make sure you scroll all the way towards right to select the complete command in the gray box. Otherwise partial commands will not work as intended.

1. Open Folders

One of the coolest ways to get familiar with the Terminal is to use it to open files and folders. I know that clicking on Finder will do the same. However, using Terminal, you can open a specific folder or a file without exposing your file structure to anyone.

Let's say you want to open your Documents folder. Then you can type the following command and then hit Enter.


And that opens my Documents folder. There's a DOCX file in there. I can use Terminal to open that too. For that, you need to type out the command with some requirements — the path of the respective file:

Open -a 'Application Name' /Path/to/File

So for opening the DOCX file in the Documents folder of my Mac, I typed in the command below and then hit Enter:


That opens up the specific file using the predefined program. You can also use the wildcard character (*.extension) instead of the full filename. However, if you have more than one file in carrying the same extension, then it might freeze your Mac for a bit.

2. Change Default Save Screenshot Location

By default, the macOS Mojave stores the screenshots on the Mac's desktop. Now if you have iCloud sync enabled, which I am sure you do, then it keeps uploading to your account. Thankfully, you can change the save location for the screenshots instead of crowding your desktop.

Here's the command you need to type before hitting Enter:


In the above command, you can provide any specific file location instead of ~/Downloads as shown.


After hitting Enter, I need to reset the SystemUIServer for the changes to take effect immediately. So feed in the following command.


Though it is not required, I would recommend restarting your Mac.

3. Change Screenshot Image Type

The macOS saves the screenshots in JPG format by default. You can change that to save them in PNG or PDF formats too. Here's how to do that quickly with this specific command:

Terminal For Mac Commands Software


After that, you need to kill the SystemUIServer again.
Most commands which require some system changes shall mandate shutting down the SystemUIServer. So do that quickly.


Now, your new screenshots will save in the PNG format. Do note that PNG files are generally larger than JPG files. So keep an eye on how much storage space they consume.

4. Show Hidden Files

Have you tried looking for the option to let the Finder show hidden files? Well, it is tougher than picking the show hidden files on Windows. I always forget how to enable that. Thankfully there is a helpful command that makes it happen in a few seconds.


After that, you need to force shut the Finder.


Now you should see a lot of hidden files in the Finder. They would be greyed out but still visible. If you roll back this change, then you need to change TRUE to FALSE in the command.

5. Switch Off the Dashboard

Apple promoted the Dashboard view to access calculator and sticky notes quickly. I bet you rarely use that one for you can launch the Calculator app or Sticky Notes app using Mission Control of Spotlight. So you can switch it off and don't have to worry about opening it by mistake.

Here's the command to turn off the Dashboard.


Next, you must kill the Dock so that the changes are correctly applied.


Now I don't have to worry about accidentally opening the Dashboard. If you want to switch it on again, then change TRUE to FALSE in the command.

Terminal For Mac Commands
Also on Guiding Tech
How to Install New Fonts in Mac OS X
Read More

6. Download Files

Did you know that you can download files using the Terminal? Yes, you don't need to keep the browser running just for that file. The only requirement here is that you must have the file's download link. So the command syntax is:

curl -0 downloadlink

First, navigate to the folder where you want to download the file. For that, you need to switch to the Downloads directory.


After that, you can feed the command to download the VLC for macOS from the official site. It would appear something like this:

Note: There is a letter O in the command and not the 0 (zero).

7. Ditto for Backups

Copying files and taking backups on macOS is quite swift — thanks to the SSDs and the flash storage. However, it does take a while to copy a large amount of data. Thankfully, Terminal offers a useful command to copy files. Here's how you can do it while watching the name of files that the command copies.

ditto -V /currentpath/ /new/path/

So I want to copy the DMG downloaded in the previous section to the desktop.

Terminal For Mac Commands Windows 10

That should do the needful. If you want to copy the files to an external drive, then you need to provide the destination path correctly.

8. Always Show File Path in the Finder

If you have switched from Windows recently, you would have noticed that the Finder on macOS doesn't show file path like the Explorer in Windows. However, you can force Finder to show you the file path with this command:

After hitting enter, you need to stop the Finder.

After you hit Enter, the Finder will relaunch. Then you should see the file paths at the top of the Finder window.

9. Power Chime on Connecting the Charger

Has it ever happened that you've connected the MagSafe charger to your Mac but forgot to flip on the power switch? I have lost the count. Thankfully, I stumbled upon this useful command that provides an audio feedback chime whenever I connect the MagSafe charger.

Feed this command in the Terminal and hit Enter.

10. Stop Your Mac from Sleeping

Often you are downloading a massive file, and you don't want your Mac go to sleep. If it is a temporary requirement, then a simple command can make it happen. Just type the following command, hit Enter and walk away from your Mac.

In this command, the number 600 signifies seconds. So with this command, the Mac won't sleep until 10 minutes (600 seconds). You can enter a relevant number of seconds or just the word 'caffeinate' to prevent your Mac from sleeping.

However, if you close that Terminal window, then the command will stop executing and the Mac will go to sleep on a predefined time.

11. Check Your Mac's Uptime

Wondering how long it has been since you've restarted your Mac? A simple restart can sort a lot of things in order and boost your Mac's performance. Here's a command to check your how long your Mac has been running without a Restart or a Shutdown

That should give you all the details with a timestamp.

Also on Guiding Tech
Terminal For Mac Commands
#productivity
Click here to see our productivity articles page

Network Terminal Commands For Mac

MacTerminal

List Of Mac Terminal Commands

Using Terminal Is Fun

The Terminal is an absolute delight to use and tinker around in the macOS. However, we would strictly advise against using random commands provided by unverified sources or strangers. Other than that, these commands should run on latest macOS Mojave update till last few versions.

You should always double-check the Terminal commands that involve removing, deleting or disabling any service. If you stick to our list, then you would be confident of using Terminal like a pro.

Next up: Are you bored of the same old Lock Screen on your Mac? Here is a nifty guide that will show how to customize the lock screen on your macOS Mojave running Mac.


The above article may contain affiliate links which help support Guiding Tech. However, it does not affect our editorial integrity. The content remains unbiased and authentic.Read Next

Terminal For Mac Commands Cheat

Terminal For Mac CommandsHow to Customize the Lock Screen on macOS 10.14 MojaveAlso See#terminal #macos

Did You Know

Terminal Mac Commands Cheat Sheet

Thunderbolt 3 is a data and video transfer protocol and is developed by Intel.

More in Mac

Top 4 Ways to Fix Mac Desktop Icons Missing or Not Showing

Recent Posts

  • L2 For Mac
  • Microsoft Office Word 2010 For Mac
  • Mount And Blade With Fire And Sword For Mac
  • Mac Os Download For Mac Mini