$cat pingfang.awk


$cat xy.txt
1 2
3 3
4 3
2 3

$./pingfang.awk xy.txt
sum = 5
sum = 18
sum = 25
sum = 13

这些文章{print 'sum =',SquareSum($1,$2)} 都是单引号,估计都没实践过吧?
参考:https://tieba.baidu.com/f?kz=4897365011&mo_device=1&ssid=0&from=844b&uid=0&pu=usm@0,sz@1320_2001,ta@iphone_1_11.4_3_605&bd_page_type=1&baiduid=F7F621D935F5435074FCC25A0863FC2F&tj=www_normal_5_0_10_title&referer=m.baidu.com?pn=0&
http://blog.sina.cn/dpool/blog/s/blog_4cab1a3701007ya9.html
实践成功如下:
vim中 输入 :set
:set
--- Options ---
  comments=:#         filetype=yaml       pastetoggle=<F9>    ttymouse=xterm2
  cscopetag           helplang=en         ruler               viminfo='20,"50
  cscopeverbose       history=50          syntax=yaml         t_Sb=^[[4%dm
  expandtab           hlsearch            ttyfast             t_Sf=^[[3%dm
  backspace=indent,eol,start
  commentstring=# %s
  cscopeprg=/usr/bin/cscope
  fileencodings=ucs-bom,utf-8,latin1
  formatoptions=croql
  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block,a:blinkon0
ormatoptions=croql

这个选项,希望在~/.vimrc中禁止,比如设置为

set formatoptions=tcpmM

但是vim不识别此行,报错.无法禁止这个选项....

经过百度搜索,发现解决方案.[比较恶心 开源软件的就是配置文件 不人性化]

在粘贴前先设置进入粘贴插入模式,即不会自动缩进和连续注释

set paste

然后再进入插入模式粘贴,啥注释的#号或双斜杠都不影响。AddTime:2018-07-30
在粘贴插入模式下代码是不会自动按格式缩进的,需要使用nopaste设置回来

set nopaste

也可以在.vimrc中设置切换的快捷键,比如设置F9,则可以在.vimrc中加入:

set pastetoggle=<F9>

这样直接在插入模式按F9就会在“-- 插入 --”模式和“-- 插入(粘贴) --”模式中切换
说的就是这个设置:


================================================================================

ecureCRT会将你原来的文本原封不动的按照字符串的样式发送给服务器。所以当你的服务器上的vim设置为autoindent的话,在i模式下,那么它会将secureCRT传输而来的这些字符串再进行一下缩进。若你拷贝的文本中已经有表示缩进的空格或者制表符的话,它们也会被当成字符串,而被缩进。
解决办法:
1. 在拷贝前输入:set paste (这样的话,vim就不会启动自动缩进,而只是纯拷贝粘贴)
2. 拷贝完成之后,输入:set nopaste (关闭paste)


来自:
https://blog.csdn.net/kwame211/article/details/77964106
https://blog.csdn.net/chenghai37/article/details/80698322

vim复制代码包含注释时格式会乱掉的解决办法:
每次复制代码时,如果代码里有 // 这样的注释就容易让格式乱掉,通过下面的设置就可以避免这种情况。

粘贴代码时取消自动缩进
VIM在粘贴代码时会自动缩进,把代码搞得一团糟糕,甚至可能因为某行的一个注释造成后面的代码全部被注释掉,我知道有同学这个时候会用vi去打开文件再粘贴上去(鄙人以前就是这样),其实需要先设置一下

set paste

然后再进入插入模式粘贴,代码就不会被自动缩进。可是敲代码的时候需要自动缩进,又得改回来:

set nopaste

最方便的方法就是在.vimrc中加一句:

set pastetoggle=<F9>
以后在插入模式下,只要按F9键就可以切换自动缩进。

来自:https://blog.csdn.net/tao_627/article/details/18764539
来自:https://eallion.com/aliyun-ntp

公共NTP服务器
Unix类系统:time1-7.aliyun.com 8台:
我也不知道是怎么想的,
随手就去搜索了“阿里云 NTP”,
结果还真有!

ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com

Windows: time.pool.aliyun.com


*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>/dev/null

#/usr/sbin/ntpdate ntp1.aliyun.com
30 Jul 13:27:42 ntpdate[32557]: step time server 120.25.115.20 offset 486.889850 sec

#sed -n 's#ntp.ksyun.cn#ntp1.aliyun.com#p'   /var/spool/cron/root
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>/dev/null
正式替换:
sed -i 's#ntp.ksyun.cn#ntp1.aliyun.com#'   /var/spool/cron/root
成功替换:
cat /var/spool/cron/root
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>/dev/null

Ansbile批量替换:
ansible applet -a"sed -i 's#ntp.ksyun.cn#ntp1.aliyun.com#' /var/spool/cron/root"
ansible applet -m ping      
[DEPRECATION WARNING]: DEFAULT_SUDO_EXE option, In favor of Ansible Become, which is a generic framework. See become_exe. ,
use become instead. This feature will be removed in version 2.8. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: DEFAULT_MODULE_LANG option, Modules are coded to set their own locale if needed for screenscraping .
This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
#deprecation_warnings = True     允许在ansible-playbook输出结果中禁用“不建议使用”警告
vi /etc/ansible/ansible.cfg
解决办法:
#deprecation_warnings = True
deprecation_warnings = false
CentOS7.X下如何查看并将一个应用设置为开机启动?systemctl start slapd 只是启动,并不是开机启动。


背景:有时候我们使用systemctl命令,如简单点的systemctl start memcached来讲,出现错时,会有一些提示,但是提示的内容是变量,其并没有将参数给编译后的值放入,于是出现如下所示,但是要失败了怎么排查这些参数呢?此文就讲这个问题,如果不是为了linux开机启动提速而并行启动外,这个systemctl其本质是想接管很多东西,但也带来了很多麻烦,难怪linus对此有一定的意见,系统要保持简单,好用。像开机慢可以少开机或不关机嘛,学学人家苹果升级在半夜,你慢就慢,谁管你,从策略上就规避了,把技术搞复杂还是简单是一门哲学,而创始人的价值就在于坚守设计艺术,而不光是技术。
● memcached.service - Memcached
   Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Fri 2018-07-20 18:48:50 CST; 19h ago
  Process: 15266 ExecStart=/usr/local/memcached/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 15266 (code=exited, status=0/SUCCESS)

失败:
systemctl start memcached
Job for memcached.service failed because the control process exited with error code. See "systemctl status memcached.service" and "journalctl -xe" for details.






/etc/sysconfig/memcached


systemctl daemon-reload
systemctl start memcached
systemctl status memcached.service
  Active: failed (Result: exit-code) since Sat 2018-07-21 14:35:22 CST; 5s ago
  Process: 11417 ExecStart=/usr/local/memcached/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS (code=exited, status=71)
  Process: 11399 ExecStartPre=/bin/bash -l -c echo "/usr/local/memcached/bin/memcached" -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS > /tmp/systemctl.debug (code=exited, status=0/SUCCESS)
Main PID: 11417 (code=exited, status=71)

如果有错,需要挑食的参数查看 /tmp/systemctl.debug:
cat /tmp/systemctl.debug
/usr/local/memcached/bin/memcached -u root -p 11211 -m 64 -c 1024 -vv >> /data/logs/memcached/11211/memcached.log 2>&1
netstat -lntp   #常用命令参数及解释如下:主要是看IP和TCP,以及程序的PID。
-l, --listening            display listening server sockets
-n, --numeric              don't resolve names
-t, tcp
-p, --program
   Show the PID and name of the program to which each socket belongs.


一)netstat常用查看端口参数之查看所有tcp/udp端口:
netstat -atlunp|grep 80


二)netstat常用查看端口参数之单独查看tcp/udp端口命令:
netstat -uln

Proto Recv-Q Send-Q Local Address               Foreign Address             State
udp        0      0 0.0.0.0:111                 0.0.0.0:*
udp        0      0 0.0.0.0:808                 0.0.0.0:*
udp        0      0 127.0.0.1:837               0.0.0.0:*
udp        0      0 0.0.0.0:17617               0.0.0.0:*
udp        0      0 0.0.0.0:2392                0.0.0.0:*



假如没有n,直接用netstat -tl,显示的是一些端口的程序名,如下:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:5646                      *:*                         LISTEN
tcp        0      0 *:sunrpc                    *:*                         LISTEN
tcp        0      0 *:7824                      *:*                         LISTEN
tcp        0      0 *:webcache                  *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN
tcp        0      0 *:5881                      *:*                         LISTEN

三)netstat常用查看端口参数之单独查看tcp端口命令:
netstat -tln

Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:34945               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:32740               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:15770             0.0.0.0:*                   LISTEN

四)netstat本身也是通过读取系统中的/proc/net/tcp(6)文件来实现对当前网络状态的监控输出的
netstat本身也是通过读取系统中的/proc/net/tcp(6)文件来实现对当前网络状态的监控输出的。我们只要依样画葫芦对此文件进行 解析(主要是合并ipv4和ipv6的内容,然后从16进制转换成字符串形式的ip,端口),然后再比对一下,只要发现此socket的远程ip和端口和 php中的$_SERVER['REMOTE_ADDR'],$_SERVER['REMOTE_PORT']相匹配即可。具体实现如下:

