0%

pgrep/pkill 检索终止当前正在运行的程序

鉴于用man pgrepman pkill的时候出来的同一个释义,所以要一次说两个命令了。

Linux pgreppkill 命令根据名称和其他属性来查找或发送处理的信号。

官方定义为:

pgrep, pkill - look up or signal processes based on name and other attributes

pgrep将查找当前运行的进程中满足条件的并打印到stdout中。

语法

语法如下所示:

1
2
$ pgrep [options] pattern
$ pkill [options] pattern

常用的参数为:

  • -u 选择仅匹配指定有效用户ID进程
  • -I 列出进程名及进程ID
  • -a 列出进程的详细命令行

默认无参数

默认情况下,仅仅列出包含关键词的进程ID。

1
2
3
4
5
6
7
8
9
$ pgrep ssh
3073
3833
4475
5786
5955
11301
13654
...

pkill刚好相反,直接发送终止信号(默认为SIGTERM)给这些进程。

指定用户

可以通过-u来指定用户

1
2
3
4
5
$ pgrep ssh -u username
4475
22084
27695
...

列出进程名

仅仅看到ID是崩溃的,因为不知道具体的进程,可以通过-l来查看进程名

1
2
3
4
5
6
7
8
$ pgrep ssh -l
3073 sshd
3833 ssh-agent
4475 ssh-agent
5786 ssh-agent
5955 sshd
...

更详细的进程信息

或许知道的进程名,还不足以了解具体信息,此时-a选项就爬上用场了。

1
2
3
4
5
6
$ pgrep ssh -a
3073 /usr/sbin/sshd -D
3833 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
5955 sshd: /usr/sbin/sshd -D -f /assets/sshd_config -e [listener] 0 of 100-200 startups
...

pkill 终止当前正在运行的程序

参考 Linux pgrep 命令。

Linux CentOS下查看. 更新. 删除yum安装包

查看CentOS下安装了哪些yum软件包,查看指定包是否有安装,查看已安装包详细说明信息. 更新软件包. 删除软件包等常用操作

  1. 查找指定软件包
1
$ yum search softwate_package_name
  1. 列出所有可安装的软件包
1
$ yum list
  1. 列出所有可更新的软件包
1
$ yum list updates
  1. 列出所有已安装的软件包
1
$ yum list installed
  1. 列出所有已安装但不在Yum Repository软件包资源库内的软件包
1
$ yum list extras
  1. 列出指定的软件包安装信息
1
$ yum list software_package_name
  1. 查看软件包说明信息
1
$ yum info software_package_name
  1. 查看所有软件包说明信息

这个太没有意义了也,就算列出来也是懒得看,实在太多了

1
$ yum info
  1. 更新软件包
1
$ yum update software_package_name
  1. 更新系统
1
$ yum update
  1. 卸载软件包
1
$ yum remove software_package_name

关于yum警告“警告:RPM 数据库已被非 yum 程序修改

这个警告主要因为对一些软件的操作,没有使用yum,比如直接rpm卸载造成的。

至于上面的警告的问题,不必太过惊慌。

主要因为yum的新特征是要成为系统中用户对程序进行管理的接口,这要求yum知道系统中所有的对软件包的操作(yum history)。如果你会用到但不仅只用到yum的话,又不喜欢看到这个警告,你可以去“yum.conf”里把“history_record”设置为“false”。

参考

https://www.cnblogs.com/HermitCarb/p/4759413.html

ubuntu10.4到2016年早已停止了更新支持,ubuntu也不再维护了。官方源以及第三方源包括163,sohu等也不再维护。那是不是意味着这个版本的ubuntu只能放弃使用?

当然不是的!!!

为了解决这个问题,ubuntu提供了old-release的方案,通过命令行更新源如下:

1
sudo gedit /etc/apt/sources.list

打开源列表文件,把里面的地址全删除,然后换上如下的地址,如果你是其他版本的,把lucid替换即可。

