ArticleDirectory
Basic commands
1. List objects
Ls parameter directory name
For example, see what is in the driver directory:
Ls/system/library/extensions
Parameter-W displays Chinese characters,-l details,-A includes hidden files
2. Convert the directory CD
For example, think of a loop in the driver directory.
CD/system/library/extensions
3. Create a new directory
Mkdir directory name
For example, create a backup directory backup under the driver directory.
Mkdir/system/library/extensions/backup
Create a backup directory backup on the desktop
Mkdir/user name/desktop/backup
4. Copy an object
CP parameter source file target file
For example, you want to copy the natit. kext file on the desktop to the driver directory.
CP-r/user name/desktop/natit. kext/system/library/extensions
The R parameter indicates recursive operation on the directory. kext looks like a file on the GUI, but actually a folder.
Back up all files in the driver directory to the desktop backup
CP-r/system/library/extensions/*/user name/desktop/backup
5. delete an object
Rm parameter file
For example, you want to delete the driver cache.
Rm-RF/system/library/extensions. kextcache
Rm-RF/system/library/extensions. mkext
Parameter-RF indicates recursion and force. Be careful when using this parameter. If you run Rm-RF/your system, it's all gone.
6. Move files
MV File
For example, you want to move applehda. kext to the desktop.
MV/system/library/extensions/applehda. kext/user name/desktop
I want to move applehda. kext to the backup directory.
MV/system/library/extensions/applehda. kext/system/library/extensions/backup
7. text editing
Nano file name
For example, edit natit info. plist.
Nano/system/library/extensions/natit. kext/info. plist
Directory operations
Command name
; Function Description
Example
Mkdir
; Create a directory
Mkdir dirname
Rmdir;
Delete a directory
Rmdir dirname
Mvdir;
Move or rename a directory
Mvdir dir1 dir2
CD
Change current directory
CD dirname
PWD
Display the path name of the current directory
PWD
Ls
Display the content of the current directory
Ls-la
File Operations
Command name
Function Description
Example
Cat
Display or connect files;
Cat filename
Od
Show non-text file content
Od-C filename
CP
Copy a file or directory;
CP file1 file2
Rm
Delete a file or directory
Rm filename
MV
Change the file name or directory
MV file1 file2
Find
Search for files using matching expressions
Find.-Name "*. c"-print
File
Display file type
File filename
Select Operation
Command name
Function Description
Example
Head
Displays the first few lines of the file;
Head-20 filename
Tail
Displays the last few lines of the file;
Tail-15 filename
Cut
Display certain fields in each row of a file
Cut-F1, 7-D:/etc/passwd
Colrm
Delete several columns from the standard input;
Colrm 8 20 file2
Diff
Compare and display the differences between the two files
Diff file1 file2
Sort
Sort or merge files
Sort-D-f-u file1
Uniq
Remove duplicate rows from the file
Uniq file1 file2
Comm;
Shows the public and non-public rows of two ordered files;
Comm file1 file2
WC
Number of characters, words, and lines in the Statistical File
WC filename
NL
Add the row number to the file
NL file1> file2
Process operations
Command name
Function Description
Example
PS
Display current process status
PS u
Kill
Terminate the process;
Kill-9 30142
Time Operation
Command name
Function Description
Example
Date
Displays the current date and time of the system.
Date
Cal
Show Calendar
Cal 8 1996
Time
StatisticsProgramExecution time
Time A. Out
Network and communication operations
Command name
Function Description
Example
Telnet
Remote Login
Telnet hpc.sp.net.edu.cn
Rlogin
Remote Login
Rlogin hostname-l Username
Rsh;
Run the specified command on the remote host
Rsh f01n03 date
FTP;
Transfers files between the local host and remote host
FTP
Ftp.sp.net.edu.cn
RCP
Copy files between the local host and remote host
RCP file1 host1: file2
Ping;
Send a Response Request to a network host;
Ping hpc.sp.net.edu.cn
Mail
Reading and sending emails;
Mail
Write
Send messages to another user
Write username pts/1
Mesg
Allow or reject receiving packets
Mesg n
Korn shell command
Command name
Function Description
Example
History
Lists the commands and numbers that have been executed recently;
History
R
Repeat the execution of a recent command.
R-2
Alias
Define an alias for a command
Alias del = Rm-I
Unalias
Cancels the definition of an alias.
Unalias del
Other commands
Command name
Function Description
Example
Uname
Displays information about the operating system.
Uname-
Clear;
Clear screen or window content
Clear
Env;
Display All currently set Environment Variables
Env
WHO;
List all users currently logged on
Who
Whoami;
Displays the username currently performing the operation
Whoami
Tty
Display terminal or Pseudo Terminal name
Tty
Stty
Display or reset control key definitions
Stty-
Du
Query disk usage Du-K subdir
DF/tmp
Displays the total space and available space of the file system.
W
Displays the total information of the current system activity.