Command lines of 9 practical terminals that all Mac users need to know

Source: Internet
Author: User

Generally, terminal applications are often used only by high-end users. This does not mean that the command line is very difficult to learn. Sometimes, the command line can easily and quickly solve the problem. I believe that all Mac users have tried the command line. Today, we have nine very practical command line operations. Some command lines can be used only after xcode is installed. xcode is available for free in MAC app store.


1. Use caffeinate to prevent mac from running Screen Protection and sleep

Caffeinate can prevent mac from entering sleep state, and screen protection will not be activated. We 'd better use-t to add the specific time for the command. For example, the following command does not enable Mac to sleep for an hour.

  1. Caffeinate-T 3600

Copy code





2. Use pkgutil to decompress the PKG File

To view a special file in the PKG Installation File, run the pkgutil command. The following command will decompress the macx. PKG file to the desktop

  1. Pkgutil -- expand macx. PKG ~ /Desktop/

Copy code





3. Use the purge command to release memory

The purge command can clear the cache of memory and hard disk, which is similar to restarting Mac. The purge command can convert inactive system memory to available memory. You only need to enter the following command in the terminal.

Purge




4. Use the open command to open multiple identical applications

The open command can enable the application on the terminal, and use-N to enable multiple identical applications. For example, you can use the following command to open the new Safari window.

  1. Open-N/applications/safari. APP/

Copy code





5. Update OS X without using App Store

Do you want to update the system but do not want to open a bloated Mac App Store? The following command can help you use the terminal to upgrade OS X.

  1. Sudo softwareupdate-I-

Copy code





6. list all downloaded files

We can use the following command to list all downloaded content

  1. Sqlite3 ~ /Library/preferences/COM. Apple. launchservices. quarantineeventsv * 'select lsquarantinedataurlstring from lsquarantineevent' | more

Copy code





7. Use the chflags command to hide files or folders.

If you want to shadow a file or folder, you can run the chflags command. You only need to fill in the correct file path, for example, to hide the macx folder on the desktop. If you want to see the folder again, you only need to change hidden to nohidden.

  1. Chflags hidden ~ /Desktop/macx

Copy code





8. automatically enter the file path

Do you know how to drag any file from the Finder to the terminal window to obtain the detailed path of the file. If you want to enter the path of a file, drag and drop the file.



9. Create a compressed file with password protection

You can create a password-protected file protected.zip using the following commands.

  1. Zip-e protected.zip ~ /Desktop/macx.txt

Copy code



References:

Document address

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.