语法常识
- 一行写一个命令,在同一行写多个命令要用“;”隔开
- “#”表示注释(Windows 用“;”)
- 命令行中,如果内容有空格或其它特殊符号,需要用引号包围,如:”C:\Program Files”
- 一般命令后加
-?
或-h
会打印基本用法和选项信息,如node -?
cmd1 && cmd2
表示先执行cmd1
,成功后再执行cmd2
基本操作
echo hello
:打印指定内容
exit
:退出
open http://xuld.net
在浏览器打开网址(Windows 用 start http://xuld.net
)
文件操作
cd test
:进入指定文件夹,进入后所有操作都针对该文件夹(Windows 如果要切换根盘符,比如从 C: 切换到 D: ,还需要执行 D:
)
cd ..
:返回上级文件夹
ls
:列出当前文件夹的内容(Windows 用 dir
)
mkdir test
:创建 test 文件夹(Windows 用 md test
)
rm -rf test
:删除 test 文件夹(Windows 用 rd /r /f test
)
rm -f test.htm
:删除 test.htm 文件(Windows 用 del test.htm
)
cp from to
:将 from 文件或文件夹拷贝到 to 文件夹(Windows 用 copy from to
)
mv from to
:将 from 文件或文件夹移动到 to 文件夹(Windows 用 move from to
)
which node
:查看 node 的安装路径(Windows 用 where node
)
网络操作
ping xuld.net
:测试网络是否连通(如果通则显示时间,否则提示超时)
curl http://xuld.net
:打印指定链接的内容
wget http://xuld.net
:下载指定链接的内容
ifconfig
:查看本机 IP(Windows 用 ipconfig
)
打赏
微信扫一扫,打赏 1 元表示支持吧~

这篇文章对你有用?