摘录:http://www.4shell.org/archives/2064.html
参考:http://www.80sec.com/security-issue-on-linux-fd-inheritance.html
SecureCrt某个设置不合朕的心意,在打开一个新的连接时不是在同一个窗口下,它又新开了一个工作窗口,像下面这样,操作起来让人很不爽:
一个SSH打一一个SecureCRT,
解决方案:点击 File -> Connect In Tab/Tile 连接新的会话

来自:https://blog.csdn.net/u012135425/article/details/79487575
背景:在Linux下习惯使用ll、la、l等ls别名的童鞋到mac os可就郁闷了,
whichi ll
-bash: whichi: command not found
[xiangdong@jenkins_server_bj_sjs_10_71_182_25 .ssh]$ which ll
alias ll='ls -l --color=auto'
        /bin/ls
其实只要在用户目录下建立一个脚本“.bash_profile”,并输入以下内容即可:


ls -l --color=auto

1 2014-461deMacBook-Pro:~ root# cd ~
2 2014-461deMacBook-Pro:~ root#vim .bash_profile
加入:


  保存后,执行

3 2014-461deMacBook-Pro:~ root#source .bash_profile
=============================================

.bash_profile

alias l='ls -alhF'
alias la='ls -AFh'
alias ll='ls -lhAF'
alias l='ls -alhF'
alias la='ls -AFh'
alias ll='ls -lhAF'

