背景:好久没有摸C了,顺带学一下C语言数组下标的越界是否能访问到东西的问题,是能访问到的,但这些值没有任何意义,可能对于一些黑客有一定意义,但咱不细深入,简单了解一下即可。

cat test.c



#make test  
cc     test.c   -o test


#./test
i[0]===99
i[1]===100
i[2]===101
i[3]===0
i[4]===1559561856
i[5]===32764
*i===99
*(i+1)===100
*(i+2)===101
*(i+3)===0
*(i+4)===1559561856
*(i+5)===32764

*j===99
*(j+1)===100
*(j+2)===101
*(j+3)===0
*(j+4)===1559561856
*(j+5)===32764


===
如果不是整数数组,只是一个定义整数,j=i;是不行的,得:
    int a = 6;
    int *p = &a;

原因是:数组的首地址是指针,而单个整数变量不是指针,上面这个情况得用&取到其地址赋值给指针变量p,如下:
int *p;
p = &a;
背景:运行一个alfred的workflow后(https://www.mac69.com/news/399.html),终端exit;它不退出,不爽,于是找到解决办法了,如下:
解决Mac终端exit退出不爽:

入手Mac后发现各种不爽,比如在终端输入exit命令后,竟然不退出,以下解决:

  ------->终端

    -------->偏好设置

      ------->描述文件

            -------->Shell

              --------->单shell退出时:

                          选择:关闭窗口
————————————————
原文链接:https://blog.csdn.net/u010164190/article/details/60772827


二)mac效率神器alfred热键工作创建流程!用它打开一些应用程序并设置快捷键:
https://www.mac69.com/news/399.html
/usr/local/nginx/conf/vhosts/yum.qr.cntv.net.conf



关闭前:
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/xml
Date: Wed, 18 Sep 2019 02:23:28 GMT
ETag: W/"5d80ad08-bb9" 【】
ip_network: 234.253
Last-Modified: Tue, 17 Sep 2019 09:53:12 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding

关闭后:
http://yum.qr.cntv.net/centos/6/x86_64/repodata/repomd.xml
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/xml
Date: Wed, 18 Sep 2019 02:18:51 GMT
ip_network: 234.254
Last-Modified: Tue, 17 Sep 2019 09:53:12 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding


来自:http://nginx.org/en/docs/http/ngx_http_core_module.html
Syntax:  etag on | off;
Default:  
etag on;
Context:  http, server, location
This directive appeared in version 1.3.3.


二)关闭 if_modified_since off;的方法。
默认是开启的

可以参考两个方案(实践没有成功)

第一在nginx.conf里设置

if_modified_since off|on;
第二在具体的location段里

location ~* \.(?:manifest|appcache|html?|xml|json)$ {
# add_header  Last-Modified $date_gmt;
  # add_header  Last-Modified ""; #不想要就置空
# add_header  Cache-Control "public";
}
PS:$date_gmt是内嵌变量,具体参考ngx_http_ssi_module模块

nginx如果打开了SSI模块,会默认关闭header中的last-modified输出
https://blog.csdn.net/weixin_34168700/article/details/92438695
((3+5)*7-20)/6

div.c  plus.c  sub.c  times.c



./plus 5|./times 7|./sub 20|./div 6
3
6


来自:https://mp.weixin.qq.com/s/0a_T8UKFNiaQueYrUs1TCw
并发与并行是两个既相似而又不相同的概念
并发性,又称共行性,是指能处理多个同时性活动的能力
并行是指同时发生的两个并发事件,具有并发的含义
而并发则不一定并行,也亦是说并发事件之间不一定要同一时刻发生。
并发的实质是一个物理CPU(也可以多个物理CPU) 在若干道程序之间多路复用,并发性是对有限物理资源强制行使多用户共享以提高效率。
并行性指两个或两个以上事件或活动在同一时刻发生。在多道程序环境下,并行性使多个程序同一时刻可在不同CPU上同时执行。
所有的并发处理都有排队等候,唤醒,执行至少三个这样的步骤.所以并发肯定是宏观概念,在微观上他们都是序列被处理的,只不过资源不会在某一个上被阻塞(一般是通过时间片轮转),所以在宏观上看多个几乎同时到达的请求同时在被处理。如果是同一时刻到达的请求也会根据优先级的不同,而先后进入队列排队等候执行。
1、要在桌面上创建新文件夹,请单击桌面并按[shift + cmmand + n]。

2、按下步骤一所示的按钮后,桌面此时会创建个未命名文件夹。如果不小心按多了,创建了多个文件夹,要撤消,请按cmmand + z。


