1. Common commands
1.1 cd command
D: //Enter the D drive
F: //Enter the F disk
cd /? //Get usage help
cd \ //Jump to the root directory of the hard disk
cd C:WINDOWS //Jump to other files on the current hard disk
d: //Jump to other hard drives
cd /de:software //Jump to other folders on other hard drives, note that the /d parameter must be added here
cd.. //Jump to the previous directory
1.2 View the file directory
dir //View the files in the current directory, similar to ls under linux
dir /? //View hidden files or more operations
1.3 Create and delete directories
md directory name (folder) // create directory
rd directory name (folder) //delete directory
1.4 View the IP of this level
ipconfig //IPv4 address is the IP of this level
1.5 Clear the screen
cls //clear cmd screen
1.6 Copy files
copy path\filename path\filename: copy a file to another place
1.7 Moving files
move path\file name path\file name: move a file (that is, cut + copy) to another place
1.8 Delete files
del file name //This is for deleting files, not folders
1.9ping
ping ip(hostname) //used to test whether the network is unblocked
1.10 list all task process numbers, kill process
1. View port occupancy, corresponding process, and kill process
View port usage
netstat –ano can view all processes
2. View the program occupying the specified port
When you use IIS to publish programs, you often encounter the situation that port 80 is occupied. We want to know which program or process occupies the port. You can use this command netstat –ano|findstr [specified port number]
For example: query the process that occupies port 80: netstat -ano|findstr "80"
3. Kill related processes through the task manager
Method 1: Kill the process using Task Manager
Open Task Manager -> View -> Select Column -> Then check the PID option, go back to Task Manager to view the corresponding pid, and then end the process
Of course, the above method is sometimes not easy to use, that is, when there are many processes in the task manager, it is very troublesome to find the corresponding process, so there is another way to kill the process
Method 2: Use the command to kill the process
1> First find the process name corresponding to the process number
tasklist|findstr [process number]; such as: tasklist|findstr 2936
2> Then kill the process according to the process name
taskkill /f /t /im [process name]; for example: taskkill /f /t /im /ChsIME.exe
***
taskkill
taskkill /? //Get usage help
taskkill is used to terminate the process. The specific command rules are as follows:
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]
describe:
This command line tool can be used to kill at least one process.
The process can be terminated according to the process id or the image name (Image).
parameter list:
/S system Specifies the remote system to connect to.
/U [domain\]user specify which user context should be in
Execute this command:
/P [password] Specifies a password for the provided user context. If omitted, prompts for input.
/F Specifies the process to be forcibly terminated.
/FI filter Specifies tasks to filter into or out of queries.
/PID process id Specifies the PID of the process to be terminated.
/IM image name Specifies the image name of the process to be terminated. The wildcard '*' can be used to specify all image names.
/T Tree kill: Terminates the specified process and any child processes started by it.
/? Display help/usage.
For example:
TASKKILL /S system /F /IM notepad.exe /T
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM QQ.exe
TASKKILL /F /IM notepad.exe /IM mspaint.exe
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
1.11netstat View network connection status
Displays protocol statistics and current TCP/IP network connections. This command can view the status of all network links established by the current machine and which process they correspond to
netstat -help Get command line usage help information
netstat -ano //View network connection, status and corresponding process id
grammar:
netstat [options]
parameter:
-a or --all: Display Sockets in all connections;
-A<network type> or --<network type>: list the relevant addresses in the connection of this network type;
-c or --continuous: Continuously list the network status;
-C or --cache: Display the cache information of the router configuration;
-e or --extend: display other relevant information of the network;
-F or --fib: display FIB;
-g or --groups: Display the list of multicast function group members;
-h or --help: online help;
-i or --interfaces: display the network interface information form;
-l or --listening: Display the Socket of the server under monitoring;
-M or --masquerade: display masquerading network connections;
-n or --numeric: use the ip address directly without going through the domain name server;
-N or --netlink or --symbolic: Display symbolic link names of network hardware peripherals;
-o or --timers: display timers;
-p or --programs: Display the program identification code and program name that are using Socket;
-r or --route: Display Routing Table;
-s or --statistice: Display network work information statistics table;
-t or --tcp: Display the connection status of the TCP transport protocol;
-u or --udp: Display the connection status of the UDP transport protocol;
-v or --verbose: display the instruction execution process;
-V or --version: display version information;
-w or --raw: Display the connection status of the RAW transmission protocol;
-x or --unix: The effect of this parameter is the same as specifying the "-A unix" parameter;
--ip or --inet: The effect of this parameter is the same as specifying the "-A inet" parameter.
1.12 find
find /? get help
netstat -ano|find ".8" //Use the pipe symbol to perform fuzzy query
1.13 tracert
tracert is also known as the Windows route tracing utility, using the tracert command in the command prompt (cmd) can be used to determine the path selected by the IP data packet to access the target.
tracert /? Get usage help
2. View the commands under cmd
1. After using this command, we can see all the dos commands, and there are Chinese explanations behind them. It's not too good, so that we can find the commands we want to use according to our own needs.
2. After finding the command, use command + /? to view other attributes under the command
Command -help //The first form of help
Command /? //The second form of help
Note: These characters can only be in English
3. Auxiliary symbols or commands
3.1 '|'
"|" in the cmd command | represents the output of the previous one and the input of the latter
Find the network connection and process number of a specific ip: netstat -ano|find "192.168.1.10"
3.2 Redirect output symbols >>>
Transfer the content originally output to the command window to a file, such as jstack 12912 >d:/s.txt print thread to the specified file
cmd > redirects the output and overwrites the source file.
For example
echo hello >c:\1.txt // The file content of 1.txt is cleared first, and then written into hello.
cmd >> redirected output is appended to the end of the file
echo hello >>c:\1.txt // Add hello at the end of the 1.txt file
3.3 Redirect input symbol <<<
cmd < file
Make cmd command read from file
cmd << text
This mode performs shell variable substitution on the input unless the input is enclosed in quotes .
If you use <<-, the tab at the beginning of the next input line will be ignored, and the end line can also be a bunch of tabs plus a content that is the same as text, you can refer to the following examples.
cmd <<< word
Provide the word (instead of the file word) and the following newline as input to cmd
cmd <> file
Redirects the file file to the input in read-write mode, the file file will not be destroyed. It only makes sense if the application takes advantage of this feature.
cmd >| file
The function is the same as >, but it will overwrite the file even when noclobber is set. Note that | is used instead of ! in some books. Currently, >! is still used only in csh to achieve this function.
3.4 Terminate the running command ctrl+c
Sometimes a command keeps printing output results (such as ping 192.168.1.10 -t ), we want to terminate the execution of this command, just press ctrl+c .
3.5 Clear the cmd window content command cls
Sometimes there are too many cmd contents, scrolling is exhausting, and the screen content needs to be cleared, just enter cls directly
In the cmd command, press the up arrow on the keyboard to directly copy the previous command
3.6 Common tools
Process Explorer , query the detailed information of the process, such as querying the java process startup parameters, operating environment, thread information, network connection information, which dlls are used, and what handles are opened. Contains registry, Socket, files, etc.
4. Add some shortcut keys under Windows
win+E open file manager
win+D display desktop
win+L lock computer
alt+F4 close the current program
ctrl+shift+Esc to open the task manager (or ctrl+alt+delete)
ctrl+F Search in a text or web page, quite practical (usually press ESC to exit)
ctrl+A select all text