然后在终端窗口中输入下列命令后,别名即可立即生效:
source ~/.bash_profile
source ~/.bash_profile

如果不知道如何创建,可以直接在“终端”窗口中依次执行如下命令:

.bash_profile完整创建命令Shell

cd ~
touch .bash_profile
echo "alias l='ls -alhF'" >>.bash_profile
echo "alias la='ls -AFh'" >>.bash_profile
echo "alias ll='ls -lhAF'" >>.bash_profile
source ~/.bash_profile

cd ~
touch .bash_profile
echo "alias l='ls -alhF'" >>.bash_profile
echo "alias la='ls -AFh'" >>.bash_profile
echo "alias ll='ls -lhAF'" >>.bash_profile
source ~/.bash_profile

来自:https://clang.cn/blog/749.html
https://www.cnblogs.com/daly2008/p/4160066.html
背景:Python很火,且连一些如ESP8266的硬件都支持Python了。
目前Python存在两个版本Python2和Python3系列,且这两个版本同时在更新与维护。到底是选择Python2还是选择Python3,取决于当前要使用的库、框架支持哪个版本。因此一台电脑上可能需要同时安装Python2和Python3两个版本。本文主要讲述的是如何在centos7系统中存在python2系列的同时安装python3.8.1(目前python3系列的最新版本)

1.安装升级相应的软件包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

2.下载python 3.8.1 的源码包
wget http://mirrors.sohu.com/python/3.8.1/Python-3.8.1.tgz

3.安装python3.8.1
tar zxvf Python-3.8.1.tgz -C /opt/
cd /opt/Python-3.8.1/  
./configure --prefix=/usr/local/python3
make && make install  

若遇到编译问题:
zipimport.ZipImportError: can't decompress data; zlib not available  #make && make install
yum install zlib zlib-devel -y

4.配置python,配置python3  pip3 软链接,设置软连接:目的是让我们直接在任何地方输入python3命令都可以得到python解释器的运行。
更改/usr/bin/python链接:
ln -s /usr/local/python3/bin/python3.8.1 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
mv /usr/bin/pip{,.backup}
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip   #python2-pip没有,就没有这个pip.
查看是否安装成功
python3 -V
pip3 -V

更改/usr/bin/python默认链接,实现升级:
/usr/bin/python --version
Python 2.7.5
mv /usr/bin/python{,.old.backup}
ln -sf /usr/local/python3/bin/python3.8  /usr/bin/python


5.查看当python的版本,出现版本信息即为正确安装
python3 --version

