IOS development diary 9-terminal commands, ios diary 9-Terminal
Today, bloggers have some terminal usage requirements and encountered some difficulties. I would like to share with you the hope to make common progress.
OSX uses Unix file systems. All files are mounted under the directory "/". Therefore, the concept of drive letters in Windows is not required.
Note: In the unixsystem, A. txt is not the same as a.txt. The root directory flag/is not dispensable. cd/System indicates to go to the System in the directory with the root directory, and cd System indicates to go to the System in the current directory.
Get Permissions
To prevent misoperation and damage to the system, the user does not have the permission to operate on important files of the system. Therefore, the user must first obtain the root permission: "sudo-s"
Then, enter the password. When you enter the password, there is no echo and no star number. Just press Enter.
The following are some common commands:
Line feed command ----- space + \ clear command ----- clear
Clear the system ----- run the following command: sudo periodic daily, press enter, and enter the administrator password. If you change "daily" to "weekly", weekly cleanup is performed. Change to monthly to clean up every month. If you enter sudo periodic daily weekly monthly directly, then press Enter. It is equivalent to clearing the three together.
Show Hidden Files
Enter the following command in terminal:
Defaults write com. apple. finder AppleShowAllFiles-bool true
Restore hidden files
Enter the following command in terminal:
Defaults write com. apple. finder AppleShowAllFiles-bool false
List Files ---- ls
For example, I want to see what is in the directory,
Ls/
Want to see what is in the driver directory,
Ls/System/Library/Extensions
Parameter-w displays Chinese characters,-l details,-a includes hidden files
Conversion directory ---- cd
For example, you want to view the files in the driver directory.
Cd/System/Library/Extensions
Create a directory ---- mkdir
For example, create a backup directory backup under the driver directory.
Mkdir/System/Library/Extensions/backup
Create a backup directory backup on the desktop
Mkdir/User name/Desktop/backup
Copy file ---- cp
For example, you want to copy the Natit. kext file on the desktop to the driver directory.
Cp-R/User name/Desktop/Natit. kext/System/Library/Extensions
The R parameter indicates recursive operation on the directory. kext looks like a file on the GUI, but actually a folder.
Back up all files in the driver directory to the desktop backup
Cp-R/System/Library/Extensions/*/User name/Desktop/backup
Mobile file ---- mv
For example, you want to move AppleHDA. Kext to the desktop.
Mv/System/Library/Extensions/AppleHDA. kext/User name/Desktop
I want to move AppleHDA. Kext to the backup directory.
Mv/System/Library/Extensions/AppleHDA. kext/System/Library/Extensions/backup
Delete file ---- rm
For example, you want to delete the driver cache.
Rm-rf/System/Library/Extensions. kextcache
Rm-rf/System/Library/Extensions. mkext
Parameter-rf indicates recursion and force. Be careful when using this parameter. If you run "rm-rf/", your system will be completely gone.
Change file permissions ---- chmod
For example, set all files in the driver directory to root for read and write, while other users are read-only.
Chmod-R 755/System/Library/Extensions
The R parameter indicates recursion, and 755 indicates the permissions of each user.
Script File Name ---- sh
For example, after the driver is modified, all required operations are saved as a script. After the driver is modified, you only need to run the script once.
1. Run nano/clean in the terminal
2. paste the following code into 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. Press Ctrl + O to save the disk, press Ctrl + X to exit
4. Run sh/clean once on the terminal as long as the driver is activated.