Use of Terminal terminal under Mac

Source: Internet
Author: User

PS and Echo $SHELL See the SHELL you use;

sudo-i then enter the password, you can switch to root;

sudo passwd root to reset the root password;

Mans Command-name all the details of the command that can be known;

Absolute path : A full description of the location of a file, always beginning with a slash () (forward slash). / For example/Users/michelle/Public/Drop Box

relative path : Describes only a subset of location information, which is related to your current directory in command line. When you open the new Terminal program, the command line Session directory should be your home folder. The relative path of the above example folder is then written Public/Drop Box . Obviously it starts with the current directory. Like HTML, you can also use two dots (" .. ") to represent the parent directory, so you can represent the ancestor or sibling directory with a relative path. For example you can enter cd .. evencd ../..

The pwd means "Print working directory", which displays the absolute path of the current directory;

The meaning of ls is "list Directory Contents", which lists the contents of the current directory. This command also has other parameters to choose from;

The meaning of the CD is "Change Directory", which changes the current directory to the directory you specify. If you do not specify, you will be returned to your home folder;

If the directory has special characters (spaces, parentheses, quotation marks, [],!,$,&,*,;,|,\), then entering spaces directly can cause system recognition difficulties, and special syntax must be used to represent these characters. For example, in the example above, add a backslash "\" (backSlash) before the space: CD punlic/drop\ box/. In addition to backslashes, you can also use the quotation marks method: cd "Public/drop box". If you do not want to enter manually, you can also drag files from the Finder to the Terminal window to create an absolute path;

tab Complete (that is, pressing "tab" key) is one of the most time-saving features in command line, and it can also prevent you from entering errors by using its auto-completion file and directory name function.

The character of an e (tilde) can represent the home folder of the current user in command line. For example ~/Public/Drop\ Box/ is legal;

ls-a can view hidden files;

Cat "concatenate" means that the file is read sequentially and output to the Terminal window, with the syntax of cat followed by the path to the file you need to view. The cat command can also use >> to add the contents of a text file, such as a command cat. /textone.txt >> textTwo.txt will add textOne.txt content to the end of TextTwo.txt;


Use of Terminal terminal under Mac

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.