9 Useful terminal command lines that all Mac users need to know

Source: Internet
Author: User

In general, only high-end users will often use the terminal application. This does not mean that the command line is very difficult to learn, sometimes the command line can easily and quickly solve the problem. Believing that all Mac users have tried the command line, today brings you 9 very useful command-line operations. Some command lines need to be installed in Xcode to be practical, and Xcode is available for free in the Mac App store.


1. Use Caffeinate to prevent your Mac from running screen saver and sleep

Caffeinate can prevent your Mac from going to sleep, and screen saver won't activate. We'd better use-t to add a specific time to the command. For example, the following command can make the Mac not sleep in an hour.

    1. CAFFEINATE-T 3600
Copy Code



2. Using Pkgutil to extract pkg files

If you want to view a special file in the PKG installation file, you can do so using the Pkgutil command. The following command extracts the macx.pkg file to the desktop

    1. Pkgutil--expand macx.pkg ~/desktop/
Copy Code



3. Use the Purge command to free up memory

The Purge command clears both the memory and the hard disk cache, similar to the effect of restarting the Mac. The Purge command allows inactive system memory to be converted into memory that can be used. You just need to enter the following command in the terminal.

Purge


4. Use the Open command to open multiple identical applications

The Open command opens the app in the terminal and uses-N to open multiple identical apps. For example, you can use the following command to open a new safari window

    1. Open-n/applications/safari.app/
Copy Code



5. Do not update OS X from the App Store

want to update your system but don't want to open the bloated Mac App Store? The following command can help you to upgrade OS X using a terminal.

    1. sudo softwareupdate-i-A
Copy Code



6. List all downloaded files

We can list all the downloaded content by the following command

    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 hide a file or folder, the Chflags command can be implemented. You just need to fill in the file path, like we're going to hide the Macx folder on the desktop. If you want to see the folder again, simply change the hidden to Nohidden.

    1. Chflags Hidden ~/desktop/macx
Copy Code



8. Automatically enter file path

you know that you can get a detailed path to a file by dragging any file from the Finder to a terminal window. When you want to enter a path to a file, you may wish to drag the file to try.



9. Create a password-protected compressed file

You can use the following command to create a macx.txt file on the desktop as a password-protected compressed file protected.zip.

    1. ZIP-E Protected.zip ~/desktop/macx.txt
Copy Code

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

9 Useful terminal command lines that all Mac users need to know

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.