1
2
3
4
5
6
7
8
9
10
deb http://old-releases.ubuntu.com/ubuntu lucid main restricted universe multiverse   
deb http://old-releases.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu lucid main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse

然后再运行

1
sudo apt-get update

Enjoy.

for 循环及指定范围语法

1
2
3
4
5
6
7
167> for i in 0...5 { print (i) }
0
1
2
3
4
5

游乐场

对于REPL,测试简单的代码是绰绰有余的,但是对于比较复杂一点的就需要使用Xcode的新特性游乐场了playground。

数组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
93> let color = ["red","orange","yellow","green"]
color: [String] = 4 values {
[0] = "red"
[1] = "orange"
[2] = "yellow"
[3] = "green"
}
94> color[0]
$R36: String = "red"
95> color[1]
$R37: String = "orange"
96> color[2]
$R38: String = "yellow"
97> color[3]
$R39: String = "green"

字典

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
126> var dict = ["name":"hello", "age":"10", "sex":"Female"]
dict: [String : String] = 3 key/value pairs {
[0] = {
key = "name"
value = "hello"
}
[1] = {
key = "age"
value = "10"
}
[2] = {
key = "sex"
value = "Female"
}
}

数组的数组

1
var array [String : [String]]

创建空数组

1
2
3
4
142> var empty_array : Array<Int> = []
empty_array: [Int] = 0 values
143> var empty_array = [Int]()
empty_array: [Int] = 0 values

创建空字典

1
2
151> var empty_dictionary = Dictionary<String,Double>()
empty_dictionary: [String : Double] = 0 key/value pairs

REPL

执行下面的命令可以进入Swift的交互终端。

1
2
3
4
$ xcrun swift

Welcome to Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42). Type :help for assistance.
1>

然后可以输入:help打印帮助信息,:quit来退出交互环境。

常量 与 变量

1
2
let x = 12 // 常量
var y = 12.3 // 常量

类型

类型 特征
Bool true或者false
Int/Int32/Int64 32/64位整数
Int8/Int16 8/16位整数
UInt/UInt32/UInt64 32/64位正整数
UInt8/UInt16 8/16位正整数
Float/Double 可正可负的浮点数
Character 用双引号括起的单个字符、数字或者其他符号
String 用双括号括起的一系列字符

检查上限和下限

1
2
3
4
5
6
15> Int8.max
$R3: Int8 = 127
16> Int16.max
$R4: Int16 = 32767
17> UInt8.max
$R5: UInt8 = 255

显式地声明类型

1
2
22> var number : Double = 3
number: Double = 3

数值表示

各种进制

1
2
3
4
5
48> let b = 0b110 // 二进制
b: Int = 6
49> let b = 0o11 // 八进制
b: Int = 9
50> let b = 0x11 // 十六进制

大数字表示法

1
2
53> let big = 1_000_000_000
big: Int = 1000000000

轻松显示

1
2
3
4
5
6
7
8
9
10
59> let city = "shanghai"
city: String = "shanghai"
60> let food = "noodle"
food: String = "noodle"
61> let restaurant = "KFC"
restaurant: String = "KFC"
62> let year = 5
year: Int = 5
63> print ("When I visited \(city) \(year) years ago, I went to \(restaurant) and ordered \(food)")
When I visited shanghai 5 years ago, I went to KFC and ordered noodle

使用类型别名

1
2
3
4
5
6
72> typealias EightBits = UInt8
73> var reg : EightBits = 0
reg: EightBits = 0
74> typealias NewBits = UInt8
75> var reg : NewBits = 0
reg: NewBits = 0

元祖

1
2
3
4
5
6
7
8
9
10
11
12
79> let car = (2014,"Mercedes-Benz","S-Class")
car: (Int, String, String) = {
0 = 2014
1 = "Mercedes-Benz"
2 = "S-Class"
}
80> car.0
$R28: Int = 2014
81> car.1
$R29: String = "Mercedes-Benz"
82> car.2
$R30: String = "S-Class"

可选类型

在swift显示的类型说明中,有一个问号,可以表明变量的类型是可选类型。

