Lesson 1: First Steps with the Command Line
When Apple announced the release of Mac OS X, many Mac users were stunned: here was a new operating system based on the venerable Unix, which, they feared, would call into question the Mac’s legendary ease-of-use. 10 day weather forecast for el capitan state beach. Mac users have long been staunch supporters of point-and-click interfaces, and Unix, or so they thought, was the exact opposite. Since Mac OS X presents a graphical user interface atop its Unix foundations, there is no need for worry – seasoned Mac users can feel right at home (after some adjustments) with the new interface, and not even know about the Unix underpinnings that make Mac OS X run.
PROTIP: Know the PowerShell commands known not to work on Linux/macOS. To leave PowerShell, it’s the same as in Bash scripts: exit When you return back in Get help information for a command: get-help stop-service Visual Studio Code Editor. One text editor built for. To delete the message key:value pair, we type this command: jq 'del(.message)' iss.json. Note this doesn’t actually delete it from the “iss.json” file; it just removes it from the output of the command. If you need to create a new file without the message key:value pair in it, run the command, and then redirect the output into a new file. May 21, 2020 Check if VT-x is supported on macOS. To see if the CPU within your macOS computer (Macbook Pro, Mac Pro, or other Apple machines) support nested virtualization via the VT-x feature of the CPU, you will need to open the macOS Terminal and execute a command. In the Terminal app on your Mac, enter the complete pathname of the tool’s executable file, followed by any needed arguments, then press Return. If a command is located in one of the shell’s known folders, you can omit path information when entering the command name. What Are MacOS Sierra Terminal Commands? In answer to the above question, terminal commands are just another way in which you can get your Mac to do certain things. As for how many of these commands exist, there are roughly 1,400. However, that number may differ depending on the age and model of your Mac.
Not everyone was apprehensive, however. Many Mac users, especially those who have worked in large businesses or educational institutions, have for years used Unix variants, or flavors, such as one of the many Linux distributions. They were delighted to discover that they could use their Macs and still wield the power of Unix (specifically, FreeBSD 4.4, one of the oldest and most stable versions of Unix). They can have access to the myriad command-line tools available for Unix and the powerful programs provided as standard equipment in Mac OS X, such as the Apache Web server, numerous network utilities, a compiler and more. And they can still benefit from Apple’s easy-to-use graphical user interface.
Unix is reputed to be complex – its cryptic commands are said to offer a steep learning curve and not be accessible to 'the rest of us.' While this can be true – some Unix commands are like a foreign language – the command line can also be simple, useful, and powerful.
The goal of this article (the first in an occasional series to be published in TidBITS over the next year) is to present a brief example of how you can use Mac OS X’s command-line interpreter, the Terminal application, to run a few simple commands, and see exactly how they work. You will discover, if you follow this easy tutorial, that Unix doesn’t bite.
Opening Terminal — Terminal is the program Apple includes in Mac OS X to provide the interface between the commands you type and the operating system. Terminal is a 'dumb' program – it does little more than pass information on to a shell (another program that interprets these commands) and display the results of these commands.
Start by opening Terminal, which is located in the Utilities folder of your Applications folder (or, to use the Unix convention, /Applications/Utilities). Double-click the Terminal icon. The Terminal window displays, showing something like this:
This text tells you several things:
The prompt indicates that you can type commands. If Terminal is working on a command or displaying certain processes, you don’t see a prompt. If this is the case, you can always open a new Terminal window to type commands; you can open an unlimited number of Terminal windows, called sessions, at any time.
Typing Your First Command — Now that we’ve gotten through the basics, you’re ready to type your first command. Let’s start with echo, a simple command that displays what follows the command name in the Terminal window. https://intensiveagri.weebly.com/itunes-replacement-for-macos.html.
(Note: in the rest of this article, the commands and text you are to type are shown following the prompt sign, %, but without the localhost name and user name. You don’t need to type the prompt text; just type what follows the % sign.)
Type the following:
and press Return or Enter. Terminal displays the above line (the prompt and the text you type) as you type it. The echo command writes an argument to the Terminal’s standard output; in this case, the Terminal window itself. After you press return, it displays the following line:
Your Mac just said hello to you! Now, you can go even further – after all, you don’t know to whom it was saying hello. Try this command:
My Mac says:
All commands use a specific syntax – for simple commands, this is often just:
Arguments are additional information required for some commands; other commands run with no arguments. In the line of text you typed above, the command was 'echo' and the argument was the text you wanted Terminal to display.
That was easy, wasn’t it? You have just used the command line under Mac OS X. The echo command is certainly simple, but it demonstrates basic command syntax and how Terminal works. (You’ve probably noticed that, after the above text, Terminal displayed a new prompt on the following line. This is a way of showing, as mentioned above, that the previous command has completed.)
You can now try typing the echo command with other text if you want.
Reading Directory Contents — Let’s see some more things you can do with Terminal. In the following series of commands, you will:
The Terminal prompt shows that you are in your Home (~) directory. Let’s see what’s in this directory. If you recall from looking at the Finder window, Home contains a few folders. Type the following (the first letter is lowercase L, not the digit 1):
The ls command lists the contents of a directory. Terminal displays something like the following:
This is a list of everything in your Home folder (it may be different depending on the contents of your Home folder). However, this list doesn’t tell you which of the above items are files or folders. You can find out by typing the following:
Terminal displays this list:
The -F is an option for the ls command; it is also case-sensitive: -F is not the same as -f. Options tell certain commands to do things in a slightly different way. This option tells Terminal to display a slash (/) immediately after each pathname that is a directory, an asterisk (*) after each executable (application), etc. The slashes here show us that these are directories. If any of the above items were files, there would be nothing after their names.
Creating a New Directory — Now, you’re going to create a new directory called Test. Type the following:
The mkdir command makes new directories. Let’s check to make sure this directory has been created by repeating the ls -F command, which shows:
There it is: Test/, the directory that you just created.
Now we are going to move into that directory, using the cd command:
The cd command changes the current working directory. After running this command, the prompt changes to show that we are now in the Test directory:
As you’ve already learned, the ~ is a shortcut for your Home directory, and the slash means that the following directory resides inside the Home directory.
Creating a New File — Let’s now create a new, empty file inside the Test directory. Type this:
The touch command is typically used to update file access and modification times, but it can also create a new file; the argument, testfile, is the name we’re giving to the file.
Let’s check to make sure the file was created. Type:
which should display the following:
Remember that the -F option for the ls command shows a / following a directory; it shows nothing for files. So we now have a new, empty, file called testfile sitting in the Test directory, just waiting for data to be put into it.
Writing Text to a File — Since our file is doing nothing, we might as well write something to it. How about writing Hello [username]! in this file? To do so, we can use the echo command that we learned above. Type the following:
This command tells Terminal to echo the text Hello [username]! to the file called testfile. Let’s check and make sure it worked. There are several commands that display the contents of your files; one of them is cat. Type this:
Terminal should display:
But since we only see this in the Terminal window, it doesn’t give the same impression as when we open a document window in an application. Let’s see what this file looks in a graphical application. Type:
(Make sure you type open, then a space, then a period.)
This tells the Finder to open the current directory (the . is a shortcut for that) in a new window. You should see a new Finder window, entitled Test, with a file inside it called testfile.
Double-click the testfile icon, which should launch TextEdit and display a window containing the text 'Hello [username]!'
Quit TextEdit to close the file, then switch back to Terminal by clicking its icon in the Dock.
Deleting Files and Folders — Now that we have finished our brief demonstration, we need to clean up a bit. We don’t need to keep that file and folder, so let’s delete them.
Warning! The command line is not without certain risks. Unlike when you work in the Finder, some tasks you carry out are absolute and cannot be undone. The command I am about to present, rm, is very powerful. It removes files permanently and completely instead of just putting them in the Trash. You can’t recover files after deleting them with rm, so use it with great care, and always use the -i option, as explained below, so Terminal asks you to confirm deleting each file.
Your prompt should look something like this, showing that you are still inside the Test directory you created earlier:
Type the following:
The rm command removes files and directories, in this case the file testfile. The -i option tells Terminal to run the rm command in interactive mode, asking you to make sure you want to delete the file. Terminal asks:
Type y for yes, then press Return or Enter and the file is removed. If you wanted to leave it there, you could just type n for no, or press Return.
We should check to make sure the file is gone:
After typing ls, you should just see a prompt. Terminal doesn’t tell you that the directory is empty, but it shows what’s in the directory: nothing.
Now, move up into your Home folder. Type:
This is the same cd command that we used earlier to change directories. Here, the command tells the Terminal to go up in the directory hierarchy to the next directory (the . is a shortcut for the parent directory); in this case, that is your Home directory.
Type ls again to see what’s in this directory:
You should see something like this:
The Test directory is still there, but using rm, it’s easy to delete it by typing:
The -d option tells rm to remove directories. When Terminal displays:
Type y, then press Return or Enter. (If you didn’t remove testfile, as explained above, the rm command won’t delete the directory because it won’t, by default, delete directories that are not empty.)
Make one final check to see if the directory has been deleted.
Summing Up — If you worked through this brief demonstration, you successfully typed commands in a Terminal window using the Unix command line. You created a directory (folder), created a file, wrote text to it, then deleted the file and the directory – and all with some very simple commands. Here’s a brief summary of the commands you used:
Although you haven’t accomplished anything extraordinary so far, you can see that using Terminal isn’t that complicated. All it requires is a bit of time to learn the different commands and their arguments and options. But if you move ahead slowly, learning as you go on, rather than trying to memorize dozens of commands, you’ll soon find that you are not only comfortable with the command line, but that you can do things that help you save time and give you much more power.
In the next installment in this series, you’ll learn all how to move around in your computer’s file system. I’ll build on some of the commands presented here (cd, ls, mkdir, and others) and present many new, useful commands.
[Kirk McElhearn is a freelance writer and translator living in a village in the French Alps.]
<http://www.mcelhearn.com/unix.html>
PayBITS: Did this article help you dip your toes into Terminal?
Consider supporting Kirk with a few bucks via PayPal! <https://www.paypal.com/xclick/ business=kirk%40mcelhearn.com> Read more about PayBITS: <http://www.tidbits.com/paybits/>
Whether you’ve purchased a new Mac with macOS Mojave pre-installed or you’ve upgraded from a previous version of macOS, you’ll find that macOS Mojave makes your Mac easier to use and offers myriad improvements to make you more productive. Get additional information on things you should never do to your Mac; a compendium of useful and timesaving keyboard shortcuts; a discussion of when folders are too full and when (and when not) to create subfolders; recommendations for backing up data; and a short discussion of iDevices and Continuity.
What Not to Do with Your Mac Running Mojave
Treat your Mac and macOS Mojave with care. To keep your work and leisure projects safe, never do any of these things with your Mac:
If you’re using a laptop, you can usually get away with pulling the plug while it’s running because the battery automatically kicks in. The only caveat is that if your battery is totally depleted, damaged, or missing entirely, you could suffer directory damage or data loss by pulling the plug. Just use the Shut Down command, and you’ll sleep well.
Handy Keyboard Shortcuts for macOS Mojave
Make your work go faster with these macOS Mojave keyboard shortcuts. Print this chart and refer to it while using macOS Mojave.
Tabbing around Mojave’s Save and Save As Sheets
In the expanded view of macOS Mojave, if you press the Tab key while the Save As field is active, it becomes inactive, and the search box becomes active. Press Tab again, and the sidebar becomes active. Press the Tab key one more time, and the file list box (more accurately known as the detail pane — the part with Icon, List, Column, or Cover Flow view buttons in it) becomes active.
That’s because the file list box, the search box, the sidebar, and the Save As field are mutually exclusive, and only one can be active at any time. You can always tell which item is active by the thin blue or gray border around it.
When you want to switch to a different folder to save a file, click the folder in the sidebar or click anywhere in the file list box to make the file list active. The following tricks help you get a hold on this whole active/inactive silliness:
Creating Subfolders in macOS Mojave . . . or Not
How full is too full? When should you begin creating subfolders in Mojave? That’s impossible to say, at least in a one-size-fits-all way, but having too many items in a folder can be a nightmare — as can having too many subfolders with just one or two files in each one.
If you find more than 15 or 20 files in a single folder, begin thinking about ways to subdivide it. On the other hand, some of your biggest subfolders might contain things that you don’t often access, such as a Correspondence 1992 folder. Because you don’t use it often, its overcrowded condition might not bother you.
Here are some tips to help you decide whether to use subfolders or just leave well enough alone:
Dr. Mac’s Backup Recommendations
When working in macOS Mojave, would you like to ensure that you won’t lose more than a little work no matter what happens — even if your office burns, floods, is destroyed by tornado, hurricane, or earthquake, or robbed? If so, you might want to follow the setup described here.
I am continually testing new backup solutions, so the software I use can change from month to month. I’ve tried most of the popular backup solutions and many of the more obscure ones, but before I say anything about my current setup, here is what I’m trying to accomplish (at a minimum): I want at least three (reasonably) current backup sets with copies of all my files.
I update two of them every day and keep the third somewhere offsite, such as in a safe deposit box at the bank. Every month or two, I swap the offsite backup for the latest backup from home — and then reuse the older backup disk.
Note that after I set up the following programs, they run automatically in the background with no further action on my part. Think of this as a “set and forget” feature.
One last thing: I test the integrity of each backup regularly, and so should you. It confirms that the files that I think are there are actually there, and it reassures me that the files in that backup set aren’t corrupted or damaged and are capable of being restored successfully.
iDevices and Continuity in macOS Mojave
Continuity is the blanket term for a set of features in Mojave and iOS 8 or newer that allow you to seamlessly move between your iPhone, iPad, and Mac.
At present, four features provide Continuity:
They’re a useful little quartet, but they work only with newer Apple devices. So, before you get too excited, peruse the system requirements for each feature.
Intro and system requirements
Handoff and Instant Hotspot are supported by the following Mac models and require Yosemite, macOS Sierra, or macOS Mojave:
Instant Hotspot requires one of these iDevices with cellular connectivity and Personal Hotspot service through your wireless carrier:
Phone Calling requires an iPhone with at least iOS 8 and an activated carrier plan and works with any iOS device that supports iOS 8 and any Mac that supports macOS Sierra or later.
SMS requires an iPhone with at least iOS 8.1 and an activated carrier plan and works with any iOS device with iOS 8.1 and any Mac that supports macOS Sierra or later.
If your gear isn’t listed, Continuity isn’t going to work for you. So, assuming you have at least two or more devices that meet those requirements, here is how to put these useful features to work for you.
How to use Handoff
Handoff lets you start a document, email, or message on one Apple device and pick up where you left off on another. It works with Apple apps including Mail, Safari, Maps, Messages, Reminders, Calendar, Contacts, Pages, Numbers, and Keynote as well as some third-party apps.
To use Handoff, do the following:
Another way to open an app available for Handoff on your iDevice is to double-click the Home button and then tap the app (Keynote in this example) in the multitasking display.
Going the other direction, if you had started the presentation on your iDevice, you’d see a Keynote icon on the left side of your dock, as shown. Click the icon to launch Keynote, which will open the presentation that’s currently open on your iDevice.
You can also use Mojave’s app switcher (Command-Tab) to open an app that’s displaying a Handoff icon in your dock.
If you decide you want to disable Handoff:
Try using Handoff with Safari. If you start reading a web page on one device, as long as you don’t quit Safari you can pick up reading it on any of your other devices. You might find that you use Handoff more with Safari than with documents, messages, and mail combined. Bottom line: Handoff is a sweet feature when it works.
Handoff still isn’t robust for some users, with reports of inconsistent or nonexistent behavior with Handoff appearing a year after its introduction. I’m sure Apple will get it sorted out in an iOS or Mojave update. Meanwhile, if it stops working (or never started working) for you, you might have some luck by disabling Handoff, logging out of iCloud on all devices, restarting all the devices, and then reenabling Handoff. It’s a pain but it works more often than not (assuming all of your gear meets the requirements).
How to use Personal Hotspot
Another Continuity feature allows you to use the Personal Hotspot on your iPhone or cellular iPad to provide instant Internet access to other iDevices.
Some cellular operators and data plans don’t include Personal Hotspot. If you don’t see a Personal Hotspot in Settings→Cellular Data on your iDevice, contact your wireless operator.
The first thing to do is enable the hotspot on your cellular device by tapping Settings→Cellular Data and enabling the Personal Hotspot switch.
Now, to get Internet access on your (non-cellular) device:
Az Command For Macos 7
To get Internet access on your Mac:
And that’s all there is to it!
The data consumed by the non-cellular devices comes from the cellular device with the Personal Hotspot’s data plan. If your data plan is unlimited, you’re golden. For those who pay for data by the gigabyte: Keep an eye on your cellular data usage to avoid unpleasant surprises on your next bill.
How to make phone calls with Continuity
With Continuity, you can make and receive cellular phone calls from your iPad, iPod touch, or Mac when your iPhone is on the same Wi-Fi network.
To make and receive phone calls on your Mac, iPad, or iPod touch:
Az Command For Macos Windows 10
Now that you have everything configured, here are some details on making a call from your Mac, iPad, or iPod touch:
Azure Cli On Macos
SMS and Continuity
With Continuity, all SMS and MMS text messages that you send and receive on your iPhone appear on your Mac, iPad, and iPod touch, even if the person on the other end is less fortunate and doesn’t use an iPhone or a Mac.
Furthermore, you can reply from whichever device is closest to you, including your iPad, iPod touch, or Mac.
To use Continuity for SMS and MMS with your iPhone and your Mac, iPad, or iPod touch, all of your iDevices need iOS 8.1 or higher and your Macs need macOS 10.10 Yosemite or higher. And all devices need to sign in to iMessage using the same Apple ID.
Now enable SMS on your iPhone by taping Settings→Messages→Send & Receive→You Can Be Reached by iMessage At and enable the check boxes for both your phone number and your email address.
Finally, tap Settings→Messages→Text Message Forwarding and enable the devices you would like this iPhone to forward SMS messages to.
Az Command For Macos Download
Each device you enable will display a code; just enter the code on your iPhone to verify the SMS feature and you’re done.
10 Favorite Websites for macOS Mojave Users
To learn about all things Macintosh and macOS Mojave, hop onto the web, check out these sites, and stuff your brain with Mac information:
Az Cli For Mac
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |