The following is a UNIX command line for reference directory operations command name function Description Use example mkdir to 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 display the current directory's path name Pwd ls display the contents of the current directory ls-la DIRCMP Compare contents of two directories dircmp dir1 dir2 file Operations command name feature description Use example cat display or connect file cat FILENAME PG Paging format display file contents PG Filename more Display the contents of the file more Filename od display the contents of non-text files od-c filename cp copy files or directories CP file1 file2 RM Delete file or directory RM filename mv change file name or directory MV file1 file2 ln join file ln-s file1 file2 find find file using matching expression. -name "*.C"-print file display file type filename Select action command name function description Use an example head display the first few lines of the file head-20 filename tail displays the last few lines of a file tail-15 Filename cut displays some fields in each line of the file cut-f1,7-d:/etc/passwd colrm remove several columns from standard input COLRM 8 20 File2 paste Horizontal Connection file paste File1 File2 diff compare and show two file differences diff file1 file2 sed non-interactive flow editor sed "s/red/ Green/g "Filename grep look up grep in file" ^[a-za-z] "Filename awk find and process patterns in Files awk ' {print $ ' filename Sort or merge files sort-d-f-u File1 uniq Remove duplicate rows from a file Uniq file1 File2 comm Displays the number of characters, words, and lines of the public and non-public rows of two ordered files Comm file1 FILE2 WC statistical files WC FILENAME NL Add line number to file NL file1 >file2 Security Operations command name function description Use an example  PASSWD to modify the user password passwd chmod change the permissions of 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 changing the owning group of a file or directory CHGRP staff filename xlock to terminal lockout xlock-remote programming operation Command name function Description Use example Make maintains the latest version of the executable program Make touch update file access and modification times touch-m 05202400 filename dbx command line interface debugging tool dbx a.out Xde Graphical user interface debugging tool XDE a.out process action command name function Description Use example  PS show process current status PS u kill terminate process kill-9 30142 Nice change the priority of the command to be executed nice cc-c *.c renice change the priority of a running process Renice +20 32768 time operation command name function Description Use example Date Displays the current date and time of the system date cal display Calendar cal 8 1996 time The execution time of the statistics program a.out Network and Communication operations command name function description use examples Telnet login telnet hpc.sp.net.edu.cn rlogin telnet rlogin hostname-l username rsh execute specified command on remote host rsh f01n03 date ftp transferring files between the local host and the remote host FTP ftp.sp.net.edu.cn RCP copying files between the local host and the remote host RCP file1 host1:file2 ping sends 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 receive messages MESG N korn Shell commands Command name function Description Use example history to list several recently executed commands and numbers history r repeat a recently executed command R-2 alias give a command a nickname alias del=rm-i Unalias to cancel the definition of an alias Unalias del other commands command name features describes the use of an example uname to display information about the operating system uname-a clear clear the screen or window contents clear  ENV displays all currently set environment variables env who lists all users currently logged on Who whoami display the name of the user currently in action Whoami tty display the names of the terminal or pseudo terminal tty Stty display or reset the control key definition stty-a du query disk usage du-k SUBDIR DF show the total space and free space of the file system df/tmp w show total information about current system activity W
Mac OS basic commands