安装python3.7出现ModuleNotFoundError: No module named '_ctypes'报错(重新编译一次就OK了)

来自:https://mhl.xyz/Python/python37_ctypes.html


6.更改yum脚本的python依赖
yum localinstall mysql-5.7.12-171123111505.el7.centos.x86_64.rpm
  File "/usr/libexec/urlgrabber-ext-down", line 28
    except OSError, e:
                  ^
# ls /usr/bin/yum*
# ls yum*
yum yum-config-manager yum-debug-restore yum-groups-manager
yum-builddep yum-debug-dump yumdownloader
更改以上文件头为
#!/usr/bin/python 改为 #!/usr/bin/python2

用Sed 一行搞定,参考自[实践OK]经常用到之linux sed 批量替换字符串,及模糊替换和模糊拼接的例子。http://jackxiang.com/post/2324/:
/usr/bin/yum-groups-manager  #!/usr/bin/python -tt
/usr/bin/yumdownloader #直接python后面有一个空格
/usr/bin/yum-debug-restore #!/usr/bin/python -tt
/usr/bin/yum-debug-dump  #!/usr/bin/python -tt
/usr/bin/yum-config-manager #!/usr/bin/python -tt
/usr/bin/yum-builddep  #!/usr/bin/python -tt
/usr/bin/yum  #python后面无空格
势必要有两种替换:
sed -i 's/#!\/usr\/bin\/python /#!\/usr\/bin\/python2.7 /' /usr/bin/yum-builddep
sed -i 's/#!\/usr\/bin\/python /#!\/usr\/bin\/python2.7 /' /usr/bin/yum-config-manager
sed -i 's/#!\/usr\/bin\/python /#!\/usr\/bin\/python2.7 /' /usr/bin/yum-debug-dump
sed -i 's/#!\/usr\/bin\/python /#!\/usr\/bin\/python2.7 /' /usr/bin/yum-debug-restore
sed -i 's/#!\/usr\/bin\/python /#!\/usr\/bin\/python2.7 /' /usr/bin/yumdownloader
sed -i 's/#!\/usr\/bin\/python /#!\/usr\/bin\/python2.7 /' /usr/bin/yum-groups-manager
sed -i 's/#!\/usr\/bin\/python$/#!\/usr\/bin\/python2.7/' /usr/bin/yum
sed -i 's/#!\/usr\/bin\/python$/#!\/usr\/bin\/python2.7/' /usr/libexec/urlgrabber-ext-down

这个-tt的没有啥用,只是起到警告作用,完全在替换时不要:
-t     Issue a warning when a source file mixes tabs and spaces for indentation in a  way  that  makes  it
              depend on the worth of a tab expressed in spaces.  Issue an error when the option is given twice.
-t 当源文件以制作缩进的方式混合制表符和空格时发出警告
               取决于用空格表示的选项卡的价值。 当该选项被赋予两次时发出一个错误。

7.测试用Python的Pip3安装Python扩展:
rpm -qf /bin/pip
python2-pip-8.1.2-5.el7.noarch
/bin/pip --version
pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)

pip3 --version
pip 9.0.1 from /usr/local/python3/lib/python3.8.1/site-packages (python 3.8.1)

pip3 install PyEmail
Collecting PyEmail
  Downloading https://files.pythonhosted.org/packages/ca/39/caf0436670b6fa9f072e322fab1a2b04d5631bdbdc8ea9857230aae02dd5/PyEmail-0.0.1.zip
Installing collected packages: PyEmail
  Running setup.py install for PyEmail ... done
Successfully installed PyEmail-0.0.1
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

pip3 install ipdb
Collecting ipdb
  Downloading https://files.pythonhosted.org/packages/80/fe/4564de08f174f3846364b3add8426d14cebee228f741c27e702b2877e85b/ipdb-0.11.tar.gz
Requirement already satisfied: setuptools in /usr/local/python3/lib/python3.8.1/site-packages (from ipdb)
Collecting ipython>=5.0.0 (from ipdb)
  Downloading https://files.pythonhosted.org/packages/b1/7f/91d50f28af3e3a24342561983a7857e399ce24093876e6970b986a0b6677/ipython-6.4.0-py3-none-any.whl (750kB)
    62% |████████████████████            | 471kB 54kB/s eta 0:00:06
好一会下载安装就能装上这个,但是提示:You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
pip install --upgrade pip

pip install ipdb   #再一次安装这个Python的调试扩展
python -m pdb mail.py

最后,这些脚本总结起来放一块就这些,方便后期再安装之用:


来自:https://blog.csdn.net/hobohero/article/details/54381475
来自:https://blog.csdn.net/wjqwinn/article/details/75633714
用ssh登录阿里云centos7主机,过一会儿会自动出现以下信息,
Message from syslogd@docker_test_bj_sjs_10_71_159_108 at Jun 11 17:49:08 ...
kernel:unregister_netdevice: waiting for lo to become free. Usage count = 1
在这个信息中,我这里按ctrl+c可以退回到,  有兄弟说是内核版本太低,升级内核:
起因:

安装了Docker容器,运行过程中报:kernel:unregister_netdevice: waiting for lo to become free. Usage count = 1

相似问题描述:https://segmentfault.com/q/1010000007045424

解决办法:https://github.com/moby/moby/issues/5618

尝试升级到最新的4.19+内核。

1.查看操作系统版本

https://blog.csdn.net/lijing742180/article/details/80662062

2.查看内核版本

uname -sr

3.升级的三种方案

参考:

https://blog.csdn.net/breeze915/article/details/79243673

https://blog.csdn.net/qq_27281257/article/details/82049634

https://blog.csdn.net/RBPicsdn/article/details/79642932

4.删除旧内核

https://blog.csdn.net/RBPicsdn/article/details/79642932

rpm -qa | grep kernel
sudo yum remove -y 旧内核的名字就好了
术语解析:

术语解析
kernel-ml
kernel-ml 中的ml是英文【mainline stable】的缩写,elrepo-kernel中罗列出来的是最新的稳定主线版本。

kernel-lt
kernel-lt 中的lt是英文【long term support】的缩写,elrepo-kernel中罗列出来的长期支持版本。



转载至链接:https://my.oschina.net/boreboluomiduo/blog/3035332。

摘自:https://www.liangzl.com/get-article-detail-123785.html

https://m.aliyun.com/yunqi/ask/2877/
[root@localhost ~]# mount -t xfs /dev/sdb /data        
mount: mount /dev/sdb on /data failed: Structure needs cleaning

--------------------------
可以使用xfs_repair来修复,但是要注意 xfs_repair修复的分区中的文件都会丢失,即使是du能正常显示的文件也会丢失。

[root@yw-0-0 /]# mount -a
mount: Structure needs cleaning

[root@yw-0-0 /]# xfs_repair /dev/sdl

来自:http://blog.51cto.com/zwcmcm/1650764
mkfs.ext4 经yum update的升级到CentOS7.5后没了mkfs.ext4,于是 得安装:
安装https://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/Packages/e2fsprogs-1.42.9-11.el7.x86_64.rpm这个包

[root@iZ889v050nrZ:~]
#cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

[root@iZ889v050nrZ:~]
#rpm -qf /sbin/mkfs.ext4
e2fsprogs-1.42.9-11.el7.x86_64


===========Raspberry挂载NTFS磁盘=====================

[root@mainboard_virtualbox_docker_10_10_0_106:~]
#ssh -l pi 10.10.0.38


fdisk -l
mkfs.ext4 -T largefile4 -n /dev/sda
mkfs.ext4 -T largefile4 -n /dev/sdb


root@raspberrypi:~# dmesg |tail
[ 2296.301317]  sdb: sdb1 sdb2
[ 2334.288011] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0xe3c9e316)
[ 2334.288031] F2FS-fs (sda): Can't find valid F2FS filesystem in 1th superblock
[ 2334.288912] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 2334.288926] F2FS-fs (sda): Can't find valid F2FS filesystem in 2th superblock
[ 2334.288980] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0xe3c9e316)
[ 2334.288988] F2FS-fs (sda): Can't find valid F2FS filesystem in 1th superblock
[ 2334.288998] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 2334.289006] F2FS-fs (sda): Can't find valid F2FS filesystem in 2th superblock
[ 2512.016847] EXT4-fs (sda): VFS: Can't find ext4 filesystem

mkfs.ext3 -T largefile4 -n /dev/sda
mkfs.ext3 -T largefile4 -n /dev/sdb


mount -t ext3  /dev/sda /data0      
mount -t ext3  /dev/sdb /data1  


mount -t ntfs-3g /dev/sda /data0  
mount: unknown filesystem type 'ntfs-3g'


   sudo apt-get install ntfs-3g   #From:https://www.cnblogs.com/-jimmy-/p/6986010.html

源不行,看末尾成功加清华源,且要注意版本(E: The repository 'http://archive.raspbian.org/raspbian wheezy Release' does no longer have a Release file.):
https://blog.csdn.net/qq_35586327/article/details/94597760?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~first_rank_v2~rank_v25-3-94597760.nonecase&utm_term=%E6%A0%91%E8%8E%93%E6%B4%BE%E6%B2%A1%E6%9C%89release%E6%96%87%E4%BB%B6

mainboard_virtualbox_docker_10_10_0_106 (1) 跳板登录:
root@raspberrypi:~#    sudo apt-get install ntfs-3g --fix-missing                                                                                  
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  libntfs-3g871
The following NEW packages will be installed:
  libntfs-3g871 ntfs-3g
0 upgraded, 2 newly installed, 0 to remove and 309 not upgraded.
Need to get 540 kB of archives.
After this operation, 1,665 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf libntfs-3g871 armhf 1:2016.2.22AR.1+dfsg-1+deb9u1 [165 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf ntfs-3g armhf 1:2016.2.22AR.1+dfsg-1+deb9u1 [375 kB]
Fetched 540 kB in 0s (1,628 kB/s)
Selecting previously unselected package libntfs-3g871.
(Reading database ... 127338 files and directories currently installed.)
Preparing to unpack .../libntfs-3g871_1%3a2016.2.22AR.1+dfsg-1+deb9u1_armhf.deb ...
Unpacking libntfs-3g871 (1:2016.2.22AR.1+dfsg-1+deb9u1) ...
Selecting previously unselected package ntfs-3g.
Preparing to unpack .../ntfs-3g_1%3a2016.2.22AR.1+dfsg-1+deb9u1_armhf.deb ...
Unpacking ntfs-3g (1:2016.2.22AR.1+dfsg-1+deb9u1) ...
Processing triggers for initramfs-tools (0.130) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libntfs-3g871 (1:2016.2.22AR.1+dfsg-1+deb9u1) ...
Setting up ntfs-3g (1:2016.2.22AR.1+dfsg-1+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for initramfs-tools (0.130) ...
root@raspberrypi:~#

b
The value '\stable' is invalid for APT::Default-Release as such a release is not available in the sources
rm -rf /etc/apt/apt.conf.d/10defaultRelease

E: Unable to correct problems, you have held broken packages.
解决方案是先upgrade后update:
$ sudo apt-get upgrade
$ sudo apt-get update


源的问题:


想鼠标切换又能复制,怎么办?
set mouse=a可视下,用:按住 shift 键,然后选择。
在~/.vimrc中加入 set mouse=a 后,vim鼠标右键变得不能复制了,解决办法如下:
按住 shift 键,然后选择,此时表示由 X 处理该选择,copy 选项就 enable 了。如果放掉shift键,则由 vim处理该选择。

所以配置文件中的set mouse=a启动了所有模式, vim接管了鼠标的控制。

其中涉及的背景知识是:
鼠标事件有两种处理方式,程序处理和 X 处理。
如果 X 负责处理,则是左键选择,中间粘贴。
要让 vim 中由 X 负责处理,有两个方法:
1. 按住 shift 键,然后选择,此时由 X 处理该选择,copy 选项就 enable 了。如果放掉shift键,则由 vim处理该选择。
2. 在 .vimrc 中设置 set mouse= (就是说清空),此时vim永远不再干涉鼠标选择,永远把处理权交给X,这个时候鼠标就处于无模式编辑状态, 当然也能用鼠标来切换vim里面的tab窗口了,vim中的编辑光标也不会跟随鼠标了。
实践Ok来自:https://blog.csdn.net/sinkary/article/details/7531747

:set mouse=v
但这样后,Vim的标签就无法用鼠标切换了,http://jackxiang.com/post/9110/
想用鼠标点vim里的Tab,能切换标签,得重新运行::set mouse=a ,实践是可行的。
阅读全文
option + command + space打开Finder,command + shift + G;注意:打开finder后,再快捷键,然后输入“/”,前往根目录。
二)常用目录:硬盘图标拖拽至侧边栏。
三)shift + space :相当于快速查看目录大小。

1、通过“前往文件夹”快捷键组合

(1)打开finder,点击上部菜单栏“前往”,然后“个人”,直接跳转。

(2)快捷键组合:command + shift + G;注意:打开finder后,再快捷键,然后输入“/”,前往根目录。

