5 MacOS commands every user should know

Jack Wallen/ZDNET

As a result of I have been utilizing Linux for such a long time, the command line is second nature to me. I do know which instructions I must do sure issues — and so they by no means fail. That is one of many explanation why I made a decision utilizing the command line in MacOS made sense too. In any case, the MacOS and Linux CLI (command line interface) are fairly comparable.

However when you’re new to the apply of operating instructions, you most likely do not know the place to begin. That is the place I are available. Enable me to introduce you to 5 instructions that not solely will serve you properly however aren’t even remotely onerous to make use of.

Additionally: I’ve used Linux for 30 years. Here are 5 reasons why I’ll never switch to Windows or MacOS

And with that, let’s dive into the instructions.

1. Obtainable free house

While you need to learn the way a lot house is left in your onerous drive (or a number of drives, you probably have them connected), you could possibly at all times go to System Settings, seek for Storage, after which permit the GUI to calculate the out there free house. Or, you could possibly open the terminal app and situation a single command that can show how a lot free house is out there on all connected drives. The command in query is df, which shows free disk house. You possibly can view the free house on your entire drives by issuing the command like this:

My favourite method of utilizing df is in human-readable format. While you use df with out choices, it can show the leads to blocks, which could be very complicated. As a substitute, use the command:

This may current the output in GB, which is far simpler to know.

2. Killing a rogue app

It is perhaps a uncommon event, however generally an app goes rogue and refuses to shut. Positive, you could possibly at all times use the Pressure Stop software (from the Apple menu within the high bar). Or, you could possibly use the kill command. I’ve had one occasion the place the MacOS GUI refused to reply. As a substitute of doing a tough restart, I used SSH to log into the machine, find the problematic app, kill it from the command line, and my GUI got here again to me. 

Earlier than you’ll be able to kill the app, nevertheless, you will need to first find its PID (Course of ID). To try this, situation the command:

The place NAME is the identify of the app (similar to Safari). 

Upon getting the PID, you’ll be able to kill the rogue app with the command:

The place PID is the PID of the app in query.

3. Open a file

Do you know you’ll be able to open a file from the command line? Not solely are you able to open a file, however utilizing this command will open the file within the right software. For instance, you probably have a doc that you just need to open in Pages, this command will do it. While you use this command, it is as when you’re double-clicking the file in Finder. 

Additionally: 5 Linux commands you need to know to troubleshoot problems

How do you do it? You first need to navigate into the folder housing the file. Say your file (we’ll name it zdnet.docx) is in Paperwork. Open the terminal app and situation the command cd ~/Paperwork. As soon as there, you’ll be able to open that file with the command:

No matter default software you’ve gotten set to open docx information will launch and also you’re able to work. If you wish to open a file with a non-default software, you are able to do so utilizing the -a possibility. For instance, you might need each Apple Pages and LibreOffice Author put in and also you need to open the doc with Author. For that, you could possibly situation the command:

open -a LibreOffice.app zdnet.docx

4. Restart your machine

Have you ever ever discovered your iMac or MacBook refusing to restart? I’ve and it may be irritating. Luckily, there is a easy command you should utilize to power a restart. One factor to bear in mind, nevertheless, is that this command requires the elevated privileges that include sudo (which stands for superuser do). While you use sudo, you’ll be prompted to sort your person password. Solely after efficiently typing your person password will the command in query run.

The command to power a reboot is:

After typing your person password, the machine will reboot.

5. Study a command

Lastly, this little doozy of a command will are available very useful as you navigate the CLI. The man command permits you to learn the handbook pages for every command. As an illustration, say you need to study extra in regards to the reboot command. For that, you could possibly situation the command:

Additionally: 6 features I wish MacOS would copy from Linux

The handbook web page will open and you’ll scroll by it, studying all there’s to know in regards to the command. Almost each command in your MacOS machine may have a handbook web page. You possibly can even learn the handbook web page for the man command, which might be:

And there you’ve gotten it, my pals: the primary 5 instructions I imagine each MacOS person ought to study. That does not imply you have to study them. However if you wish to get probably the most out of the working system, this can be a good spot to begin.

Sensi Tech Hub
Logo
Shopping cart