MAC OS X Common Commands (reprint)

Source: Internet
Author: User
Tags parent directory

Today, a small study of the Mac terminal commands, mainly for the convenience of debugging programs, Xcode do not come ah ...

Make a note here. Prevent loss

PWD Current Working directory

CD (without parameters) into root

CD (folder) access to folders

Cd.. Parent Directory

cd ~ Back to Root

CD-Returns the last visited directory

RM File name Delete

Cat file name (|less) to view files under Terminal

LS lists all files in the directory

CP file name destination directory copy files to target directory

~ stands for root such as: ~/document/cpp2/

Mkdiv new Folder

g++ source file name compile source files, generate a.out

./file name run for example:./a.out < input file name > output file name

Control+d Interrupt a.out operation

Nano scripting language Ctrl+o storage

Nano .... SH Open

Bash .... SH Run script

echo "... $i ..." Output statement

So at present our Linux (in the case of CentOS 5.x) How many shells we can use? You can check/etc/shells this file, at least there are several shells that can be used at the bottom:

    • /bin/sh (has been replaced by/bin/bash)
    • /bin/bash (is the Linux default shell)
    • /bin/ksh (KornShell by T-Bell Lab. Developed, compatible with bash)
    • /BIN/TCSH (Consolidated C Shell, provides more features)
    • /BIN/CSH (has been replaced by/BIN/TCSH)
    • /bin/zsh (based on Ksh developed, more powerful shell)
Bash is a shell, and Linux is now the default shell for bash. When you use Ubuntu 10.4.1 to develop Android, the shell is also changed to bash. Mac OS default shell is bash, open terminal, default is bash if enter command in Terminal bash:taylors-mac-mini:~ taylor$ bash
Bash-3.2$ then enter the instructions under bash-3.2$ xxxxxxx, which is actually the equivalent of bash .... sh Run script exit Bash script mode directly exit is back to the user state Error Understanding: Enter bash in the user state to enter bash, In fact, the terminal is bash, do not need to enter the bash entered, in the bash-3.2$ state entered the command is actually a bash script.

MAC OS X common Commands (reprint)

Related Article

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.