2、将Macintosh HD快捷方式放入Finder侧边栏

对于经常要访问根目录的用户来说,将Macintosh HD快捷方式会更高效一些。在任何文件夹内(除了“我的所有文件”)右键点击标题栏(文件夹窗口最上面,居中的标题栏),然后选择Macintosh HD。最后将Macintosh HD左侧的硬盘图标拖拽至侧边栏即可完成操作。以后需要访问根目录时,只需点击侧边栏的快捷方式即可。

3、在桌面上显示硬盘

打开Finder的“偏好设置”,在“通用”模式下在“硬盘”前面的方块内勾选即可。这样桌面上就会有Macintosh HD,双击即可访问。

4、使用命令行迅速导航

导航打开终端应用,然后输入下面的命令即可迅速导航至根目录。

CD/

上面的命令是在终端中访问根目录,如果你想通过终端打开Finder的根目录,只需下面的命令即可:

open/

在Finder里,也不是类似下载文件夹里,输入:
Command+Shift+G
会弹出一个输入路径的框,输入路径也就跳转过去了。

---------------------------------------------------------------
option + command + space
直接通过Spotlight窗口就能打开Finder。简单吧!




| 设置Spotlight窗口的快捷键
在系统偏好设置-Spotlight中自行设置即可。



| 跳转到某个文件夹
进入Finder窗口后,shift+command+g后输入文件夹路径即可跳转到相应文件夹。

> 常见文件夹路径
跳转到根目录,输入
/
跳转到当前目录,默认为apple目录,输入
~

来自:http://www.cnblogs.com/tangyikejun/p/3997728.html
一)Yum安装:centos7编译好的strace安装源,在devtoolset-3包中有。

先添加 devtoolset-3 的安装源

yum install centos-release-scl-rh -y
yum install strace --enablerepo=centos-sclo-rh -y

直接安装

yum install strace

其他

1、devtoolset还有很多其他的工具可用,列表见 http://mirror.centos.org/centos/7/sclo/x86_64/rh/

2、还可以通过devtoolset切换高版本gcc编译环境,高版本的py等,详见  http://blog.fungo.me/2016/03/centos-development-env/

参考:https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/

二)源码装:
strace是一个功能强大的调试,分析诊断工具,主要用来监视系统调用。

1.下载strace-xxx.tar.xz

    下载网址是:http://sourceforge.net/project/showfiles.php?group_id=2861&package_id=2819;

2.解压

      $  xz -d   ***.tar.xz

      $  tar -xvf   ***.tar


      可以看到这个压缩包也是打包后再压缩,外面是xz压缩方式,里层是tar打包方式。

      补充:目前可以直接使用 tar xvJf  ***.tar.xz来解压

3.配置

        ./configure

4.编译

      make

5.安装

    make  install

6.使用



见博文:http://blog.csdn.net/u011630575/article/details/52077563
原因:外网试图登录SSH破解密码太多,出现大量的/usr/bin/ssh-agent -s进程。ssh-agent会随着当前ssh会话的消失而消失,这也是一种安全机制.
解决办法如下:
cat  /etc/profile.d/ssh-agent.sh  

运行:
[root@localhost ~]# sh  /etc/profile.d/ssh-agent.sh  
Starting ssh-agent...
Agent pid 3625
[root@localhost ~]# ps -ef|grep 3625
root      3625     1  0 22:57 ?        00:00:00 ssh-agent
root      3647  3325  0 22:57 pts/2    00:00:00 grep --color=auto 3625

后面再多个SSH,只有四个ssh-agent进程:
ps -ef|grep ssh-agent            
root      3625     1  0 22:57 ?        00:00:00 ssh-agent
root      2442     1  0 22:54 ?        00:00:00 /usr/bin/ssh-agent -s
root      2785     1  0 22:55 ?        00:00:00 /usr/bin/ssh-agent -s
root      3131     1  0 22:56 ?        00:00:00 /usr/bin/ssh-agent -s
root      3527     1  0 22:57 ?        00:00:00 /usr/bin/ssh-agent -s
root      3878     1  0 22:58 ?        00:00:00 /usr/bin/ssh-agent -s

cat ~/.agent.env
SSH_AUTH_SOCK=/tmp/ssh-X1RtYLOVI2iq/agent.3623; export SSH_AUTH_SOCK;
SSH_AGENT_PID=3625; export SSH_AGENT_PID;
echo Agent pid 3625;

