ps

ps (process status) 命令用于显示当前进程的状态,类似于 windows 的任务管理器

查找指定进程

1
2
$ ps -ef | grep  key
cs 4565 4533 0 21:14 pts/2 00:00:00 /opt/ELK/elasticsearch-7.17.1/modules/x-pack-ml/platform/linux-x86_64/bin/controller

key 运行进程的关键字 (如:ps -ef | grep tomcat)

UID 启动进程的用户名

PID 进程pid

PPID

C

STIME 开始启动时间

TTY 终端号

TIME 运行时间

CMD 启动进程的命令

-o 格式输出

1
❯ ps -eo pid,lstart,etime,user,cmd | grep mysql

md语法

/hexo/_config.yml

1
permalink: :title//

站内文章链接

绝对路径

/_posts

1
2
3
4
5
6
7
8
9
10
11
$ tree -L 2 ./_posts/
./_posts/
├── linux
│   ├── debian
│   ├── k8s
│   └── shell
├── markdown
│   ├── flow.md
│   ├── formula.md
│   └── mdgrammar.md

1
[点击查看md写flow文章](/markdown/flow)

点击查看md写flow文章

[] 自定义链接标题

()绝对地址,permalink的值

post_link

1
{% post_link tool/text/markdown/flow/ '点击查看md写flow文章' %}
点击查看md写flow文章

post_link 相对路径 ‘标题’

跳转

页内跳转指定位置

锚点链接

1
[跳到本页的开头](#id-sample)

跳到开头

其他页面跳转到指定位置

锚点链接

1
[跳到其他页指定位置](permalink的值#id-sample)

设置锚点

1
锚点<p id="id-sample" hidden/>

git命令

remote

1
2
3
4
5
6
7
❯ git remote -v
origin https://gitlab.ui.k8s.cn/sre/test.git (fetch)
origin https://gitlab.ui.k8s.cn/sre/test.git (push)
#添加
❯git remote add origin ssh://git@gitlab.ui.k8s.cn:2224/sre/test.git
#移除
❯ git remote remove origin

checkout

单个文件回滚

1
2
3
4
5
6
7
8
#获取版本commit SHA-1 标识符前8位
git log

#回滚到指定版本
git checkout 0ebdd2639e8 _config.yml

#撤消此更改并还原文件的最新版
git checkout HEAD index.html

如果有其他分支,不会clone到本地

1
2
3
4
5
git branch -a

git checkout -b src origin/src

git pull origin src

log

查看提交历史,其中包含每个提交的详细信息,包括提交消息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
❯ git log -n2
commit cb2c4d369dc59d0cb93d3042cf17e309da849a6b (HEAD -> main)
Author: cs <cs876321722@outlook.com>
Date: Tue Feb 13 14:01:52 2024 +0800

up main

commit cda0cdddd2de6b03346a12fe477a076ebfeb068e
Author: cs <cs876321722@outlook.com>
Date: Tue Feb 13 11:53:44 2024 +0800

up ci.yml
❯ git log --format="%h %s" -n2
cb2c4d3 up main
cda0cdd up ci.yml

%h: 提交的缩短哈希值。
%H: 提交的完整哈希值。
%s: 提交消息的主题(第一行)。
%b: 提交消息的正文部分(除去主题部分)。
%an: 作者的名称。
%ae: 作者的电子邮件地址。
%ad: 作者日期(默认格式)。
%ar: 相对日期(例如,“2 weeks ago”)。
%cn: 提交者的名称。
%ce: 提交者的电子邮件地址。
%cd: 提交日期(默认格式)。
%cr: 相对日期(例如,“2 weeks ago”)。

rebase

git rebase -i [startpoint] [endpoint]指定了一个编辑区间,如果不指定[endpoint],则该区间的终点默认是当前分支HEAD所指向的commit(注:该区间指定的是一个前开后闭的区间)。

1
git rebase -i HEAD~3

这里的 HEAD~3 表示合并最近三次的提交修改

将第3行的 pick 改为 s, “s” 为 “squash” 的缩写,“squash” 的意思是将这个提交压缩为最后一次提交:wq

如果是个人分支 git rebase -i 最后一次commitID, s屏蔽其他,只保留一个

当出现Successfully rebased and updated refs/heads/xxx.表示合并成功了

merge

合并分支(开发分支dev合并到主分支master)

1、首先切换到master分支上
git checkout master
2、确保master代码是最新的代码
git pull origin master
3、然后我们把dev分支的代码合并到master上
git merge dev
4、然后查看状态及执行提交命令
git status

cached

文件从 Git 跟踪中删除,但将其保留在文件系统

1
git rm --cached <file>

git rm #将文件从 Git 仓库和文件系统中完全删除

show

1
2
3
4
5
#查看已添加到 Git 索引的文件内容
git show :_config.yml

# <commit> 是要查看的提交的 SHA-1 标识符
git show <commit>:<path>

pull

稀疏检出sparse checkout

载入天数...载入时分秒... ,