2021-02-19 10:23:09    1115    0    0

相关命令:
执行并放置后台执行 : command &
将后台程序拉回屏幕输出: fg
将当前屏幕执行程序再丢到后台执行:Ctrl Z

执行程序并丢到后台执行 &

  1. [lcf@nut ~]$ acgui&
  2. [1] 14087

把当前后台执行的程序拉回当前屏幕执行 fg

  1. [lcf@nut ~]$ fg
  2. acgui

把已经在当前屏幕执行中的程序丢到后台继续执行 Ctrl Z

  1. [lcf@nut ~]$ fg
  2. acgui
  3. ^Z
  4. [1]+ Stopped acgui
? shell ? ? python ?    2021-01-22 16:17:53    1616    0    0

Shell seq用法

seq --help

  1. Usage: seq [OPTION]... LAST
  2. or: seq [OPTION]... FIRST LAST
  3. or: seq [OPTION]... FIRST INCREMENT LAST
  4. Print numbers from FIRST to LAST, in steps of INCREMENT.
  5. Mandatory arguments to long options are mandatory for short options too.
  6. -f, --format=FORMAT use printf style floating-point FORMAT
  7. -s, --separator=STRING use STRING to separate numbers (default: \n)
  8. -w, --equal-width equalize width by padding with leading zeroes
  9. --help display this help and exit
  10. --version output version information and exit

注意事项

seq 选项[-s " "][-w] FIRST INCREMENT LAST
注意 选项紧跟seq, 位于序列数字FIRST INCREMENT LAST之前,FIRST INCREMENT LAST放在最后
比如

  1. seq -s " " -w 2 100 1000

常用命令

  • 生成一个1 到 10 的序列 ,不指定分隔符s时,默认是换行符。
  1. root@gua-vm1:/vob# seq 10
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7
  9. 8
  10. 9
  11. 10
  • 生成一个1 到 10 的序列 ,指定分隔符为空格 ,在seq 后面加上选项 -s " "
  1. root@gua-vm1:/vob# seq -s " " 10
  2. 1 2 3 4 5 6 7 8 9 10
  • 生成一个3 到 10 的序列 ,只指定头尾时,默认递增量为1
  1. r
? shell ?    2021-01-20 17:03:25    1276    0    0

打印全部列

  1. awk '{print $0}'

打印指定列

  1. awk '{print $2,$4}'

打印指定列并拼接字符串

  1. awk '{print $1,"hhah",$2}'
  2. awk '{print $1"hahah"$2}'

按指定分隔符取列

  1. awk -F: '{ print $1 }'

打印某一列及后面所有列的内容

  1. awk '{out=""; for(i=2;i<=NF;i++){out=out" "$i}; print out}'

打印最后一列,最后一列的前一列,NF表示最后一列的列号

  1. awk '{print $NF, $(NF-1)}'

打印指定一行,NR表示行号

  1. awk 'NR==6 {print $0}'

打印第六行,以 :分隔开的第一列

  1. awk -F ":" 'NR==6 {print $1}'

打印第4行以后的行

  1. git log --pretty=format:"%H-%h:%h" -n 15 |cat -n | awk 'NR>4 {print $0}'
  2. 5 1f021028e22d92119fa5a0821273596e0c37be87-1f02102:1f02102
  3. 6 f36b0ad5a376edf485979b357af4ac1df87cc443-f36b0ad:f36b0ad
  4. 7 e3776955f8f3592051603d2299b93d3b55cbc52a-e377695:e377695
  5. 8 94c50a1fd810d5c1e62535fac8f6db3c01c4c476-94c50a1:94c50a1
  6. git log --pretty=format:"%H-%h:%h" -n 15 |cat -n | awk 'NR<4 {print $0}'
  7. git log --pretty=format:"%H-%h:%h" -n 15 |cat -n | awk 'NR<=4 {print $0}'

条件用法
打印包含 Merge branch 的行 用/strings/

  1. git log --pretty=format:"%
? gitlab ?    2021-01-06 15:19:23    1052    0    0
  1. gitlab web : User Setting --> Access Tokens

API_VERSION:

  1. https://gitlab.casa-systems.com/help/api/v3_to_v4.md
  2. In GitLab 9.0 and later, API V4 is the preferred version to be used.

jq command:

  1. https://stedolan.github.io/jq/manual/#Invokingjq



gitlab api 根据指定组名取组对象

  1. curl --header "PRIVATE-TOKEN: $P_token" $GITLAB_INSTANCE/api/$API_VERSION/groups/${GroupName} 2>/dev/null|jq .

gitlab api 根据指定组名取组里的元素属性

  1. curl --header "PRIVATE-TOKEN: $P_token" $GITLAB_INSTANCE/api/$API_VERSION/groups/${GroupName} 2>/dev/null|jq 'keys'

