常见的PowerShell、Linux命令及差异

命令行快速入门.pdf
链接: https://pan.baidu.com/s/1B-vA2udM86NvdMKQEZEp7g
密码: ykky

有时候会忘记一些常用的命令用法,写个小抄,方便有需要时快速查阅

Linux/Mac OSX 与 Windows 的差异(部分附带Python中os模块的函数)

Touch xxx 创建空文件
New-Item xxx -type file P:创建空文件

pwd print working directory(打印工作目录)
getcwd() (Python:打印当前目录)

hostname my computer’s network name(电脑在网络中的名称)

mkdir make directory(创建路径)

cd change directory(更改路径)

ls list directory(列出路径下的内容)

rmdir remove directory(删除路径)

pushd push directory(推入路径)

popd pop directory(推出路径)

cp copy a file or directory(复制文件或路径)
cp copy a file or directory(P:复制文件或路径)
robocopy robust copy(P:更可靠的复制命令,PowerShell除了cp还有robocopy

mv move a file or directory(移动文件或路径)

less page through a file(逐页浏览文件)

cat print the whole file(打印输出整个文件)
more page through a file(P:打印输出整个文件,PowerShell 无cat
type print the whole file(P:打印输出整个文件,PowerShell 无cat

xargs execute arguments(执行参数)
forfiles run a command on lots of files(P:在一大堆文件上面运行一条命令)

find find files(寻找文件)

dir /r find files(P:寻找文件)

grep find things inside files(在文件中查找内容)
select-string find things inside files(P:在文件中查找内容)

man read a manual page(阅读手册)
help read a manual page(P:阅读手册)

apropos find what man page is appropriate(寻找恰当的手册页面)
helpctr find what man page is appropriate(P:寻找恰当的手册页面

env look at your environment(查看你的环境)
get-childitem Env (P:)

echo print some arguments(打印一些参数)

export export/set a new environment variable(导出/设定一个新的环境变量)
set export/set a new environment variable(P:导出/设定一个新的环境变量)

exit exit the shell(离开 shell)

sudo DANGER! become super user root DANGER!(成为超级用户或 root,危险命令!)
runas DANGER! become super user root DANGER!(P:成为超级用户或 root,危险命令!)

chmod change permission modifiers(修改文件许可权限)
attrib change permission modifiers(P:修改文件许可权限)

chown change ownership(修改文件的所有者)
iCACLS change ownership(P:修改文件的所有者)

你可能感兴趣的:(常见的PowerShell、Linux命令及差异)