来自:https://zhidao.baidu.com/question/1239552110247618779.html
背景:在CentOS里修改错了,怎么办呢?于是用下面的方法实现了重新还原,再修改,这种情况修改后最后新开终端,否则发现错了再也进不去root后,无法修改,还好有这个办法可行。

通过 pkexec visudo 修改了 /etc/sudoers 文件,文件格式错误,结果无法使用 sudo,无法修改回去了,咋办?

在网上搜索半天,找到一个风骚的解决办法:

假设你是通过 ssh 连接服务器,那就创建两个连接会话。
在第一个会话中,使用这个命令获取进程 PID:
echo $$
在第二个会话中,用下面的命令启动授权代理:
pkttyagent --process [PID]
回到第一个会话,运行命令:
pkexec visudo
再回到第二个会话,输入当前用户的密码。
回到第一个会话,发现已经可以编辑 /etc/sudoers 了!!!
谁能告诉我这里的授权机制是什么?原文链接在这里:
https://askubuntu.com/a/1053617/297291
FreeBSD 上的成功步骤:


来自:https://mp.weixin.qq.com/s?__biz=MzU3NTgyODQ1Nw==&mid=2247486217&idx=1&sn=0bc9d610e69a32f0a8f230a554cd8489&chksm=fd1c738fca6bfa9994751642ed544f5a4db957ee58a816b57c10c3da2d26d5be5e108a27b322&scene=27#wechat_redirect


个人电脑macbook上部署:
source ~/.zshrc
source ~/.config/up/up.sh

/Users/jackXiang/.config/up.sh
对于SNAT这种转换,肯定是跨网段了,怎么个意思呢?
对于家里网想访问公网,肯定会把家里电脑的如:192.168.1.100转为申请的公网出口IP地址。
而对于武哥讲到的:

tcpdump -q -tttt  -nn 'tcp and dst 10.73.234.1** and dst port 8080' -P in -i eth0
参数解释:
-P:指定要抓取的包是流入还是流出的包。可以给定的值为"in"、"out"和"inout",默认为"inout"。

tcpdump -q -tttt  -nn 'tcp and dst 10.10.0.45 and dst port 9500' -P in -i enp0s3
Warning: -P switch is not compatible with the upstream version. You should use -Q instead.
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp0s3, link-type EN10MB (Ethernet), capture size 262144 bytes
2021-07-29 10:00:14.149878 IP 10.10.2.1.37566 > 10.10.0.45.9500: tcp 0
2021-07-29 10:00:14.157827 IP 10.10.2.1.37566 > 10.10.0.45.9500: tcp 0
2021-07-29 10:00:14.158114 IP 10.10.2.1.37566 > 10.10.0.45.9500: tcp 522
2021-07-29 10:00:14.165897 IP 10.10.2.1.37566 > 10.10.0.45.9500: tcp 0

10.10.2.1 指公网XX云VPN虚拟地址。

更多:SLB健康检测的IP和VIP不是同一个IP,且NAT模式VIP下在的机器访问自己的VIP肯定出现1/N的访问不到的情况,于是淘宝采用了FullNat模型,其本质是通过会话查表规避出现源和目的一样的情况。Tcpdump查检测IP方法:https://jackxiang.com/post/10128/

也就是说LVS的浮动IP向内转到里面的Jenkins某一台服务器时,其源IP和LVS浮动IP不一样且有可能是俩IP(主A备B),也就是同一台客户机发起请求,居然有可能是从A过来,也可能是从B过来,此时在Jenkins(10.73.234.180)配置的防火墙上面配置的IP可能只有A,而没有B,那么从B过来的包被拦截后,也就无法通过外包服务器触发里面的这台Jenkins进行部署代码,起码有一半的概率。
同理:对于GitLab里也出现类似问题,探测IP在探测后端机时,也是因为有俩IP,IPtable里面只写了一个,导致探测出现认为后端两机器都活着,在用户作SSH里连接Gitlab(10.73.234.179)时,出现LVS发现后端另一台也活着,Git Client在SSH 时会时而连接另外一台,在另一台日志出现被攻击的提示,且要修改/home/xiangdong/.ssh/known_hosts 的IP地址,因为另一个SNAT的IP过来连接了,会认为不安全,得删掉。



对于同一个SLB下的服务器N台访问自己的VIP,会出现1/N的的概率访问不通的解释:
S-->SLB-->D
16.1.1.1 -> 18.1.1.1->出现在SLB里访问的口当SLB的VIP向自己进行回包时,查路由表时,发现源地址一样,导致SLB不再转包,原因是源的目的地址都一样:
X@eth10 IP 18.1.1.1 > 18.1.1.1: S 4229408411:4229408411(0) win 64240 cmss  #这俩地址一样了于是不再转发,于是发的包没有回收到,于是出现业务上卡住了。



防火墙经过地址转换抓包详解:
https://blog.csdn.net/shiyuqi_blog/article/details/90230186
防火墙DNAT与SNAT详谈:
https://blog.51cto.com/luosea/1686022

R表示收到,X表示发出,R@eth1是从eth1口收到数据包。X@eth2是从2口发出数据包
16.1.1.1>18.1.1.2 表示IP 16.1.1.1发给IP 18.1.1.2
Seq后面的数是序列号 request和reply的号一致就是一个数据包

抓包过程详解:
防火墙eth1口收到16.1.1.1发给18.1.1.2的request数据包
接着从eth2口这个request数据包转发出去
然后防火墙eth2口收到18.1.1.2发给16.1.1.1的reply数据包
防火墙再从eth1口转发这个reply给16.1.1.1
---------------------
作者:一只认真的鱼
来源:CSDN
原文:https://blog.csdn.net/shiyuqi_blog/article/details/90230186
版权声明:本文为博主原创文章,转载请附上博文链接!

Centos7修改grub启动菜单等待时间:
vi /boot/grub2/grub.cfg  #以下实践不如直接修改 vim  /etc/default/grub    GRUB_TIMEOUT=3,grub2-mkconfig -o /boot/grub2/grub.cfg ,下面timeout全是3,是实践了的。

找到并更改启动时间(timeout)


vim /boot/efi/EFI/centos/grub.cfg  #centos8

if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=1
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=2
fi

From:https://www.cnblogs.com/OceanF/p/9837554.html




二、MBR修复:
现象:Reboot and Select proper Boot device or Insert Boot Media in selected Boot device and press a key
两步:1、在磁头上加分区。2、用grub生成MBR和生成grub配置文件。来源参考:https://blog.hostonnet.com/grub-install-warning-this-gpt-partition-label-contains-no-bios-boot-partition-embedding-wont-be-possible
遇到问题分区没有,
怎么在磁盘头部加上分区:
grub-install /dev/sdb Installing for i386-pc platform. grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible. grub-install

再才是进行grub生成MBR和生成grub配置文件:





https://blog.csdn.net/Strive_For_Future/article/details/120821404


显示无错误,使用sync写入磁盘





AQUOS
Reboot and Select proper Boot device
or Insert Boot Media in selected Boot device and press a key

OHOS
bash-4.28 grub2-install --root-directory=unt/sysimage/deu/sda
Installing for 1386-pc platform.
WARNING: Failed to connect to lunetad. Falling back to device scanning.
WARNING: Failed to connect to lunetad. Falling back to device scanning.
WARNING: Failed to connect to lunetad. Falling back to device scanning.
¿grubZ-Install: warning: this GPT partition label contains no BIOS Boot Partition: en
1 grubz-install: error: embedding is not possible, but this is required for BAID and
(bash-4.28 grubz-install/dev/sda
Installing for 1386-pc platfarm.
agrub2-install: warning: this GPT partition label contains no BIOS Bool
GRUB can only de installen
1 bash-4.24 parted
I bash-4.28 parted /dev/sda print
1 Model: ATA ST950042BAS (scsi)
IDisk /dev/sda: 500GB
3 Sector size (logical/physical): 5128/512B
[Partition Table: gpt
(Disk Flags:
1 Number
Start
End
Size
Pile syst
1049kB
211MB
210MB
fat16
211MB
1285MB 107410 sis
1285MB
SABGB
4996B
sible
Mocklists
discouraged..


I bash-4.20 grubZ-Install--root-directory=/unt/sysimage/dev/sda
Installing for 1386-pc platform.
WARNING: Pailed to connect to lumetad. Falling back to device scanning.
WARNING: Palled to connect to lunetad. Palling back to device scanning.
WARNInG: Palled to connect to Ivnetad. Falling back to device scanning.
1grub?-install: warning: this 6PT partition labe! contains no DiuS toot vartith
igrub2-Install; error: embedding is not possible, but this is required for i
| bash-4.28 grubZ-Install
/dev/sda
i Installing for 1386-pc platform.
¡grub2-Install: warning: this GPT partition label contains no BIOS Boot Pa
GRUB can only be
¡bash-4.21 parted
/dev/sda set 1 bios grub on
I Information: You may need to update retc/istab.
(bash 4.20 parted /dev/sda print
(Model: ATA ST95BB4ZBAS (sCSI)
IDisk /dev/sda: 500GB
?Sector size (logical/physical): 5128/5128
Partition Table: upt
Disk Flags:
1 Number
Start
End
Size
Pile susti
1049kB
2111
ZLAMB
Lat16
211MB
1285MB
107490
sis
1285MB
500GB
49961
IDe
Instar.
(bash-4.20
ub2-install
/dew/sda
1386-pe platform.
shed. No error reparted.

] Started Replay Read-Ahead Data.
Starting Remount Root and Kernel File Systems.
Starting Apply Kernel Variables...
OR
Starting Create Static Device Nodes in /dev.
] Started Remount Root and Kernel File Systems.
Starting dev Coldplug all Devices...
OR
Starting Configure read-only root support...
] Started Journal Service.
OR
] Started Read and set NIS domainname from /etc/sysconf lg network.
OK
Starting Flush Journal to Persistent Storage...
1 Started udev Coldplug all Devices.
DR
Starting dev Wait for Complete Device Initialization..
] Started LUM2 metadata daemon.
] Started Plush Journal to Persistent Storage.
=.
] Started Apply Kernel Variables.
1 Started Configure read-only root support.
Starting Load/Save Random Seed.
1
Ok
OK
1 Started Load/Save Random Seed.
] Started Create Static Device Modes in /dev.
Starting udev Kernel Device Manager...
IL
Ir
OK
] Started udev Kernel Device Manager.
OK
] Created slice system-systemdzdbacklight.slice.
Starting Load/Save Screen Backlight Brightness of backlight:acpi_vldeob...
OR
1 Started Load/Save Screen Backlight Brightness of backlight:acpi_videob.
OR
] Found device /dev/mapper/centosb@-swap.
Activating swap /dev/ mapper/centos@0-swap...
|r
OK
] Activated swap /dev /mapper/centosd0-swap.
Ir
OR
] Reached target Swap.
1〔
OR
] Created slice system-lum2 x2dpuscan.slice.
Starting LUM2 PU scan on device 8:3..
OR
OK
I Found device ST9500420AS 2.
] Started udev Walt for Complete Device Initialization.
Starting Activation of DM RAID sets...
[
OR
] Started Activation of DM RAID sets.
OK
] Reached target Local Encrypted Volumes.
[
OR
] Started Monitoring of LUMZ mirrors, snapshots etc, using dmeventd or progress polling.
OK
J Reached target Local File Systems (Pre),
Mounting /boot...
OK
UK
] Mounted boot.
1 Found device /dev /mapper centosb0-home.
Mounting /home. o•
OK
I Started LUM2 PU scan on device 8:3.
OK
I Mounted /home.
arr] A start job 1s running for dev-disk-bux2duuld-0803 ›2a6470 .device (45s 1min 30s)