1
2
3
4
5
6
7
8
83> var s="123"
s: String = "123"
84> Int(s)
$R31: Int? = 123
85> var s="abc"
s: String = "abc"
86> Int(s)
$R32: Int? = nil

MacOSX 如何安装hexo

安装Node.js环境

因为Hexo是基于Node.js环境的,所以我们需要安装Node.js.

下载和安装Node.js

命令行安装

1
2
3
brew install npm
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm install stable

部署且安装Hexo博客

安装Hexo

1
2
3
4
5
6
7
8
9
10
11
12
npm install -g hexo-cli
npm install hexo-generator-index --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-server --save # server独立出来了,需要单独安装
npm install hexo-deployer-git --save
npm install hexo-generator-search --save
npm install hexo-renderer-marked@0.2 --save
npm install hexo-renderer-stylus@0.2 --save
npm install hexo-generator-feed@1 --save
npm install hexo-generator-sitemap@1 --save

这里采用npm方式来部署hexo静态博客。

部署文件夹

这里我们可以先建立一个文件夹,用来安装hexo

1
2
mkdir hexo
cd hexo

初始化Hexo

1
hexo init

生成静态页面

1
hexo generate

本地预览

1
hexo server

此时就可以打开浏览器输入http://localhost:4000来预览了。

网络配置的大拿 ip

Linux ip 命令与 ifconfig 命令类似,但比 ifconfig 命令更加强大,主要用于显示或设置网络设备。

已经在Linux 2.2 加入到了内核。所以ip是加强版的网络配置工具,用来替代ifconfig并强化其他功能。

官方定义为:

ip - show / manipulate routing, devices, policy routing and tunnels

对于这个命令,命令集是相当的多。先说一些基础的,其他就要自己摸索了。

使用方法为:

1
2
3
4
5
6
7
8
9
$ ip [ OPTIONS ] OBJECT { COMMAND | help }

$ ip [ -force ] -batch filename

# OBJECT的取值
# OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | tcp_metrics | token | macsec }

# OPTIONS的取值
# OPTIONS := { -V[ersion] | -h[uman-readable] | -s[tatistics] | -d[etails] | -r[esolve] | -iec | -f[amily] { inet | inet6 | ipx | dnet | link } | -4 | -6 | -I | -D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -o[neline] | -rc[vbuf] [size] | -t[imestamp] | -ts[hort] | -n[etns] name | -a[ll] | -c[olor] }

COMMAND的值主要取决于OBJECT,可能有所不同,一般可以使用adddeleteshow(或者list),均可以输入help来进行查询。

OBJECT中常用的为:

  • link 网络设备
  • address 设备上的协议地址
  • -s, -stats, -statistics 统计化输出

显示网络设备

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
# 显示网络设备
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 9000 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

# 显示IP等更多信息
$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 192.168.1.123/24 brd 192.168.254.255 scope global noprefixroute eno1
valid_lft forever preferred_lft forever
inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/64 scope global noprefixroute
valid_lft forever preferred_lft forever
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 9000 qdisc mq state DOWN group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

命令中的show为默认,也可以直接使用ip link或者ip address,结果一致。

设置IP地址

可以通过ip addr add/del xxx.xxx.xxx.xxx dev interface 来设置或者删除IP地址。

如下设置or删除eth0的IP地址。

1
2
3
4
5
# 设置IP地址
$ ip addr add 192.168.0.1/24 dev eth0

# 删除IP地址
$ ip addr del 192.168.0.1/24 dev eth0

启动关闭网卡

与ifconfig类似,也使用up与down来进行启动和关闭,具体如下:

1
2
3
4
5
# 开启网卡
$ ip link set eth0 up

# 关闭网卡
$ ip link set eth0 down

统计方便阅读

选项-s可以统计一些信息方便我们阅读,如下看看网络的情况:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
871883256468 251700492 0 0 0 0
TX: bytes packets errors dropped carrier collsns
871883256468 251700492 0 0 0 0
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
64930085920632 50955323447 0 613156 0 472190933
TX: bytes packets errors dropped carrier collsns
17534345850354 17448077191 0 0 0 0
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 9000 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

