Unix commands in Mac OS X

Source: Internet
Author: User

Reference: http://www.renfei.org/blog/mac-os-x-terminal-101.html

One command line includes 4 Parts:command Name, Options, Arguments, Extras.

Man <command-name> : Give The Manual of this command.

Absolute and relative paths

/ : Root Directory

 .. : Parent directory.

Directory Operations

pwd : Print working directory, which'll show the absolute path of current folder.

ls : List directory contents. Ls–la:list all contents including hidden contents.

CD : Change directory.

mkdir : Make directories.

rmdir: Remove directories.

mvdir: Move or rename a directory.

Handling special characters (space, bracket, quotation mark,!, $, &, *,;, \, ...)

\ : Use back slash before the character. CD punlic/drop\ box/(= CD "Public/drop box").

File operations

cp : Copy files.

mv : Move files.

rm : Remove Files

VI: or VIM:A Programmers text editor

Nano: Nano ' s another editor, an enhanced free Pico clone.

cat : Concatenate and print files. It reads files sequentially, writing them to the standard output.

Cat File1:will Print the contents of file1 to the standard output.

Cat file1 file2 > File3:will sequentially print the cntents of File1 and File2 to the file3.

Cat File1–file2–file3:???

od: Octal, Decimal, hex, ASCII dump


which: Locate a program file in the user ' s path.

Find : Find. -name "*.C"-print

file: Determine file type.

Head: Display first lines of a file. head-10 filename.

  tail: Display The last part of a file.

cut: Cut out selected portions of each lie of a flie.

colrm: Remove columns from a file. COLRM 8 filename

diff: Compare files on line.

sort: Sort lines of text file.

uniq: report or filter out repeated lines in a file.

Comm: Select or Regject lines common to the files.

WC: Word, line, character, and byte count.

NL: line numbering filter. NL file1 > File2

Process actions

  PS : Process status PS u

  kill : Terminate or signal a process. Kill-9 30142

The kill utility sends a signal to the processes specified by the PID operand (s).

Only the super-user could send signals to other user ' s processes.

Some of the more commonly used signals:

1 HUP (Hang Up)

2 INT (interrupt)


6 ABRT (Abort)

9 KILL (non-catchable, non-ignorable Kill)

ALRM (Alarm)

term (software termination signal)

Time Operation:

  Date: Display or set date and time.

  cal: Display a calendar and the date of Easter Cal 4 2015.

Time: Time command Execution (totoal time elapsed.)

System Management

W: Display who was logged in and what they was doing.



su : Substitute user identify.

Sudo : Substitute user do, or super user does. It allows a permitted user to execute a command as the Superuser or another user.

Unix commands in Mac OS X

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.