iOS Development journal 9-terminal commands

Source: Internet
Author: User
Tags administrator password

Today, Bo Master has some end-use requirements, encountered some difficulties, here and we share, hope to progress together.

OSX uses the Unix file system, all the files are hanging under the directory "/" below, so there is no need to have the drive letter concept under Windows.

Note: In UNIX systems, there is a difference between uppercase and lowercase characters, and A.txt is not equal to a.txt. Root flag/Not dispensable, cd/system means to go to the system under the directory, while the CD system means to go to the system in the current directory.

Get permission

In order to prevent misoperation to destroy the system, then the user state when there is no access to the operating system important files, so first to get root permissions: "Sudo-s"
Then enter the password, enter the password without any echo, even the asterisk is not, just lose the return on the line.

Here are some common commands

newline command-----space +\                     Clear Command-----Clear

Cleaning System -----Use the following command: sudo periodic daily then enter the administrator password. If you change the daily to weekly, the weekly cleanup is run. Change to monthly, is to do monthly cleanup. If you enter directly: sudo periodic daily weekly monthly and then enter. is to make three clear.

Show hidden files
In terminal, enter the following command:
Defaults write Com.apple.finder Appleshowallfiles-bool true
Recovering hidden files

In terminal, enter the following command:
Defaults write Com.apple.finder Appleshowallfiles-bool false

List files----ls
Example: Want to see what is in the directory,
LS/
Want to see what's in the drive directory,
Ls/system/library/extensions
Parameter-W displays Chinese,-l details,-a including hidden files


Converting catalogs----CDs
Example: Want to see the files under the drive directory
Cd/system/library/extensions


Create a new catalog----mkdir
Example: Create a backup directory in the driver directory
Mkdir/system/library/extensions/backup
Build a backup directory on the desktop back up
mkdir/user/User name/desktop/backup

Copy file----CP
Example: Want to copy the desktop Natit.kext to the drive directory
Cp-r/user/User Name/desktop/natit.kext/system/library/extensions
The parameter R indicates a recursive operation of the directory, and Kext looks like a file under the graphical interface, which is actually a folder.
Back up all files in the drive directory to desktop backup
Cp-r/system/library/extensions/*/user/User name/desktop/backup

Move file----MV
Example: Want to move Applehda.kext to the desktop
mv/system/library/extensions/applehda.kext/user/User name/desktop
Want to move the Applehda.kext to the backup directory
Mv/system/library/extensions/applehda.kext/system/library/extensions/backup


Delete File----RM
Example: To delete a driver's cache
Rm-rf/system/library/extensions.kextcache
Rm-rf/system/library/extensions.mkext
Parameter-RF is recursive and mandatory, be careful to use, if executed "RM-RF/" Your system is all gone.

Change file permissions----chmod
Example: Set all files in the drive directory to root read/write, other users read only
Chmod-r 755/system/library/extensions
The parameter R is recursive, and 755 represents the permissions of each user


Script file name----SH
Example: Modify the driver after all the required operations into a script, after the driver has been modified to run once this script can be.
1. Running Nano/clean in terminal
2. Paste the following code into the nano
Rm-rf/system/library/extensions.kextcache
Rm-rf/system/library/extensions.mkext
Chown-r root:wheel/system/library/extensions
Chmod-r 755/system/library/extensions
Diskutil repairpermissions/
Kextcache-k/system/library/extensions/
3. Ctrl +o disk, ctrl+x exit
4. Once the driver is moved, run it once in the terminal Sh/clean

iOS Development journal 9-terminal commands

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.