Common commands for Mac terminals

Source: Internet
Author: User
Tags clear screen diff disk usage

Basic Commands1, list file ls parameter directory name: see what's in the drive directory: LS/system/library/Extensions Parameters-W Display Chinese,-l details,-a includes hidden files2, converting a directory CD example: Think of a drive directory to stroll around a CD/system/library/Extensions3, create a new directory mkdir directory name example: Build a backup directory under the drive directory backup mkdir/system/library/extensions/Backup on the desktop to build a back-up directory on the backups mkdir/user/User name/desktop/Backup4, copy file CP parameter source file target file example: Want to copy the desktop Natit.kext to the drive directory CP-r/user/User name/desktop/natit.kext/system/library/The extensions 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 the desktop BACKUPCP-r/system/library/extensions/* /user/User name/desktop/backup5, delete file rm parameter file example: Want to delete the driver's cache Rm-rf/system/library/extensions.kextcache Rm-rf/system/libra Ry/extensions.mkext parameter-rf means recursive and mandatory, be careful to use, if executed RM-RF/your system is all gone 6, move file mv File example: Want to move Applehda.kext to the desktop mv/system/library /extensions/applehda.kext/user/user name/desktop want to move Applehda.kext to the backup directory Mv/system/library/extensions/applehda.kext/ SYSTEM/LIBRARY/EXTENSIONS/BACKUP7, text editing nano file name example: Edit Natit info.plist nano/system/library/extensions/natit.kext/info The. plist Directory Operation command name feature describes the use of an example mkdir to create a                                       Directory mkdir dirnamermdir Delete a directory                             RmDir dirnamemvdir Move or rename a directory Mvdir Dir1 DIR2CD                          Change current directory CD dirnamepwd display the path name of the current directory                     Pwdls         Displays the contents of the current directory Ls-la file operation command name function description                                       Use an example cat to display or connect the file cat filename od                        Display the contents of a non-text file od-c FILENAMECP copy a file or directory                                    CP file1 FILE2RM Delete file or directory RM filenamemv Change the file name or directory MV file1 file2 find finds files using matching expressions found .                             -name "*.C"-printfile display file type filename Select action command name                       Function Description Use example head to display the first few lines of a file                          Head-20 Filenametail Displays the last few lines of the file tail-15 filenamecut      Display some fields in each line of a file cut-f1,7-d:/etc/passwdcolrm remove several columns from standard input C                             OLRM 8 file2 diff compare and show two file differences diff file1 File2 Sort                                  Sort or merge Files sort-d-f-u File1uniq remove duplicate rows from a file                            Uniq file1 File2comm shows both public and non-public rows of two ordered files comm file1 FILE2WC                                         Number of characters, number of words, and number of lines in a statistical file WC filenamenl adds line numbers to the file                                                 NL file1 >file2 Process Operation command name function description                                                     Using the example PS display process Current state PS Ukill terminate process                                          Kill-9 30142 time Operation command name function description  Use an example date to display the current date and time of the system datecal display the calendar Cal 8 1996time The execution time of the statistical program A.out Network and pass-through                                  Letter Operation command Name function description Use example Telnet                                 Remote login telnet hpc.sp.net.edu.cnrlogin telnet Rlogin hostname-l Usernamersh Executes the specified command on the remote host rsh f01n03               Dateftp transferring files between the local host and the remote host FTPFTP.SP.NET.EDU.CNRCP copying files between the local host and the remote host                          rcp file1 host1:file2ping sends a response request to a network host ping Hpc.sp.net.edu.cnmail                                  Read and send e-mail mailwrite send a message to another user WriteUsername PTS/1MESG allow or deny receive messages MESG Nkorn Shell commands  Command name feature description Use example history to list the most recently executed                            Several commands and numbers Historyr repeatedly execute a command that was recently executed R-2alias                                  Define aliases for a command alias Del=rm-iunalias to cancel the definition of an alias                                         Unalias del Other command command name function description                                        Use example uname to display information about the operating system uname-aclear clear screen or window contents                       CLEARENV displays all currently set environment variables envwho                              Lists all users currently logged on Whowhoami display the user name that is currently in action   Whoamitty                      Display the name of the terminal or pseudo terminal Ttystty display or reset the control key definition Stty-adu querying disk usage du-k subdir DF/TMP Display total file system space and free space W displays the total information for the current system activity MAC OS X Terminal command on function 1. Show Library method under Lion: Show in terminal enter the following command: Chflags nohidden ~/library/Hide in terminal enter the following command: Chflags hidden ~/library/method Two: Open finder, menu, select Go to the option key to display the Asset library item (repeated actions are required each time). 2.Finder Show hidden files Show hidden files Enter the following command in Terminal: Defaults write Com.apple.finder appleshowallfiles-bool true killall finder to recover hidden files in " Terminal, enter the following command: Defaults write Com.apple.finder appleshowallfiles-bool false killall Finder3.xcode Uninstall Enter the following command in terminal: sudo/ Library/uninstall-devtools–mode=all is a directory that is actually installed, and Xcode is installed in the/developer directory by default and can be executed sudo/developer/library/ Uninstall-devtools–mode=all4. Display the full path in the Finder title bar enter the following command in Terminal: Defaults Write Com.apple.finder _ Fxshowposixpathintitle-bool YES killall Finder5. Remove windowScreenshot of the screen when the shadow screen (command-shift-4, space), the resulting picture will automatically be added a circle of shadow. If you don't like the effect of this shade, you can turn it off. In terminal, enter the following command: Defaults write com.apple.screencapture disable-shadow-bool true Killall SystemUIServer6. Force Safari to open a page in a new tab safari is the default Support tab browsing. However, when we click on a link on a page or click a link in another app, Safari tends to open a new window that causes too many safari windows on the page and is not well managed. With this little trick, we can let safari open the Web page by default in a new tab. Enter the following command in Terminal: Defaults write Com.apple.Safari targetedclickscreatetabs-bool true7. Change the save location of the screenshot picture Mac OS provides very handy screenshot shortcuts, Allows us to take screenshots of the entire screen, part of the screen, or the application window very quickly. However, this screenshot feature has one disadvantage, that is, you can only save screenshots to the desktop. If we take a lot of pictures, it will make the desktop seem very messy. Is there any way to modify the default location of screenshots? Yes. The method is very simple, as long as you enter the following command in "terminal". Defaults write com.apple.screencapture location killall systemuiserver When you enter a command, replace the "storage location" with a real folder.  For example, if you want to store the screenshots folder in your user directory, enter defaults write com.apple.screencapture location ~/screenshots Mac lock screen set shortcut keys if the user wants to leave the computer for a period of time, you can choose to directly close the notebook directly. However, the original running process will hang or end, if you are downloading, then the download will be suspended (sometimes can not recover), if the network service is being provided, then because the network is broken, others can not connect your notebook. Lock screen can solve this problem, under Windows with Win+l shortcut keys on the lock screen, but Mac OS X has not been the default shortcut keys. For beginners like me, don't say set the lock screen shortcut key, even if you want to use other lock screen method I have to go online to findTo. One way to do this is to first find the "Keychain Access" utility in the Finder (specifically/applications/utilities/keychain Access.app), and then select "Show Keychain status in the menu bar" in preferences. At this point we found that the system menu has a small icon like a lock, just click on it, you can find the lock screen. The above method realizes the lock screen, but has not yet reached the target of the shortcut key control lock screen. Although so, but it's effect gives us a lock screen idea. First, we ask the screen saver to enter a password when it resumes, and then the lock screen issue becomes a startup screen saver. Lock the screen via a keyboard shortcut This article describes the specific implementation methods. The first step is to find "security and privacy" under "System Preferences", and on the "General" page, tick "Enter your password immediately after going to sleep or start screen saver". The second step is to start the screen saver with a shortcut key, which is relatively complex. Find "Automator" in "Application". Create a new service, find "Start screen saver" in "Utilities" under "actions", and drag this action to the right, and select "No input" and "any application" as shown in. And then save the service as a name that you define.

Common commands for Mac terminals

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.