暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

cmd和bash部分命令比对

原创 trex 2023-05-18
517
命令 CMD Bash
显示文件内容 type file.txt cat file.txt
目录操作 dir ls
切换目录 cd directory cd directory
删除文件 del file.txt rm file.txt
删除目录 rmdir directory rm -r directory
复制文件 copy source destination cp source destination
清除屏幕 cls clear
显示当前目录 cd pwd
创建目录 mkdir directory mkdir directory
移动/重命名文件或目录 move source destination mv source destination
显示环境变量 echo %VAR% echo $VAR
命令重定向 command > file.txt command > file.txt
管道操作 command1 | command2 command1 | command2
设置环境变量 set VAR=value export VAR=value
查找文件/目录 dir /s /b filename find /path/to/directory -name "filename"
文件重定向(追加模式) command >> file.txt command >> file.txt
显示系统日期和时间 date date
查看文件权限 ls -l
执行脚本文件 script.bat ./script.sh
查看文件头部信息 more file.txt head file.txt
查看文件尾部信息 tail file.txt
列出系统环境变量 set env
压缩文件和目录 tar -czvf archive.tar.gz directory
查找并替换文本 findstr "search" file.txt grep "search" file.txt
显示文件大小 dir /s file.txt du -h file.txt
复制目录 xcopy source destination /E cp -r source destination
移动目录 move source destination mv source destination
重命名目录 ren old_name new_name mv old_name new_name
显示文件属性 attrib file.txt ls -l file.txt
创建空白文件 copy nul file.txt touch file.txt
列出当前进程 tasklist ps aux
结束进程 taskkill /PID pid kill pid
显示 IP 配置 ipconfig ifconfig
显示网络连接 netstat -a netstat -a
执行后台任务 start /B command command &
显示系统信息 systeminfo uname -a
显示当前登录用户 echo %USERNAME% echo $USER
显示当前日期 echo %DATE% date +%Y-%m-%d
显示当前时间 echo %TIME% date +%H:%M:%S
清除环境变量 set VAR= unset VAR
延迟执行 timeout /T seconds sleep seconds
打印文本 echo "text" echo "text"
显示文件扩展名 dir /x ls -l --format=single-column
清空文件内容 echo. > file.txt > file.txt
查看命令历史记录 doskey /history history
执行上一个命令 !! !!
执行上一个命令并编辑 doskey /insert fc
列出正在运行的进程 tasklist ps -ef
显示网络接口信息 ipconfig /all ifconfig -a
远程登录 mstsc ssh
切换用户 runas /user:username cmd su username
显示磁盘空间 wmic logicaldisk get size,freespace,caption df -h
比较文件内容 fc file1.txt file2.txt diff file1.txt file2.txt
压缩文件 compact /c file.txt gzip file.txt
解压文件 compact /u file.txt gzip -d file.txt.gz
显示系统进程树 pstree
显示系统负载 uptime
显示文件编码 chcp file -i file.txt
显示命令帮助 command /? man command
创建符号链接 mklink link target ln -s target link
显示文件最后修改时间 dir /tw file.txt ls -l --time=modification file.txt
显示文件最后访问时间 dir /ta file.txt ls -l --time=access file.txt
显示文件创建时间 dir /tc file.txt ls -l --time=creation file.txt
显示进程详细信息 tasklist /v ps -efl
显示环境变量值 echo %VAR% echo $VAR
设置环境变量值 set VAR=value export VAR=value
显示网络路由表 route print netstat -r
显示计算机名称 hostname hostname
显示当前用户权限 whoami whoami
显示 CPU 信息 wmic cpu get name cat /proc/cpuinfo
显示内存信息 wmic memorychip get capacity cat /proc/meminfo
显示磁盘信息 wmic diskdrive get caption,size lsblk
显示操作系统版本 ver uname -a
显示当前用户目录 cd echo $HOME
显示环境变量列表 set env
显示进程 ID tasklist /fi "imagename eq process.exe" pgrep process
显示文件/目录大小 dir /s file.txt du -h file.txt
最后修改时间:2023-05-18 11:14:34
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论