12 useful Terminal commands on Mac

MacOS

Like the Command Prompt on a Windows computer, the Terminal on the Mac is also capable of performing some advanced functions for the system such as displaying hidden files, creating alarms when plugging in the charger, and turning off shadow effects when taking screenshots. …

Deep in MacOS is a command line world that is probably unknown. For that reason, iZZiSwift today will help you summarize some of the most useful commands. 

To start Terminal, simply search Spotlight or open the Application folder.

Read: 3 ways to open Terminal on Mac

1. Show hidden files in Finder

To show the hidden file, type the following command into Terminal:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE killall Finder

To hide back just replace the word TRUE to FALSE:

defaults write com.apple.finder AppleShowAllFiles -bool FALSE killall Finder

2. Check the network connection

The Ping command is used to check the response time of a web page or a certain IP address. For example: You need to check the Download.com.vn page , type the following command:

ping izziswift.com

3. Create a folder

To create a directory, simply use the following command:

mkdir [directory_name]

For example: Create the folder named iZZi:

mkdir iZZi

4. Turn off shadow effect

When taking screenshots of each window in a Mac often with a shadow effect, turn it off using the following command:

defaults write com.apple.screencapture disable-shadow -bool TRUE killall SystemUIServer

To turn on shadowing again, use:

defaults write com.apple.screencapture disable-shadow -bool FALSE killall SystemUIServer

5. Let the machine read any sentence

Let the Mac sound for you something you just need to say Say:

Say Hi
Say Hello
Say Goodbye

6. Do not allow the Sleep device

To keep the Mac running, without Sleep, without decreasing the screen brightness, do not turn on the screen and wait for you to type in the following Terminal command:

Caffeine

Can add time parameters:

Caffeine -t 120

In which: 120 means 120 seconds, how long do you want the computer to be replaced by the corresponding number. If you want to finish this period early, press Control + C.

7. View command history

If you want to review the history of all the statements used in Terminal, use the command:

history

To delete the entire history of typed statements:

history -c

8. Create a sound when charging

You want to create a tone when plugging in the charger to know if it has been charged, then type the following command:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool TRUE; open /System/Library/CoreServices/PowerChime.app &

To mute:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool FALSE; killall PowerChime

9. Check for updates more frequently

By default, Mac checks to update the operating system once a week, if you want to check daily, use the following command:

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

If you want to return to the default, you only need to change the number 1 to 7, but you want to check every 2 or 3 days, then type 2 or 3:

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 7

10. Turn the standby screen into wallpaper

If you want to use the standby screen as the background image, use the following command:

/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background

To turn it off, just turn off the Terminal or press Control + C on the keyboard.

11. See instructions for using commands

Want to see the instruction to use any command just type the following syntax:

man [command]

For example: To know how to use the ping command, just type:

ping man

12. Turn off or start the machine

Shut down immediately:

sudo shutdown -h now

Start immediately:

sudo shutdown -r now

Booting after a period of time, in which 60 is 60 seconds (want to boot after how long it takes to type):

sudo shutdown -r +60

Hopefully the above Terminal commands will help you make the most of the available functions of your Mac.