gitlab api 根据指定组名取组里的第一个project里的属性

  1. curl --header "PRIVATE-TOKEN: $P_token" $GITLAB_INSTANCE/api/$API_VERSION/groups/${GroupName} 2>/dev/null|jq .projects[0]|jq 'keys'

gitlab api 根据指定组名取组的任一key的值

  1. curl --header "PRIVATE-TOKEN: $P_token" $GITLAB_INSTANCE/api/$API_VERSION/groups/${GroupName
2020-11-23 14:23:08    750    0    0

工具 winscp

windows 7 , WinSCP-5.9.3-Portable

  1. winscp> help
  2. call Executes arbitrary remote command
  3. cd Changes remote working directory
  4. checksum Calculates checksum of remote file
  5. chmod Changes permissions of remote file
  6. close Closes session
  7. echo Displays its arguments as message
  8. exit Closes all sessions and terminates the program
  9. get Downloads file from remote directory to local directory
  10. help Displays help
  11. keepuptodate Continuously reflects changes in local directory on remote one
  12. lcd Changes local working directory
  13. lls Lists the contents of local directory
  14. ln Creates remote symbolic link
  15. lpwd Prints local working directory
  16. ls Lists the contents of remote directory
  17. mkdir Creates remote directory
  18. mv Moves or renames remote file
  19. open Connects to server
  20. option Sets or shows value of script options
  21. put Uploads file
2020-10-29 15:52:37    588    0    0

p2top3命令批量转化语法之后,还有一些 版本2和3之间用法的差异需要手动调整:

  1. if
  2. browser 抓取值
  3. 下载链接
? svn ?    2020-09-02 11:00:59    847    0    0
  1. 点击TortoiseSVN 右击菜单的properties

title

  1. 在properties 窗口右下“NEW” 点开,选择others
    title

  2. 在弹出的窗口的property name 项上,选择:tsvn:logtemplate
    title

  3. 保存后,重新commit 一个修改的文件 ,提交窗口会出现刚才设置的log 格式。

2020-09-02 10:04:38    704    1    0

列表本目录所占空间

  1. du -sh ./

列表子目录所占空间

  1. du -sh ./*

列表子目录所占空间达到不足1M的

  1. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[K]"

列表子目录所占空间达到1M 以上

  1. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[M,G]"

列表子目录所占空间达到1G 以上

  1. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[G]"

每个级别的列表再按第一列数值排序

  1. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[K]"| sort -n
  2. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[M]"| sort -n
  3. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[G]"| sort -n

在排了序基础上再取最大10 个

  1. du -sh ./* | grep "^[0-9]\{1,\}.\{0,1\}[0-9]\{1,\}[G]" | sort -n | tail -n 10

2020-08-19 15:45:50    889    0    0
  1. # <file system> <mount point> <type> <options> <dump> <pass>

以下是官方对fstab 里六个字段用法的解释

The first field (fs_spec).

  1. For ordinary mounts, it will hold (a link to) a block special device node (as created by mknod(2)) for the device to be mounted, like /dev/cdrom' or/dev/sdb7'.

  2. LABEL= < label > or UUID= < uuid >
    LABEL=< label> or UUID=< uuid> may be given instead of a device name. This is the recommended method, as device names are often a coincidence of hardware detection order, and can change when other disks are added or removed. For example, LABEL=Boot' orUUID=3e6be9de-8139-11d1-9106-a43f08d823a6'. (Use a filesystem-specific tool like e2label(8), xfs_admin(8), or fatlabel(8) to set LABELs on filesystems).
    第一个字段可以是分区名,或标签名,设备id, 用来标记这一行所表示 的文件系统所在的设备块

  1. root@vm1:/vob/GuaKing/DevOps# cat /etc/fstab
  2. # <file system> <mount point> <type> <options> <dum
? qcow2 ? ? 分区 ?    2020-08-13 15:04:24    1110    1    0

官方参考文档

diskimage-builder code
https://opendev.org/openstack/diskimage-builder

官方分区设置

https://docs.openstack.org/diskimage-builder/latest/user_guide/building_an_image.html

If you wish to customise the top-level block-device-default.yaml file
from one of the block-device-* elements, set the environment variable
DIB_BLOCK_DEVICE_CONFIG. This variable must hold YAML structured
configuration data or be a file:// URL reference to a on-disk
configuration file.


在自己自定义的element 的根目录下,创建一个文件block-device-default.yaml,将分区方案按yaml 文件格式配置其中,如果element 下方有一个block-device-default.yaml,则会优先使用用户定义的分区配置,如果用户无定制,则使用默认配置:
https://opendev.org/openstack/diskimage-builder/src/branch/master/diskimage_builder/elements/block-device-mbr/block-device-default.yaml

或使用变量DIB_BLOCK_DEVICE_CONFIG定义分区配置,将block-device-default.yaml的文本赋值给DIB_BLOCK_DEVICE_CONFIG

https://github.com/GuaKing/qcow2build.git

官方的一个默认配置:

磁盘全部容量分配r

3/12