感觉进程数还是变多,无鸟用,于是干掉这个SSH-Client:
[root@localhost ~]# rpm -qf /usr/bin/ssh-agent
openssh-clients-7.4p1-13.el7_4.x86_64
[root@localhost ~]# rpm -e openssh-clients
错误:依赖检测失败:
        openssh-clients 被 (已安裝) virt-viewer-5.0-7.el7.x86_64 需要
        openssh-clients 被 (已安裝) python-meh-0.25.2-1.el7.noarch 需要
[root@localhost ~]# yum remove  openssh-clients -y
作为依赖被删除:
  anaconda-core.x86_64 0:21.48.22.121-1.el7.centos    anaconda-gui.x86_64 0:21.48.22.121-1.el7.centos  
  anaconda-tui.x86_64 0:21.48.22.121-1.el7.centos     initial-setup.x86_64 0:0.3.9.40-1.el7.centos      
  initial-setup-gui.x86_64 0:0.3.9.40-1.el7.centos    python-meh.noarch 0:0.25.2-1.el7                  
  python-meh-gui.noarch 0:0.25.2-1.el7                virt-viewer.x86_64 0:5.0-7.el7

参考自:https://blog.csdn.net/diamondxiao/article/details/52488628

一)SSH现象:



二)Linux桌面没了,出现:
系统出现kernel: audit: backlog limit exceeded提示
error: audit:backlog limit exceeded报错,audit缓冲大小瓶颈
来自:http://blog.51cto.com/jschu/1769025

三)如何强制重启?
有时候,linux 由于硬盘或者其它原因,
某个进程挂住了,怎么也杀不死,
输入 reboot 命令也无法重启。
这时候,一般只能按机箱上的reset健来重启了。
如果是远程ssh,那怎么办呢?


下面两行命令可以搞定:


echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
=========================================================
Linux使用shutdown -r now 或者 reboot、init 6 命令无法重启时使用以下两条命令可强制重启:
echo 1 > /proc/sys/kernel/sysrq  
echo b > /proc/sysrq-trigger  
1./proc/sys/kernel/sysrq
向 sysrq 文件中写入1是为了开启 SysRq 功能。根据 linux/Documentations/sysrq.txt 中所说:SysRq 代表的是 Magic System Request Key。开启了这个功能以后,只要内核没有挂掉,它就会响应你要求的任何操作。但是这需要内核支持(CONFIG_MAGIC_SYSRQ 选项)。向 /proc/sys/kernel/sysrq 中写入0是关闭 SysRq 功能,写入1是开启,其他选项请参考 sysrq.txt。

2./proc/sysrq-trigger
立即重新启动计算机:
echo "b" > /proc/sysrq-trigger
立即关闭计算机:
echo "o" > /proc/sysrq-trigger



来自:https://my.oschina.net/dongsong/blog/915358

一)查看根路径下各个文件夹的文件数:
for i in /*; do echo $i; find $i |wc -l|sort -nr; done
二)发现/var的最多,于是再运行命令:
for i in /var/*; do echo $i; find $i |wc -l|sort -nr; done
/var/spool
2428535
三)再次进入:
for i in /var/spool/*; do echo $i; find $i |wc -l|sort -nr; done
/var/spool/postfix
2428437

四)再次深入:
for i in /var/spool/postfix/*; do echo $i; find $i |wc -l|sort -nr; done
/var/spool/postfix/maildrop
2428402

五)估计上面安装了postfiex,检查下:
rpm -qa|grep postfix
postfix-2.6.6-2.2.el6_1.x86_64

六)Google上搜索下原因:
mail没有成功的邮件。由于linux在执行cron时,会将cron执行脚本中的output和warning信息,都会以邮件的形式发送cron所有者, 而我的服务器中关闭了postfix,导致邮件发送不成功,全部小文件堆积在了maildrop目录下面。如果sendmail或者postfix正常运行,则会在/var/mail目录下也会堆积大量的邮件。

七)解决方法:
     1)修改“/etc/crontab” ,将‘MAILTO=root’替换成‘MAILTO=""’修改之后没有成功,需要重启crond服务才可以,也可从在crontab(crontab -e)中最前面直接加入MAILTO=""
     2)find /var/spool/postfix/maildrop -type f -exec rm -rf {} \;

参考:http://www.coooz.com/archives/825
          https://blog.csdn.net/zhangxinrun/article/details/51539587
分页: 9/39 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下页 最后页 [ 显示模式: 摘要 | 列表 ]