(bash-4.21 grubZ-mkconf1g
-D /boot/ef i/EFI/centos/grub.cfg
) Generating grub configuration file
.00
WARNING: Failed to connect to lumetad. Palling back to device scanning.
WARNING: Failed to connect to lumetad. Falling back to device scanning.
Found linux image: /boot/umlinuz-3.10.0-1160.42.2.el7.x86_64
[Found initrd image: /boot/initramfs-3.10.0-1160.42.2.el7.x86_64.ing
I Found linux image: /boot/umlinuz-3.10.0-1160.25.1.el7.x86_64
(Found initrd image: /boot/initramfs-3.10.0-1160.25.1.el7.x86_64.img
( Found linux image: /boot/umlinuz-3.10.0-1160.el7.x86_64
(Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.ing
(Found linux image: /boot/unlinuz-@-rescue-51a66e0b746544209('ed6B073214fd70
I Found initrd image: /boot/initramfs-@-rescue-51a66e074654d209fed68073214 d70. ing
WARMING: Failed to connect to lumetad. Falling back to device scanning.
HARNING: Failed to connect to lunetad. Falling back to device scaming•


https://blog.csdn.net/Strive_For_Future/article/details/120821404

阿阔斯
重新启动并选择正确的启动设备
或将引导媒体插入选定的引导设备,然后按一个键

欧霍斯
bash-4.28 grub2-install --root-directory=unt/sysimage/deu/sda
正在安装 1386-pc 平台。
警告:无法连接到 lunetad。回退到设备扫描。
警告:无法连接到 lunetad。回退到设备扫描。
警告:无法连接到 lunetad。回退到设备扫描。
¿grubZ-安装: 警告: 此 GPT 分区标签不包含 BIOS 启动分区: en
1 grubz-install: 错误: 嵌入是不可能的,但这是 BAID 和
(bash-4.28 grubz-install/dev/sda
安装1386-pc平台农场。
agrub2-install: 警告: 此 GPT 分区标签不包含 BIOS 布尔
GRUB 只能 de installen
1 bash-4.24 分手
I bash-4.28 parted /dev/sda print
1 型号: ATA ST950042BAS (SCSI)
磁盘 /开发/sda: 500GB
3 扇区大小(逻辑/物理):5128/512B
[分区表: gpt
(磁盘标志:
1 数字
开始
结束
大小
桩系统
1049千字节
211兆字节
210兆字节
脂肪16
211兆字节
1285MB 107410 sis
1285兆字节
断续器
4996B
可食用
模拟列表
气馁。。

I bash-4.20 grubZ-Install--root-directory=/unt/sysimage/dev/sda
正在安装 1386-pc 平台。
警告:已暂停以连接到 lumetad。回退到设备扫描。
警告:苍白以连接到lunetad。返回设备扫描。
WARNInG:Palled连接到Ivnetad。回退到设备扫描。
1格鲁布?-安装:警告:这个6PT分区拉贝!不包含 DiuS toot vartith
igrub2-Install;错误:嵌入是不可能的,但这是i所必需的
|bash-4.28 grubZ-Install
/dev/sda
i 安装1386-pc平台。
●grub2-安装:警告:此 GPT 分区标签不包含 BIOS 启动 Pa
GRUB 只能是
■bash-4.21 分手
/dev/sda set 1 bios grub on
I 信息:您可能需要更新 retc/istab。
(bash 4.20 parted /dev/sda print
(型号: ATA ST95BB4ZBAS (sCSI)
磁盘 /开发/sda: 500GB
?扇区大小(逻辑/物理):5128/5128
分区表: upt
磁盘标志:
1 数字
开始
结束
大小
桩苏斯蒂
1049千字节
2111
兹兰姆
拉特16
211兆字节
1285兆字节
107490
妹妹
1285兆字节
500GB
49961
西德;
龄。
(抨击-4.20
ub2-安装
/露水/sda
1386-pe 平台。
棚。未重新出现任何错误。

] 已开始重播预读数据。
启动重新挂载根系统和内核文件系统。
正在启动应用内核变量...

在 /dev 中启动创建静态设备节点。
] 已开始重新挂载根系统和内核文件系统。
正在启动开发 冷插拔所有设备...

正在启动配置只读根用户支持...
] 已启动日记服务。

] 已从 /etc/sysconf lg 网络读取并设置 NIS 域名。
还行
正在启动 Flush 日志到持久性存储...
1 已启动 udev 冷插拔所有设备。
博士
正在启动 dev 等待设备初始化完成。.
] 启动了 LUM2 元数据守护程序。
] 已启动 Plush 日志到持久性存储。
=.
] 已启动应用内核变量。
1 已启动 配置只读根支持。
开始加载/保存随机种子。
1
还行
还行
1 已开始加载/保存随机种子。
] 已开始在 /dev 中创建静态设备模式。
正在启动 udev 内核设备管理器...
伊利诺伊州
红外
还行
] 已启动 udev 内核设备管理器。
还行
] 创建了 slice system-systemdzdbacklight.slice。
启动加载/保存屏幕背光背光亮度:acpi_vldeob...

1 开始加载/保存屏幕背光背光亮度:acpi_videob。

] 找到设备 /dev/mapper/centosb@-swap。
正在激活交换 /dev/ 映射器/centos@0交换...
|r
还行
] 激活的交换 /dev /mapper/centosd0-swap。
红外

] 已达到目标交换。
1〔

] 创建了 slice system-lum2 x2dpuscan.slice。
在设备 8:3 上启动 LUM2 PU 扫描。

