kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

ctags使用

1
--exclude[=pattern] :将模式pattern指定的文件/文件夹添加到排除列表中。可使用任意次。

https://blog.csdn.net/foreverling/article/details/80329586

1 查看ctags支持的语言

1
ctags --list-languages

2 查看语言和扩展名的对应关系

1
ctags --list-maps

3 查看ctags可以识别和记录的语法元素

1
ctags --list-kinds

单独查看可以识别的C++的语法元素:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[chuxing@hostname ~]$ ctags --list-kinds=c++
c  classes
d  macro definitions
e  enumerators (values inside an enumeration)
f  function definitions
g  enumeration names
l  local variables [off]
m  class, struct, and union members
n  namespaces
p  function prototypes [off]
s  structure names
t  typedefs
u  union names
v  variable definitions
x  external and forward variable declarations [off]

4 对当前目录下所有ctags支持的语言格式文件生成tags

1
ctags -R *

缺点很明显,tags会非常大,tags生成会非常慢,而且代码跳转会卡顿。

5 只对特定文件生成tags

1
ctags `find -name "*.h"`

6 使用tags

6.1 tag命令

用于跳转到指定的tag。例如:tag tagname 使用这个命令可以跳转到tagname的定义处,即使它在另一个文件中。

6.2 快捷键Ctrl+] 取出当前光标下的word作为tag的名字并进行跳转。

6.3 tags命令 列出曾经访问过的tag的列表

6.4 快捷键Ctrl+T 跳转到前一次的tag处。

6.5 stag命令 stag tagname 分割当前窗口,并且跳转到指定的tag。

6.6 快捷键Ctrl+W+] 分割当前窗口,并且跳转到光标下的tag。

6.7 同名tag, 如果存在多个同名的tag,tag命令会给出一个tag的列表,可以通过键入tag的序号来选择tag;也可以通过tselect来过滤tag,如::tselect tagname

如果要在多个tag间移动,可以使用如下命令:

1
2
3
4
:tfirst             go to first match
:[count]tprevious   go to [count] previous match
:[count]tnext       go to [count] next match
:tlast              go to last match

如果没有指定[count],默认是1。

7 其他

如果是多个tags文件,可以通过设置tags选项来引入更多的tags文件。例如: :set tags=./tags, ./../tags, ./*/tags

使用tag命令时,可以输入部分tag名,然后使用Tab键进行补全。

git修改commit

http://blog.chinaunix.net/uid-15007890-id-3220876.html

一、修改最后一次 commit

1
git commit --amend

二、修改再之前 commit

1. 查看之前commit

1
git rebase -i master~5 //最后五次

2. 显示结果如下,把准备修改的commit前面的 pick 改为 edit ,并 :wq 保存退出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pick 92b4951 2009-08-08: ×××××××
pick 92b4952 2009-08-07: ×××××××
pick 92b4953 2009-08-06: ×××××××
pick 92b4954 2009-08-05: ×××××××
pick 92b4955 2009-08-04: ×××××××

# Rebase 9ef2b1f..92b495b onto 9ef2b1f
#
# Commands:
#  pick = use commit
#  edit = use commit, but stop for amending //改上面的 pick 为 edit
#  squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

3. 进行修改

1
2
git commit --amend   # 进行修改,完成后 :wq 退出
git rebase --continue # 完成操作