可以看到对输出进行了一些格式化,看起来更直观。

Linux ip命令

Linux ip 命令与 ifconfig 命令类似,但比 ifconfig 命令更加强大,主要用于显示或设置网络设备。

已经在Linux 2.2 加入到了内核。所以ip是加强版的网络配置工具,用来替代ifconfig并强化其他功能。

官方定义为:

ip - show / manipulate routing, devices, policy routing and tunnels

对于这个命令,命令集是相当的多。先说一些基础的,其他就要自己摸索了。

使用方法为:

1
2
3
4
5
6
7
8
9
$ ip [ OPTIONS ] OBJECT { COMMAND | help }

$ ip [ -force ] -batch filename

# OBJECT的取值
# OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | tcp_metrics | token | macsec }

# OPTIONS的取值
# OPTIONS := { -V[ersion] | -h[uman-readable] | -s[tatistics] | -d[etails] | -r[esolve] | -iec | -f[amily] { inet | inet6 | ipx | dnet | link } | -4 | -6 | -I | -D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -o[neline] | -rc[vbuf] [size] | -t[imestamp] | -ts[hort] | -n[etns] name | -a[ll] | -c[olor] }

COMMAND的值主要取决于OBJECT,可能有所不同,一般可以使用adddeleteshow(或者list),均可以输入help来进行查询。

OBJECT中常用的为:

  • link 网络设备
  • address 设备上的协议地址
  • -s, -stats, -statistics 统计化输出

显示网络设备

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
# 显示网络设备
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 9000 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

# 显示IP等更多信息
$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 192.168.1.123/24 brd 192.168.254.255 scope global noprefixroute eno1
valid_lft forever preferred_lft forever
inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/64 scope global noprefixroute
valid_lft forever preferred_lft forever
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 9000 qdisc mq state DOWN group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

命令中的show为默认,也可以直接使用ip link或者ip address,结果一致。

设置IP地址

可以通过ip addr add/del xxx.xxx.xxx.xxx dev interface 来设置或者删除IP地址。

如下设置or删除eth0的IP地址。

1
2
3
4
5
# 设置IP地址
$ ip addr add 192.168.0.1/24 dev eth0

# 删除IP地址
$ ip addr del 192.168.0.1/24 dev eth0

启动关闭网卡

与ifconfig类似,也使用up与down来进行启动和关闭,具体如下:

1
2
3
4
5
# 开启网卡
$ ip link set eth0 up

# 关闭网卡
$ ip link set eth0 down

统计方便阅读

选项-s可以统计一些信息方便我们阅读,如下看看网络的情况:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
871883256468 251700492 0 0 0 0
TX: bytes packets errors dropped carrier collsns
871883256468 251700492 0 0 0 0
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
64930085920632 50955323447 0 613156 0 472190933
TX: bytes packets errors dropped carrier collsns
17534345850354 17448077191 0 0 0 0
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 9000 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

可以看到对输出进行了一些格式化,看起来更直观。

#TODO

OBJECT 取值含义如下:

  • addrlabel:协议地址选择的标签配置
  • route:路由表条目
  • rule:路由策略数据库中的规则

OPTIONS 为常用选项,值可以是以下几种:

实例

1
2
3
4
5
6
7
8
9
10
11
12
13
ip link set eth0 promisc on      # 开启网卡的混合模式
ip link set eth0 promisc offi # 关闭网卡的混个模式
ip link set eth0 txqueuelen 1200 # 设置网卡队列长度
ip link set eth0 mtu 1400 # 设置网卡最大传输单元

ip route show # 显示系统路由
ip route add default via 192.168.1.254 # 设置系统默认路由
ip route list # 查看路由信息
ip route add 192.168.4.0/24 via 192.168.0.254 dev eth0 # 设置192.168.4.0网段的网关为192.168.0.254,数据走eth0接口
ip route add default via 192.168.0.254 dev eth0 # 设置默认网关为192.168.0.254
ip route del 192.168.4.0/24 # 删除192.168.4.0网段的网关
ip route del default # 删除默认路由
ip route delete 192.168.1.0/24 dev eth0 # 删除路由

