# Clone the current repository git clone https://github.com/xianyi/OpenBLAS
# Compile and install # macOS MacPorts users may not use USE_OPENMP=1 option, and need to omit it. cd OpenBLAS make USE_OPENMP=1 CC=gcc FC=gfortran make PREFIX="~/local" install
# (compile flags for use with GCC are as in linux makefile) CFLAGS +=
# If you're getting warning messages of the form: # ld: warning: object file (lib-static/libfinufft.a(finufft1d.o)) was built for # newer OSX version (10.13) than being linked (10.9) # Then you can uncomment the following two lines with the older version number # (in this example -mmacosx-version-min=10.9) # #CFLAGS += "-mmacosx-version-min=<OLDER OSX VERSION NUMBER>"
# if you are macOS homebrew users, uncomment this. # (assuming that /usr/local is your homebrew's PREFIX) #CFLAGS += -I src -I/usr/local/include #LIBS += -L/usr/local/lib
# if you are macOS MacPorts users, uncomment this. # (assuming that /opt/local is your MacPorts' PREFIX) #CFLAGS += -I src -I/opt/local/include #LIBS += -L/opt/local/lib
# You can keep them FFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS) -DNEED_EXTERN_C
# OpenMP with GCC on OSX needs following... OMPFLAGS = -fopenmp OMPLIBS = -lgomp # since fftw3_omp doesn't work in OSX, you need to uncomment this #FFTWOMPSUFFIX=threads
开始编译库
1
$ make lib
新建finufft.pc文件,内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13
# This is an example pkg-config file. Here is an brief instruction. # (1) Please change finufftdir depending on your install directory. # (2) please change its filename to finufft.sample.pc and # copy to a directory specified in $PKG_CONFIG_PATH finufftdir=$(HOME)/local/finufft libdir=${finufftdir}/lib-static includedir=${finufftdir}/include
Name: FINUFFT Description: Flatiron Institute Nonuniform Fast Fourier Transform libraries Version: github Libs: -L${libdir} -lfinufft Cflags: -I${includedir}
TTL=52:TTL是Time To Live的缩写,表示DNS记录在DNS服务器上存在的时间,是IP协议包的一个值,告诉路由器啥时候抛弃这个数据包,(大体上可以通过这个值来判断目标类型的操作系统。)
发送指定数目
可以通过 参数-c 来发送指定数目的包后停止
1 2 3 4 5 6 7 8 9 10 11
$ ping www.baidu.com -c 5 PING www.a.shifen.com (115.239.211.112) 56(84) bytes of data. 64 bytes from 115.239.211.112: icmp_seq=1 ttl=52 time=6.03 ms 64 bytes from 115.239.211.112: icmp_seq=2 ttl=52 time=5.96 ms 64 bytes from 115.239.211.112: icmp_seq=3 ttl=52 time=5.79 ms 64 bytes from 115.239.211.112: icmp_seq=4 ttl=52 time=5.79 ms 64 bytes from 115.239.211.112: icmp_seq=5 ttl=52 time=6.21 ms
--- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4007ms rtt min/avg/max/mdev = 5.791/5.958/6.215/0.186 ms
此时将在发送5次数据包以后自动停止,在Linux里面,如果不加这个参数,是会一直发送运行的。
设定发送时间间隔
可以通过 参数 -i N指定每个N秒发送一次信息,如下将每隔3秒发送一次ping信息。
1 2 3 4 5 6 7 8 9 10 11 12
$ ping www.baidu.com -i 3 PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data. 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=55 time=28.6 ms 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=55 time=28.6 ms 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=55 time=28.6 ms 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=55 time=28.6 ms 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=5 ttl=55 time=28.6 ms 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=6 ttl=55 time=28.6 ms ^C --- www.a.shifen.com ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 15041ms rtt min/avg/max/mdev = 28.650/28.670/28.697/0.139 ms
如上,每隔3秒会发送一次,对于需要持续检测或者记录的可以考虑适当加大这个时间间隔。
注意,只有管理员可以设置小于0.2秒的时间间隔。所以这个数值可以是浮点数~
组合使用
上面的几个例子是可以配合使用的,比如
1 2 3 4 5 6 7 8 9 10 11
$ ping www.baidu.com -c 4 -i 5 PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data. 64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=55 time=29.4 ms 64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=2 ttl=55 time=29.3 ms 64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=3 ttl=55 time=29.4 ms 64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=4 ttl=55 time=29.4 ms
--- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 20045ms rtt min/avg/max/mdev = 29.396/29.428/29.461/0.110 ms
这个例子为:每个5秒查询一次,一共查询4次,然后退出。
Linux ip命令
Linux ip 命令与 ifconfig 命令类似,但比 ifconfig 命令更加强大,主要用于显示或设置网络设备。
# 显示网络设备 $ 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地址。
/* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "whoami"
#define AUTHORS proper_name ("Richard Mlynarik")
void usage(int status) { if (status != EXIT_SUCCESS) emit_try_help (); else { printf (_("Usage: %s [OPTION]...\n"), program_name); fputs (_("\ Print the user name associated with the current effective user ID.\n\ Same as id -un.\n\ \n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); emit_ancillary_info (PROGRAM_NAME); } exit (status); }
w - Show who is logged on and what they are doing.
用法为:
1
$ w [options] user [...]
常用的两个选项为:
-h 不显示各栏位的标题信息列。
-s 简洁格式列表,不显示用户登入时间,JCPU或者PCPU的时间
默认的显示
显示当前用户的登录信息及执行的命令
1 2 3 4 5 6 7 8 9
$ w 16:29:03 up 26 days, 2:49, 6 users, load average: 1.00, 0.97, 0.96 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT user pts/4 :1 07Sep21 20days 9:59 1:53m bash user pts/0 :2 08Sep21 6days 0.70s 1:53m zsh user pts/1 :3 08Sep21 20days 1:13m 1:53m bash user :0 :0 15Sep21 6days 27days 21.36s zsh user pts/2 :0 15Sep21 14days 0.25s 0.25s zsh user pts/3 :3 16Sep21 24:45m 0.22s 0.22s bash
不显示标题行
1 2 3 4 5 6 7 8 9
$ w -h 16:29:16 up 26 days, 2:49, 6 users, load average: 1.20, 0.67, 0.76 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT user pts/4 :1 07Sep21 20days 9:59 1:53m bash user pts/0 :2 08Sep21 6days 0.70s 1:53m zsh user pts/1 :3 08Sep21 20days 1:13m 1:53m bash user :0 :0 15Sep21 6days 27days 21.36s zsh user pts/2 :0 15Sep21 14days 0.25s 0.25s zsh user pts/3 :3 16Sep21 24:45m 0.22s 0.22s bash
简洁模式显示
1 2 3 4 5 6 7 8 9
$ w -s 16:29:26 up 26 days, 2:49, 6 users, load average: 1.50, 0.67, 0.36 USER TTY FROM IDLE WHAT user pts/4 :1 20days bash user pts/0 :2 6days zsh user pts/1 :3 20days bash user :0 :0 6days zsh user pts/2 :0 14days zsh user pts/3 :3 24:45m bash
$ ls -l total 310M -rw-rw-r-- 1 user user 10M Mar 21 20:01 a drwxrwxr-x 2 user user 22 Mar 21 20:01 aa -rw-rw-r-- 1 user user 100M Mar 21 20:01 b -rw-rw-r-- 1 user user 200M Mar 21 20:01 c
$ ls -l total 310M -rw-rw-r-- 1 user user 10M Mar 21 20:01 a drwxrwxr-x 2 user user 22 Mar 21 20:01 aa -rw-rw-r-- 1 user user 100M Mar 21 20:01 b -rw-rw-r-- 1 user user 200M Mar 21 20:01 c
DESCRIPTION List information about the FILEs (the current directoryby default). Sort entries alphabetically ifnoneof -cftuvSUX nor --sort is specified.
Mandatory arguments tolong options are mandatory forshort options too.
-a, --all donot ignore entries starting with .
-A, --almost-all donot list implied . and ..
--author with -l, print the author ofeachfile
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of1,048,576 bytes; see SIZE format below
-B, --ignore-backups Manual page ls(1) line1 (press h for help or q to quit)
此时可以通过空格键或者回车键来向后翻屏或者翻页,可以使用b或者k向前查看。
查看关键词时可以使用:
/关键词 向后查找 n:下一个
?关键词 向前查找 N:前一个
可以通过q来退出。
ls后面还有一个(1),详细的解释可以参考《Linux 安装 man 帮助程序》
类似于whatis命令
man有个参数为-f,就是whatis的功能,比如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ man -f lscd file cat more less ls (1) - list directory contents ls (1p) - list directory contents cd (1) - bash built-in commands, see bash(1) cd (1p) - change the working directory cd (n) - Change working directory file (1) - determine file type file (1p) - determine file type file (n) - Manipulate file names and attributes cat (1) - concatenate files and print on the standard output cat (1p) - concatenate and print files more (1) - file perusal filter for crt viewing more (1p) - display files on a page-by-page basis less (1) - opposite of more less (3pm) - perl pragma to request less of something
与whatis命令完全一致
类似于apropos命令
man有个参数为-k,就是apropos的功能,比如:
1 2 3 4 5 6 7 8 9 10 11
$ man -k who at.allow (5) - determine who can submit jobs via at or batch at.deny (5) - determine who can submit jobs via at or batch btrfs-filesystem (8) - command group of btrfs that usually work on the whole filesystem docker-trust-signer (1) - Manage entities who can sign Docker images ipsec_newhostkey (8) - generate a new raw RSA authentication key for a host ipsec_showhostkey (8) - show host's authentication key w (1) - Show who is logged on and what they are doing. who (1) - show who is logged on who (1p) - display who is on the system whoami (1) - print effective userid
$ whatis lscd file cat more less ls (1) - list directory contents ls (1p) - list directory contents cd (1) - bash built-in commands, see bash(1) cd (1p) - change the working directory cd (n) - Change working directory file (1) - determine file type file (1p) - determine file type file (n) - Manipulate file names and attributes cat (1) - concatenate files and print on the standard output cat (1p) - concatenate and print files more (1) - file perusal filter for crt viewing more (1p) - display files on a page-by-page basis less (1) - opposite of more less (3pm) - perl pragma to request less of something
bno_plot (1) – generate interactive 3D plot of IO blocks and sizes gnuplot (1) – an interactive plotting program pbmtoplot (1) – convert a PBM image into a Unix 'plot' file
或许每个人的输出不同,这个主要取决于安装的软件包和索引的数据库。以上。
再来一个实例,这个应该大部分的都类似:
1 2 3 4 5 6 7 8 9 10 11 12
$ apropos who
at.allow (5) - determine who can submit jobs via at or batch at.deny (5) - determine who can submit jobs via at or batch btrfs-filesystem (8) - command group of btrfs that usually work on the whole filesystem docker-trust-signer (1) - Manage entities who can sign Docker images ipsec_newhostkey (8) - generate a new raw RSA authentication key for a host ipsec_showhostkey (8) - show host's authentication key w (1) - Show who is logged on and what they are doing. who (1) - show who is logged on who (1p) - display who is on the system whoami (1) - print effective userid