常用cmd和linux命令
# 常用 cmd 和 linux 命令
# cmd
- 显示当前目录下的文件:
dir - 切换到其它盘目录:
d:(切到 d 盘)、c:(切到 c 盘) - 切到 Bash:
bash(切到 bash 可使用 linux 命令) - 打开计算器:
calc - 以树型展示当前文件夹下的内容:
tree - 查看端口进程并 kill 进程
- 查看端口
netstat -ano | findstr "443" - 杀死进程 2312
taskkill -PID 2312 -F
- 发起网络请求:
curl- 例如请求百度首页:
curl https://www.baidu.com - -X 参数:指定 HTTP 请求的方法,
curl -X POST https://www.baidu.com(发起 post 请求) - -d 参数:用于发送 POST 请求的数据体,
curl -d 'login=admin' -d 'password=123456' -X POST https://www.baidu.com - -b 参数:用来向服务器发送 Cookie,
curl -b 'user=coderly' https://www.baidu.com
- 例如请求百度首页:
# linux
- 显示当前目录下的文件:
ls - 切换到其它目录:
cd /usr - 查看当前用户:
whoami - 切换用户:
su [username],例如:su root(切换到 root 用户) - 查看当前所在路径:
pwd - 查找文件所在路径:
whereis [filename],例如:whereis nginx - 查看文件的内容:
cat [filename],例如:cat nginx.conf - 编辑文件:
vi [filename],例如:vi nginx.conf - 移动文件:
mv,例如:mv nginx.conf ../(将 nginx.conf 移动到上一层目录中) - 复制文件:
cp,例如:cp nginx.conf ../nginx.conf-2 - 删除文件:
rm [filename],例如:rm -rf nginx
上次更新: 2021/09/13, 15:11:59