Command line classification under Windows

Command line classification under Windows

1. The Windows port is occupied

# 查询端口
netstat -ano
# 查询指定端口
netstat -ano |findstr "端口号"
# 根据进程PID查询进程名称
tasklist |findstr "进程PID号"
# 根据PID杀死任务
taskkill /F /PID "进程PID号"
# 根据进程名称杀死任务
taskkill -f -t -im "进程名称"
# 获取使用帮助
taskkill /?

2. Directory files

# 查看目录文件
# 查看当前目录下的文件,类似于linux下的ls
dir
# 查看隐藏文件的或者更多操作
dir /?
python /? 
java /? 

# 创建目录和删除目录
# 创建目录
md 目录名(文件夹)
# 删除目录
rd 目录名(文件夹)
# 切换磁盘
d:(进入 d 盘)
# 切换磁盘和目录
cd /d d:/test(进入 d 盘 test 文件夹)
# 进入文件夹
cd \test1\test2(进入 test2 文件夹)
# 返回根目录
cd \
# 回到上级目录
cd ..

# 复制文件
copy 路径\文件名 路径\文件名 :把一个文件拷贝到另一个地方
# 移动文件
move 路径\文件名 路径\文件名 :把一个文件移动(就是剪切+复制)到另一个地方
# 删除文件
//这个是专门删除文件的,不能删除文件夹
del 文件名

3. Network commands

# 查看本机ip
ipconfig
# 清除屏幕,类似于linux下的clear
cls
# 用来测试网络是否畅通
ping ip(主机名)
# 清除本地 DNS 缓存
ipconfig /flushdns

# 查看网络连接状态,获取命令行使用帮助信息
netstat -help
# 查看网络连接、状态以及对应的进程id
netstat -ano
# 使用管道符,进行模糊查询
netstat -ano|find ".8"

# 确定IP数据包访问目标时所选择的路径
# 获取使用帮助
tracert /?

4. Basic commands

# 使用help命令,查看所有的dos命令
# 找到命令之后,使用 命令+ /?来查看该命令下的其他属性
命令 -help
命令  /? 

# 辅助符号或命令,|代表前一个的输出代表后一个的输入
# 例如查找特定ip的网络连接及进程号
netstat -ano|find "ip地址"

#  > 重定向输出并覆盖源文件
# 打印线程到指定文件, 1.txt的文件内容先被清空,在写入内容
jstack 1111 >E:/1.txt
# >>重定向输出追加到文件末尾,在1.txt文件末尾加上hello
echo hello >>E:\1.txt

# 终止一直在运行的命令
ctrl+c

5. Shutdown, restart, logout, hibernation, timing

# 关机
shutdown /s
# 重启
shutdown /r
# 注销
shutdown /l
# 休眠 
shutdown /h /f
# 取消关机
shutdown /a
# 定时关机
shutdown /s /t 3600(3600 秒后关机)

记录每一个学习瞬间

Guess you like

Origin blog.csdn.net/qq_51601665/article/details/130385956
Recommended