Mac Terminal commands

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

Directory Operations
command name function Description Examples of Use
Mkdir Create a Directory mkdir dirname
RmDir Delete a directory RmDir dirname
Mvdir Move or rename a directory Mvdir Dir1 Dir2
Cd Change the current directory CD dirname
Pwd Displays the path name of the current directory Pwd
Ls Display the contents of the current directory Ls-la
dircmp Compare the contents of two directories DIRCMP Dir1 Dir2
File operations
command name feature description use example
cat show or connect files cat filename
pg page format display file contents pg filename
more split screen display file contents more filename
od Show Non- Content of the text file od-c filename
cp Copy file or directory CP file1 file2
rm Delete a file or directory rm filename
mv Change the file name or directory mv File1 file2
ln join file ln-s file1 file2
Find find files using matching expressions find.-name "*.c"-print
file display files of type file filename
Open opening a file with the default program open filename
Select action
command name function Description Examples of Use
Head Show the first few lines of a file head-20 filename
Tail Display the last few lines of a file tail-15 filename
Cut Display some fields in each row of a file Cut-f1,7-d:/etc/passwd
Colrm Remove several columns from standard input COLRM 8 File2
Paste Cross-connect files Paste File1 file2
Diff Compare and display the differences of two files diff File1 File2
Sed Non-interactive mode flow editor Sed "s/red/green/g" filename
Grep Find in Files by pattern grep "^[a-za-z]" filename
Awk Find and manipulate patterns in files awk ' {print '} ' filename
Sort Sort or Merge files sort-d-f-u File1
Uniq Remove duplicate rows from a file Uniq file1 file2
Comm Public and non-public rows showing two ordered files Comm File1 File2
Wc The number of characters, words, and lines of a statistic file WC filename
nl Add a line number to a file NL file1 >file2
Safe operation
command name function Description Examples of Use
passwd Modify User Password passwd
chmod Change permissions for a file or directory chmod ug+x filename
Umask Define a permission mask to create a file Umask 027
Chown Change the owner of a file or directory Chown newowner filename
Chgrp Change the owning group of a file or directory CHGRP staff filename
Xlock To lock the terminal Xlock-remote
Programming operations
command name function Description Examples of Use
Make Maintaining the latest version of an executable program Make
Touch Update file access and modification times Touch-m 05202400 filename
Dbx Command line interface Debugging Tools DBX a.out
Xde Graphical user interface Debugging Tools Xde a.out
Process actions
command name function Description Examples of Use
Ps Show the current status of the process PS u
Kill Terminating a process Kill-9 30142
Nice Change the priority of the pending command Nice cc-c *.c
Renice Change the priority of a running process Renice +20 32768
Time operation
command name function Description Examples of Use
Date Displays the current date and time of the system Date
Aa. Show Calendar Cal 8 1996
Time Execution time of the statistical program Time A.out
Network and communication operations
command name function Description Examples of Use
Telnet Telnet Telnet hpc.sp.net.edu.cn
Rlogin Telnet Rlogin hostname-l username
Rsh Execute the specified command on the remote host RSH f01n03 Date
Ftp Transferring files between a local host and a remote host FTP ftp.sp.net.edu.cn
Rcp Copying files between a local host and a remote host rcp file1 host1:file2
Ping Send a response request to a network host Ping hpc.sp.net.edu.cn
Mail Read and send e-mail Mail
Write Send a message to another user Write username PTS/1
Mesg Allow or deny receiving of messages MESG N
Korn shell command
command name function Description Examples of Use
History List several recently executed commands and numbers History
R Repeatedly executes a command that has been recently executed R-2
Alias To define an alias for a command Alias Del=rm-i
Unalias To cancel the definition of an alias Unalias del
Other commands
command name function Description Examples of Use
Uname Displays information about the operating system Uname-a
Clear Clear screen or window contents Clear
Env Show all currently set environment variables Env
W.H.O. List all users who are currently logged on W.H.O.
WhoAmI Displays the user name that is currently in action WhoAmI
Tty Displays the name of the terminal or pseudo terminal Tty
Stty Display or reset control key definitions Stty-a
Du Querying disk usage Du-k SubDir
Df Displays the total and free space of the file system Df/tmp
W Displays the total information for the current system activity W

Mac Terminal commands

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.