介绍几个简单的shell指令
windows 上建议使用 自带的 powershell或者安装的gitbash
win上对shell指令的支持程度较差
常用的一些
指令 | 作用 |
---|---|
cd | 目录切换 |
pwd | 查看当前目录 |
ls | 列出当前目录下的文件 |
mkdir | 创建文件夹 |
rmdir | 移除文件夹 |
echo | 打印内容 |
echo 'xxx内容' > 文件名 | 创建一个文件 |
rm | 删除指定文件 |
cat | 查看文件内容 |
more | 查看文件内容 |
按键:ctrl + L | 清空控制台内容 |
每个指令都有一些参数,自行面向搜索引擎学习上述指令的使用,记忆更加深刻一点
还有更多,自行搜索引擎或者技术社区探索一下
了解如何简单的:
- 在终端中使用Node
- 使用Node执行js文件
学习资料
npm script
在创建的 package.json
文件中 有一个 scripts
属性,我们可以在里面编写自定义指令
例如:
{
"name": "kerno-pictures",
"version": "1.0.0",
"description": "酷诺相册薄",
"main": "index.js",
"scripts": {
"hello": "echo 'hello world'",
"say":"echo 'say hello'",
"test":"npm run hello && npm run say"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ATQQ/kerno-pictures.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/ATQQ/kerno-pictures/issues"
},
"homepage": "https://github.com/ATQQ/kerno-pictures#readme"
}
可以看到我们自定义了 3个 script脚本
运行定义的 npm script
# 格式
npm run $scriptName
# hello
npm run hello
# test
npm run test