terminal
1. fasr than GUI
2. access: the terminal provides a mainline into the heart of our computer, give us access to area we normally dont interact with.
3. tools: tools are installed and used via command line
shell
the program runnign on the terminal
举的例子: ATM取钱 ATM是terminal, ATM里的软件是shell
Bash: one of the most popular shells ( and the default on a mac)
常用命令
ls:list~
pwd( print working directory):快速定位在哪
cd(change direcotory):改位置 cd .. 回退
relative path vs absolute path
mkdir建新文件夹
man page 比如man ls 页面介绍一些flags ls可以用的
flags
touch新建文件 touch purple.txt
rm(remove) 删除文件
rmdir删除空白文件夹
rm -rf(加了这个-rf的flag)删除文件夹
section 31
Node JS
Node: A javascript runtime. Until recently, we could only run javascript in a web browser. node is javascript runtime that executes code outside of the browser.We can use the same Javascrpt syntax we know and love to write server side code, instread of relying on other languages like python or ruby.
node REPL
终端node 进入node REPL .Help 查看帮助
node firstScript.js 运行 js文件
Process & Argv
prpcess.argv
File system有两种模式 同步和异步
如果synchronous
需要用fs需要一开始在js写一行 const fs = require('fs');
const fs = require('fs')
const folderName = preocess.argv[2] ||'Project'
try{
fs.mkdirSync(folderName);
fs.writeFileSync('${folderName}/index.html')
fs.writeFileSync('${folderName}/app.js')
fs.writeFileSync('${folderName}/app.css')
}catch(e) {
console.log("something went wrong");
console.log(e);
}
node xx.js Cars
section 32 Modules & the NPM universe