Mac commonly used terminal commands to clean up computer knowledge
As a developer, more and more feel for the use of the terminal, is very necessary, I contact this less before, but also occasionally use (University did not learn Unix), now summed up a few, follow-up will add, life-long learning ~
1. Get Administrator privileges:
Input Sudo-s
Then enter the password, do not prompt, enter a direct return, then get administrator rights.
2. Open the file
Input Open/applications/safari.app
This opens Safari browser, which can be opened multiple times using the Open command (some of the software is not allowed to open multiple windows). open+ Space +-n + software path (can be dragged directly to the terminal)
We can also add the-a ID to the command to select the application you want to use to load the file, or edit it directly in the text editor using the-e identity. Example: Open/users/rhjt/desktop/image.png-a/applications/safari.app (open image Image in Safari browser)
3. Search
On the search, Mac with Spotlight (Ctr/cmd + space) can achieve global search, but sometimes not the right job, and if we want to exact a range?
Enter Mdfind + filename to achieve global search
Enter a large path to the Mdfind-onlyin file a filename under the path (so that we can more accurately search for the file we want when we have a large path to the exact file)
4. Read
Siri in the Mac, you can read out what we've entered.
Input say + content, and then will read out (do not understand the pronunciation of words, do not have to look for a dictionary ~ ~)
5. Delayed sleep
Caffeinate can prevent the Mac from getting to sleep and screen protection is not activated. We'd better use-t to add a specific time to the command.
Input Caffeinate-t 3600 means the screen does not sleep within one hours
6. Free memory (equivalent to restart the computer)
The purge command clears the cache of memory and hard disks and is almost as effective as restarting the MAC (not shutting down the program you're using). The purge command can turn inactive system memory into a memory that can be used, so try this command on a computer card ~ ~
Input purge
7. Update
Our update system software is usually updated through the App store, but the app store often opens too slowly, so use the terminal to update it.
Enter sudo softwareupdate-i-a
This is the software that updates the system, such as System update
8. Create a password-protected compressed file
You can create a password-protected compressed file from the desktop by using the following command.
ZIP-E Protected.zip ~/desktop/task.doc
Protected.zip is the name of the file, ~ is the file address. Once saved, the file is stored on your private disk
9. Delete
Ctrl+u deletes the current entire line.
Ctrl+w the word before the cursor is deleted.
Ctrl+k deletes text from the current cursor to the end of the line.