-as of [30 SEPTEMBER 2024]–
.
“terminal.app”
.
.
*BEGINNER’S GUIDE*
*”MAKEUSEOF LINK*
(tim chawaga)
(18 FEBRUARY 2019)
The Terminal app on Mac lets you accomplish all sorts of tasks using the command line.
Here’s a guide for Terminal beginners.
For most of your everyday Mac tasks, a soft and friendly GUI is both an asset and a comfort.
Sometimes, though, Finder is a clunky middleman.
There are faster ways to find out where that pesky 5GB file is hiding, or the path of every file related to that app you thought you deleted.
For these jobs and others, the command line is your new best friend
.
What Is Terminal?
Terminal is a utility that allows you to interact with your Mac through the command line.
Linux operating systems include similar tools, since both Linux and macOS are Unix-like OSes.
The command line interface (CLI), or the language that you type into Terminal to interact with your Mac, is called bash.
Everything we discuss below is a bash command
Before you start using Terminal, you can customize it to your own personal preference.
If you prefer, it’s even possible to download a third-party Terminal alternative for a customized look and feel.
.
General Mac Command Line Tips
First, let’s look at some basic Terminal facts you should know.
General Syntax
A bash command typically follows this pattern:
[Command] [Options] [Input or Path to File or Directory]
For example, in:
ls -la /Applications
ls
is the command,
-la
is a compound of 2 individual options (
-l
and
-a
), and
/Applications
is the path to list.
.
.
The Path
Understanding paths will help you understand how macOS actually sees your files.
Essentially, the path of a file is the Russian dolls’ nest of folders in which it’s contained, followed by the name of the file itself.
For example, on a Mac, the path of a file called My Secrets that lives on user John Doe’s Desktop is
/Users/jdoe/Desktop/”My Secrets”
.
.
White Space
You must escape white space for the Terminal to process it properly.
When bash sees a space, it interprets it as the end of a command.
So if you have a folder with spaces in its name, like Path Test, and you try to list its contents with
ls /Applications/Path Test
, you’ll get this:
What’s going on here?
Well, bash thinks that you called ls on /Applications/Path.
When it couldn’t find that file, it stopped.
If you want bash to recognize the full name of your folder, you can either wrap the name in quotes or use a backslash, like so:
ls /Applications/”Path Test”
or
ls /Applications/Path\ Test
.
.
Sudo
Many of the commands below require administrator-level access.
If you’re not currently signed into administrator account, but you know the administrator’s password, you can place
sudo
(which stands for “single user do”)
in front of the command to temporarily give it administrator-level privileges
.
Terminal Commands to Improve Your Workflow
Now that you know the basics, let’s take a look at some extremely handy commands.
Note that you can pull up full information on these commands, including all their options and examples, by typing
man
into the Terminal.
find
Replaces: Spotlight
Why it’s better:
It’s faster and searches system folders that Spotlight excludes, or has trouble indexing.
Spotlight tends to skip macOS system files unless you tell it not to, and even then can have trouble indexing them.
Conversely, the bash find command can search for anything, in any place, and will output the full path of what you’re looking for.
.
The syntax of find consists of four parts.
In order, they are:
1
find
.
2
the path of the directory you want to search
(/Applications below)
.
3
options
(the below example has -name, which means that find will search for files that match that name)
.
4
the string to search
(the below example has Google Chrome)
.
.
You should know that find uses regex (also called regular expressions).
A full explanation of this topic is outside the scope of this article (or anything short of a textbook).
However, the below example introduces a vital concept in regex, which is the asterisk (*), or wildcard character.
Putting it at the beginning and end of the search string means that find will output results that have characters before and after the search term.
In this case, Google Chrome will bring up Google Chrome.app
.
It all comes together to look like this:
du
Replaces: Cmd + I to show info.
Why it’s better: It can show you multiple folders at once, and typically takes less time to load.
du stands for “disk usage,” and can quickly tell you the size of a file or folder, or even a list of files within a folder.
The best options for du are:
-d (depth): When followed by a number, tells find to limit its search to a -d level of depth in the directory where it runs.
For example, if you run
du -d 1 /Applications
, it will only show you the total size of the folders and files in your Applications folder, not the sizes of subfolders within those folders.
-h (human readable): This will show you the size of your files in K, M, or G, which stands for kilo, mega, or gigabytes.
Take a look at du in action:
mv
Replaces: Point-and-click moving of folders and files.
Why it’s better: It’s faster and requires no navigation.
You can quickly move a file or folder into another folder using mv. It works by simply changing the name of the path.
The syntax is
mv
.
For example,
mv /Users/jdoe/Documents/file1 /Users/jdoe/Desktop/file1
will move file1 from jdoe’s Documents to his Desktop.
ls
Replaces: Cmd + i to show info.
Why it’s better: It’s faster, can show info on multiple files at once, and is highly customizable.
ls is an incredibly powerful command for showing you exactly what’s in your folders.
It also reveals who’s allowed to see them, if you have any hidden files or folders, and much more.
The best options for ls are:
-l (long): Shows the permissions for each file in the folder, the most recent modification time, the file owner, and filename.
-a (all): Shows you all the files in a folder, including the hidden files (great for showing the user library in macOS, which is hidden by default).
Here’s what the output looks like:
mkdir
Replaces: Finder > File > New Folder
Why it’s better: It’s faster, and you can set the name right in the command instead of double-clicking the new folder.
Create new folders in an instant with this command.
Example:
mkdir /Users/jdoe/Desktop/cool_stuff
rm
Replaces: Moving files to the Trash and emptying it.
Why it’s better: It’s faster, and good for deleting pesky files that the Trash won’t get rid of.
This command will delete, immediately and without prejudice, any file you put in its path. Obviously, use it with extreme caution. Unlike clicking Empty Trash, rm will not ask if you’re sure. It assumes you know what you’re doing.
One thing to note about rm is that by default, it will only delete files, not folders. To delete folders, you must use the -R option, which stands for recursive.
Example:
rm -R /Users/jdoe/Desktop/cool_stuff
Master Your Mac With the Terminal
Now you know some essential Terminal commands and can start integrating them into your daily Mac workflow. Once you get comfortable using bash, you can go beyond simply replacing your everyday tasks and start exploring powers that only the command line can offer.
Start off by installing Homebrew, the best package manager for macOS.
It allows you to install new programming languages, software repositories, and more.
And then you can move onto trying some fun and cool commands and customizing Terminal to make it even more useful.
What You Need To Know About Swatting
Swatting is a sinister, deliberate, malicious act that needs to stop. Learn how to protect yourself from swatting.
About The Author
Tim Chawaga (23 Articles Published)
Tim Chawaga is a writer living in Brooklyn. When he’s not writing about technology and culture, he’s writing science fiction.
More From Tim Chawaga
Subscribe To Our Newsletter
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!
.
.
.
(finally found the workaround to ‘disable sleep mode’ on the ‘imac’)
(go into ‘terminal’…)
type sudo pmset disableSleep 1
it asks you for your password and then it obeys the command…
(to reenable:)
sudo pmset disableSleep 0
hopefully now i won’t have random shutdowns
(i’d much rather deal with random sleep mode attacks)
(now i’ve just got to worry about my computer overheating…)
(and shut down the computer whenever you aren’t using it)
(and keep the air conditioner blasting as cold as possible whenever you’re working)
(although i can’t have it on when i’m recording)
(the computer is already going to sleep)
.
*let it sleep for a few minutes before attempting ‘vocals’*
www.makeuseof.com /tag/beginners-guide-mac-terminal/
A Beginner’s Guide to Using the Mac Terminal
By Tim Chawaga
52-66 minutes
Home
Mac
.
.
.
.
💕💝💖💓🖤💙🖤💙🖤💙🖤❤️💚💛🧡❣️💞💔💘❣️🧡💛💚❤️🖤💜🖤💙🖤💙🖤💗💖💝💘
.
.
*🌈✨ *TABLE OF CONTENTS* ✨🌷*
.
.
🔥🔥🔥🔥🔥🔥*we won the war* 🔥🔥🔥🔥🔥🔥