用 ip 命令显示网络设备的运行状态:

1
2
3
4
5
6
7
[root@localhost ~]# ip link list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff

显示核心路由表:

1
2
3
4
5
6
7
[root@localhost ~]# ip route list 
112.124.12.0/22 dev eth1 proto kernel scope link src 112.124.15.130
10.160.0.0/20 dev eth0 proto kernel scope link src 10.160.7.81
192.168.0.0/16 via 10.160.15.247 dev eth0
172.16.0.0/12 via 10.160.15.247 dev eth0
10.0.0.0/8 via 10.160.15.247 dev eth0
default via 112.124.15.247 dev eth1

显示邻居表:

1
2
3
[root@localhost ~]# ip neigh list
112.124.15.247 dev eth1 lladdr 00:00:0c:9f:f3:88 REACHABLE
10.160.15.247 dev eth0 lladdr 00:00:0c:9f:f2:c0 STALE

获取主机所有网络接口炫技

1
ip link | grep -E '^[0-9]' | awk -F: '{print $2}'
   -h, -human, -human-readable
          output statistics with human readable values followed by suffix.

   -b, -batch <FILENAME>
          Read commands from provided file or standard input and invoke them.  First failure will cause termination of ip.

   -force Don't terminate ip on errors in batch mode.  If there were any errors during execution of the commands, the application return code will be non zero.




-d, -details
Output more detailed information.

   -l, -loops <COUNT>
          Specify maximum number of loops the 'ip address flush' logic will attempt before giving up. The default is 10.  Zero (0) means loop until all addresses are
          removed.

   -f, -family <FAMILY>
          Specifies the protocol family to use. The protocol family identifier can be one of inet, inet6, bridge, ipx, dnet, mpls or link.  If this option is not present,
          the protocol family is guessed from other arguments. If the rest of the command line does not give enough information to guess the family, ip falls back to the
          default one, usually inet or any.  link is a special family identifier meaning that no networking protocol is involved.


​ -o, -oneline
​ output each record on a single line, replacing line feeds with the ‘' character. This is convenient when you want to count records with wc(1) or to grep(1) the
​ output.

-r, -resolve use the system’s name resolver to print DNS names instead of host addresses.


​ -n, -netns
​ switches ip to the specified network namespace NETNS. Actually it just simplifies executing of:

ip netns exec NETNS ip [ OPTIONS ] OBJECT { COMMAND | help }

              to

              ip -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help }

       -a, -all
              executes specified command over all objects, it depends if command supports this option.

       -c, -color
              Use color output.

       -t, -timestamp
              display current time when using monitor option.

       -ts, -tshort
              Like -timestamp, but use shorter format.

       -rc, -rcvbuf<SIZE>
              Set the netlink socket receive buffer size, defaults to 1MB.

       -iec   print human readable rates in IEC units (e.g. 1Ki = 1024).

IP - COMMAND SYNTAX
   OBJECT

       addrlabel
              - label configuration for protocol address selection.

       l2tp   - tunnel ethernet over IP (L2TPv3).

       maddress
              - multicast address.

       monitor
              - watch for netlink messages.

       mroute - multicast routing cache entry.

       mrule  - rule in multicast routing policy database.

       neighbour
              - manage ARP or NDISC cache entries.

       netns  - manage network namespaces.

       ntable - manage the neighbor cache's operation.


​ route - routing table entry.

rule - rule in routing policy database.

   tcp_metrics/tcpmetrics
          - manage TCP Metrics

   token  - manage tokenized interface identifiers.

   tunnel - tunnel over IP.

   tuntap - manage TUN/TAP devices.

   xfrm   - manage IPSec policies.

   The names of all objects may be written in full or abbreviated form, for example address can be abbreviated as addr or just a.