还行
我找到了设备ST9500420AS 2。
] 启动了 udev Walt 以进行完整的设备初始化。
正在启动 DM RAID 集的激活...
[

] 已开始激活 DM RAID 集。
还行
] 已到达目标本地加密卷。
[

] 已开始使用 dmeventd 或进度轮询监视 LUMZ 镜像、快照等。
还行
J 已达到目标本地文件系统(预),
正在安装/启动...
还行
英国
] 已装载的启动。
1 找到设备 /dev /mapper centosb0-home.
安装/主页。o•
还行
我在设备上以 8:3 启动了 LUM2 PU 扫描。
还行
我骑/回家。
arr] 为 dev-disk-bux2duuld-0803 ›2a6470 .device 运行的启动作业 1s (45s 1min 30s)

(bash-4.21 grubZ-mkconf1g
-D /boot/ef i/EFI/centos/grub.cfg
) 生成 grub 配置文件
.00
警告:无法连接到 lumetad。返回设备扫描。
警告:无法连接到 lumetad。回退到设备扫描。
找到 linux 映像: /boot/umlinuz-3.10.0-1160.42.2.el7.x86_64
[找到的 initrd 映像: /boot/initramfs-3.10.0-1160.42.2.el7.x86_64.ing
我发现 linux 映像: /boot/umlinuz-3.10.0-1160.25.1.el7.x86_64
(在 iitrd 映像中找到: /boot/initramfs-3.10.0-1160.25.1.el7.x86_64.img
( Found linux image: /boot/umlinuz-3.10.0-1160.el7.x86_64
(在 iitrd 映像中找到:/boot/initramfs-3.10.0-1160.el7.x86_64.ing
(找到 linux 映像: /boot/unlinuz-@-rescue-51a66e0b746544209('ed6B073214fd70
我找到了initrd映像:/boot/initramfs-@-rescue-51a66e074654d209fed68073214 d70。wn9
WARMING:无法连接到 lumetad。回退到设备扫描。
哈宁:无法连接到 lunetad。回退到设备诈骗•



参考:https://blog.csdn.net/qq_28641401/article/details/99428192
https://cloud.tencent.com/developer/article/1499344
#cat stdouterr.c


解答:这段代码的输出是什么呢?你可以快速的将代码敲入你电脑上(当然,拷贝更快),然后发现输出是
World!Hello
果然:
./stdouterr
World!Hello

这是为什么呢?在默认情况下,stdout是行缓冲的,他的输出会放在一个buffer里面,只有到换行的时候,才会输出到屏幕。而stderr是无缓冲的,会直接输出,举例来说就是printf(stdout, "xxxx") 和 printf(stdout, "xxxx\n"),前者会憋住,直到遇到新行才会一起输出。而printf(stderr, "xxxxx"),不管有么有\n,都输出。


stdout憋住,证明换行才会输出:
#cat stdouterr.c


#./stdouterr
Hello Hello   #stdout换行输出
World! Hello  #World!是stderr输出,会立即输出,在它上面Hello的前面输出。



make stdouterr
cc     stdouterr.c   -o stdouterr

./stdouterr
Can't open it!
Can't open it!
Can't open it!


./stdouterr > tmp.txt              
Can't open it!

这3句效果不是一样啊,有什么区别吗?

有区别。
stdout -- 标准输出设备 (printf("..")) 同 stdout。
stderr -- 标准错误输出设备
两者默认向屏幕输出。
但如果用转向标准输出到磁盘文件,则可看出两者区别。stdout输出到磁盘文件,stderr在屏幕。


cat tmp.txt
Can't open it!
Can't open it!



实践来自:https://blog.csdn.net/qingzhuyuxian/article/details/80391143
systemctl status rpcbind -l
● rpcbind.service - RPC bind service
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit) since Wed 2019-06-12 22:54:51 CST; 27min ago
  Process: 7679 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited, status=0/SUCCESS)
Main PID: 7680 (code=exited, status=1/FAILURE)

Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: Starting RPC bind service...
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: Started RPC bind service.
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 rpcbind[7680]: cannot get uid of 'rpc': Success
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: rpcbind.service: main process exited, code=exited, status=1/FAILURE
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: Unit rpcbind.service entered failed state.
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: rpcbind.service failed.
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: start request repeated too quickly for rpcbind.service
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: Failed to start RPC bind service.
Jun 12 22:54:51 mother_virtualbox_bj_sjs_10_10_0_108 systemd[1]: rpcbind.service failed.




先删除rpcbind

rpm –e –nodeps rpcbind

再重新安装一次

yum install rpcbind



http://www.it610.com/article/4385613.htm

Linux 下修改用户的UID和所在组的GID实践如下:


useradd  jackX -u 798
usermod -u 863 jackX
groupmod -g 863 www



修改UID
Usage:

usermod -u NEW-UID username
1
Examples:

## original UID is 1007
root@pts/0 $ id newjames
uid=1007(newjames) gid=1008(james) 组=1008(james)

## change 1007 to 2007
root@pts/0 $ usermod -u 2007 newjames

## modified to 2007
root@pts/0 $ id newjames
uid=2007(newjames) gid=1008(james) 组=1008(james)

修改GID/group-name
Usage:

groupmod -g NEW-GID groupname
1
Examples:

## james to newjames, but james's group is still 'james'
root@pts/0 $ groupmod -g 2007 newjames
groupmod:“newjames”组不存在

root@pts/0 $ id newjames
uid=2007(newjames) gid=1008(james) 组=1008(james)

root@pts/0 $ groupmod -g 2007 james


修改群组名称:
## try to rename group

root@pts/0 $ groupmod --help
用法:groupmod [选项] 组

选项:
  -g, --gid GID                 将组 ID 改为 GID
  -h, --help                    显示此帮助信息并推出
  -n, --new-name NEW_GROUP      改名为 NEW_GROUP
  -o, --non-unique              允许使用重复的 GID
  -p, --password PASSWORD   将密码更改为(加密过的) PASSWORD
  -R, --root CHROOT_DIR         chroot 到的目录


root@pts/0 $ groupmod -n newjamesgroup james


## find that group was renamed
root@pts/0 $ id newjames
uid=2007(newjames) gid=1008(newjamesgroup) 组=1008(newjamesgroup)


## try to change GID
root@pts/0 $ groupmod -g 2007 james

root@pts/0 $ id newjames
uid=2007(newjames) gid= 2007(newjamesgroup) 组= 2007(newjamesgroup)


修改用户名称
Usage:

usermod -l login-name old-name
1
修改用户的名称 old-name 改成 login-name,别的都没有改变。其实我们也应该考虑是否把用户的HOME目录也改成新的用户。

另外这里有个问题需要注意

如果出现如下报错

root@pts/0 $ usermod -l newjames james
usermod: user James is currently used by process 12345
1
2
说明有用james用户运行的程序,需要把相关的程序停掉之后再执行上面的命令

Examples:

## add user 'james' for test
root@pts/0 $ useradd james

## check original id
root@pts/0 $ id james
uid=1007(james) gid=1008(james) 组=1008(james)

## check HOME directory
root@pts/0 $ ls -ld /home/james/
drwx------ 2 james james 4096 12月 23 11:46 /home/james/

## try to change or rename and verify
root@pts/0 $ usermod -l newjames james

root@pts/0 $ id james
id: james: no such user

root@pts/0 $ id newjames
uid=1007(newjames) gid=1008(james) 组=1008(james)


## check HOME folder
root@pts/0 $ ls -ld /home/james/
drwx------ 2 newjames james 4096 12月 23 11:46 /home/james/

root@pts/0 $ ls -ld /home/newjames
ls: 无法访问/home/newjames: 没有那个文件或目录
Dev-web-solr [~] 2016-12-23 11:47:22

从上面可以看出,变化只仅仅是username,UID/GUID/HOME目录都没有改变
---------------------

原文:https://blog.csdn.net/eagle5063/article/details/53842528
我先把光标停留在第一行上,按下yy命令,将第一行复制,然后再移到第二行,按下dd命令,删除第二行。此时如果我们想要粘贴第一行的内容的话,直接按p是不行的,因为此时的p将引用无名寄存器中的内容,而它的内容已经被第二行的内容给覆盖了,所以此时就轮到复制专用寄存器大显身手了,此时如果按下这个命令:
"0p
这时,将会粘贴复制专用寄存器中的内容。这里直接贴结果图可能看不出什么效果,那我就贴一下用dd删除了第二行后所有寄存器的内容给大家看看吧:
  l  ""   ddline^J     当前寄存器是",里存的是删除的内容。
  l  "0   yyline^J     0 是复制专用寄存器

从这里可以看出,无名寄存器保存的是dd命令删除的内容,而复制专用寄存器(0)保存的是y命令复制的内容。
"0p 就能打印出yyline,而直接p就会打印删的内容ddline。



阅读全文
说明:Keka支持解压和压缩,基本这个软件全部格式都搞定。
下载:
(链接: https://pan.baidu.com/s/1kVmsj8z 密码: pydh)

官方网站:https://www.keka.io/en/

https://www.keka.io/en/


Keka,使用 p7zip(7-zip 在类 UNIX 系统上的移植版本)压缩内核。经年累月,在美丽优雅的 Mac 平台上,你一如既往,霸道地,丑!Keka 不光丑,压缩要用手,文件拖图标,很难不粗口。
语言已经不能表达我对这款软件的畏惧(珍爱视力,拒绝 Keka 的软件截图)。基本上,它只有三项优势,就是免费,免费和免费。支持压缩:7z, Zip, Tar, Gzip, Bzip2。支持解压:RAR, 7z, Lzma, Zip, Tar, Gzip, Bzip2, ISO, EXE, CAB, PAX, ACE (PPC)。雪豹系统可以加入右键菜单。
yum install lshw
lshw 这个命令是一个比较通用的工具,它可以详细的列出本机的硬件信息。但这个命令并非所有的发行版都有,比如 Fedora 就默认没有,需要自己安装。

lshw 可以从各个 /proc 文件中提取出硬件信息,比如:CPU、内存、usb 控制器、硬盘等。如果不带选项的话,列出的信息将很长,加上 -short 选项时,将只列出概要信息。

lshw -short
H/W path            Device      Class      Description
======================================================
                                system     NF5280M2 (To Be Filled By O.E.M.)
/0                              bus        2U
/0/0                            memory     64KiB BIOS
/0/4                            processor  Xeon (To Be Filled By O.E.M.)
/0/4/5                          memory     256KiB L1 cache
/0/4/6                          memory     1MiB L2 cache
/0/4/7                          memory     12MiB L3 cache
/0/8                            processor  Xeon (To Be Filled By O.E.M.)
/0/8/9                          memory     256KiB L1 cache
/0/8/a                          memory     1MiB L2 cache


lspci 列出所有 PCI 总线,以及与 PCI 总线相连的所有设备的详细信息,比如 VGA 适配器、显卡、网络适配器、usb 端口、SATA 控制器等。
lspci
00:00.0 Host bridge: Intel Corporation 5520 I/O Hub to ESI Port (rev 22)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 22)
00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 22)
00:07.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 7 (rev 22)
00:09.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 9 (rev 22)
00:13.0 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub I/OxAPIC Interrupt Controller (rev 22)
00:14.0 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub System Management Registers (rev 22)


lsusb 列出与本机相连的所有 USB 设备的信息。默认情况下,只列出概要信息,使用 -v 选项可以列出每一个 USB 口的详细信息。

lspci
00:00.0 Host bridge: Intel Corporation 5520 I/O Hub to ESI Port (rev 22)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 22)
00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 22)
00:07.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 7 (rev 22)
     在Linux系统中/tmp文件夹下的文件是会被清理、删除的,文件清理的规则是如何设定的呢? 以Redhat为例,这个主要是因为作业里面会调用tmpwatch命令删除那些一段时间没有访问的文件。

那么什么是tmpwatch呢?其实tmpwatch是一个命令或者说是一个包。如下所示

tmpwatch - removes files which haven’t been accessed for a period of time

[root@DB-Server ~]# rpm -qa | grep tmpwatch
tmpwatch-2.9.7-1.1.el5.5
[root@DB-Server ~]# whereis tmpwatch
tmpwatch: /usr/sbin/tmpwatch /usr/share/man/man8/tmpwatch.8.gz
[root@DB-Server ~]# file /usr/sbin/tmpwatch
/usr/sbin/tmpwatch: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[root@DB-Server ~]#

关于tmpwatch命令的参数,不同版本可能有所不同,下面以Red Hat Enterprise Linux Server release 5.7下TMPWATCH(8)为列

作用:

删除一段时间没有被访问的文件。

参数:

-u 按照文件的最后access时间,即最后访问时间为参考。默认选项。可通过ls -lu查看。

-m 按照文件的最后modified时间,即最后修改时间为参考。可通过ls -l查看。

-c 按照文件的-ctime时间做参考,ctime更新的条件为写入、更改属主、权限。可通过ls -lc查看。

-M 按照目录的修改时间来删除目录而不是访问时间。

-a 删除所有类型文件。包括目录和symbolic links

-d --nodirs 排除目录文件,即使是空目录。

-d --nosysmlinks 排除symbolic links类型文件。

-f 强制删除那些root没有写权限的文件。比如root的readonly文件

-q 只报告错误信息。

-x /PATH 排除特定目录,即不删除该子目录里的文件。

-U user_name 排除属于特定用户的文件,即不删除该用户的文件。

-v 显示删除过程。默认是不显示删除了什么文件,直接删除的。

-t 用于测试,并不真正删除文件,能显示出要删除文件的过程。

-d 不删除文件里的子目录,但是子目录里面的文件还是会被删除。



参数后加时间,默认是hours。也可以使用30d表示30天,但是有些版本只支持hours。 时间后是要检查的目录。可以多个目录用空格分开。如下所示表示720小小时~=30天。

[root@DB-Server ~]#  more /etc/cron.daily/tmpwatch
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
        -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
        -X '/tmp/hsperfdata_*' 240 /tmp
/usr/sbin/tmpwatch "$flags" 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
        /usr/sbin/tmpwatch "$flags" -f 720 "$d"
    fi
done
[root@DB-Server ~]#

如果你想将强制删除30天没有访问的文件改为7天,只需"/usr/sbin/tmpwatch "$flags" 720 /var/tmp"和"/usr/sbin/tmpwatch "$flags" -f 720 "$d" 里面的720改为189即可。

来自:http://www.cnblogs.com/kerrycode/p/5759941.html


==========================实践================================
rpm -qa | grep tmpwatch
tmpwatch-2.9.16-6.el6.x86_64

whereis tmpwatch
tmpwatch: /usr/bin/tmpwatch /usr/sbin/tmpwatch /usr/share/man/man8/tmpwatch.8.gz

cat /etc/cron.daily/tmpwatch
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
        -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
        -X '/tmp/hsperfdata_*' -X '/tmp/.hdb*lock' -X '/tmp/.sapstartsrv*.log' \
        -X '/tmp/pymp-*' 10d /tmp
/usr/sbin/tmpwatch "$flags" 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
        /usr/sbin/tmpwatch "$flags" -f 30d "$d"
    fi
done
分页: 5/40 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下页 最后页 [ 显示模式: 摘要 | 列表 ]