hexo使用方法备注

使用 Hexo + GitHub 可以轻松搞出一个好看的博客

  1. 在 GitHub 上新建一个空 repo,repo 名称是「你的用户名.github.io」(注意个用户名是你的GitHub用户名,不是你的电脑用户名)
  2. ‘npm install -g hexo-cli’,安装 Hexo
  3. ‘hexo init myBlog’
  4. ‘cd myBlog’
  5. ‘npm i’
  6. ‘hexo new xxx’(博客新文章名)
  7. start _config.yml,编辑网站配置
    1. 把第 6 行的 title 改成你想要的名字
    2. 把第 9 行的 author 改成你的大名
    3. 把最后一行的 type 改成 type: git
    4. 在最后一行后面新增一行,左边与 type 平齐,加上一行 repo: 仓库地址 (请将仓库地址改为「你的用户名.github.io」对应的仓库地址,仓库地址以 git@github.com: 开头你知道吧?不知道?不知道的话现在你知道了),repo后要记得加空格
  8. ‘npm install hexo-deployer-git –save’,安装 git 部署插件
  9. ‘hexo deploy’
  10. 进入「你的用户名.github.io」对应的 repo,打开 GitHub Pages 功能,如果已经打开了,就直接点击预览链接,你现在应该看到了你的博客!

第二篇博客

  1. hexo new 第二篇博客
  2. 复制显示的路径,使用 start 路径 来编辑它
  3. ‘hexo generate’
  4. ‘hexo deploy’
  5. 去看你的博客,应该能看到第二篇博客了

#换主题

  1. https://github.com/hexojs/hexo/wiki/Themes 上面有主题合集
  2. 随便找一个主题,进入主题的 GitHub 首页,比如我找的是 https://github.com/iissnan/hexo-theme-next
  3. 复制它的 SSH 地址或 HTTPS 地址,假设地址为 git@github.com:iissnan/hexo-theme-next.git
  4. ‘cd themes’
  5. ‘git clone git@github.com:iissnan/hexo-theme-next.git’
  6. ‘cd ..’
  7. 将 _config.yml 的第 75 行改为 theme: hexo-theme-next,保存
  8. ‘hexo generate’
  9. ‘hexo deploy’
  10. ‘等一分钟,然后刷新你的博客页面,你会看到一个新的外观。如果不喜欢这个主题,就回到第 1 步,重选一个主题。’

Git基础

写几个Git基础命令。

git init

用 git init 在目录中创建新的 Git 仓库。 你可以在任何时候、任何目录中这么做,完全是本地化的。在目录中执行 git init,就可以创建一个 Git 仓库了。

1
2
3
4
$ mkdir gitlearn
$ cd gitlearn/
$ git init
Initialized empty Git repository in /Users/yuanpengfei/gitlearn/.git/

git add

git add 命令可将该文件添加到缓存,如我们添加以下两个文件:

1
2
3
4
5
6
7
8
9
10
11
$ touch README
$ touch index.html
$ ls
README index.php
$ git status -s
?? README
?? index.php
$ git add README index.html
$ git status -s
A README
A index.php

git commit -v

显示有哪些更改

关于更多Git命令

能记得尽量记,不记得的话用的时候查
菜鸟教程

Linux基础

写几个Linux基础命令。

ls

查看当前目录下的文件

1
2
3
$ ls
Applications Documents Library Music Public
Desktop Downloads Movies Pictures

以列表方式查看当前目录下文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$ ls -l
total 0
drwx------@ 4 yuanpengfei staff 128 5 12 12:58 Applications
drwx------+ 9 yuanpengfei staff 288 5 13 17:12 Desktop
drwx------+ 8 yuanpengfei staff 256 5 13 19:57 Documents
drwx------+ 10 yuanpengfei staff 320 5 13 17:49 Downloads
drwx------@ 61 yuanpengfei staff 1952 5 13 17:30 Library
drwx------+ 3 yuanpengfei staff 96 5 12 00:25 Movies
drwx------+ 4 yuanpengfei staff 128 5 12 23:05 Music
drwx------+ 3 yuanpengfei staff 96 5 12 00:25 Pictures
drwxr-xr-x+ 4 yuanpengfei staff 128 5 12 00:25 Public
```
### 显示当前目录下所有文件,包括隐藏文件
``` bash
$ ls -a
. .config Desktop
.. .gitconfig Documents
.CFUserTextEncoding .node_repl_history Downloads
.DS_Store .npm Library
.ShadowsocksX-NG .oracle_jre_usage Movies
.Trash .ssh Music
.bash_history .swt Pictures
.bash_sessions .vscode Public
.bashrc Applications
```

## cat

### 打印文件内容到终端上
```bash
$ cat .bashrc
alias ll="ls -l"
cd ~/Desktop/

mv

将文件重命名或者移动到指定目录

1
2
3
4
5
$ ls
1.txt
$ mv 1.txt 2.txt
$ ls
2.txt

touch

创建一个空白文件

1
2
3
4
5
$ ls
1.txt
$ touch 2.txt
$ ls
1.txt 2.txt

explainshell.com

输入不认识的命令和后面的参数,explainshell会分辨解析命令的功能是什么,后面跟着的参数是什么,都是英文的,墙内的可以参考这个网站Linux命令大全

nodejs部分文件操作相关命令

写几个Git基础命令。

获取当前文件目录

1
process.cwd()

进入指定目录

1
process.chdir()

创建文件夹

1
2
var fs = require('fs');
fs.mkdirSync('./aaa');

创建文件

1
2
var fs = require('fs');
fs.writeFileSync('./aaa/hello','hello world!');