ssh连接时清除终端shell乱码方法
当用cat或tail命令显示一个二进制文件后终端可能会变成乱码
解决方法:
1.输入clean命令或按ctrl+L
2.输入reset命令
3.按ctrl+v再按ctrl+o 会出现个^O再按回车
ctrl+v 表示下一输入为特殊字符
ctrl+o 表示^O 切换为原来字符集
参考:
http://www.cyut.edu.tw/~ckhung/b/mi/textmode.php
当用cat或tail命令显示一个二进制文件后终端可能会变成乱码
解决方法:
1.输入clean命令或按ctrl+L
2.输入reset命令
3.按ctrl+v再按ctrl+o 会出现个^O再按回车
ctrl+v 表示下一输入为特殊字符
ctrl+o 表示^O 切换为原来字符集
参考:
http://www.cyut.edu.tw/~ckhung/b/mi/textmode.php
RT
*/30 * * * * /usr/sbin/ntpdate ntp.api.bz >/dev/null
crontab半小时同步一次时间
原日文网址:http://www.seya.org/mt/archives/2003/10/31_webdav2.html
1、下载相关文件并解压
WebDAV Resources JP有Apache2对应的mod_encoding的最新版本下载
# wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
# wget http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
# tar zxfv mod_encoding-20021209.tar.gz
# cp mod_encoding.c.apache2.20020616 mod_encoding-20021209/mod_encoding.c
2、iconv_hook编译和安装
安装mod_encoding前首先需要安装iconv_hook。
$ cd mod_encoding-20021209/lib
$ ./configure
$ make
# make install
完成上面操作后,iconv_hook相关so文件放到/usr/local/lib下面。
打开/etc/ld.so.conf文件,添加一行指向iconv_book的所在路径,即”/usr/local/lib”
# vi /etc/ld.so.conf
添加/usr/local/lib
# ldconfig
3、 mod_encoding模块的编译
进入mod_encoding-20021209.tar.gz的解压目录,即mod_encoding-20021209
–with-iconv-hook[=DIR] use iconv.h from iconv_hook in DIR
(default is /usr/local/include/iconv_hook)
# ./configure –with-apxs=/usr/sbin/apxs –with-iconv-hook=/usr/local/include
# make
我在执行make命令编译时,会报如下错误:
/usr/local/apache2/bin/apxs -c -I/usr/local/include -liconv_hook mod_encoding.c
/usr/local/apache2/build/libtool –silent –mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/include -c [...]
What is the /proc/kcore?
Trick
/proc/kcore is the Server memory. You aren’t going to save any disk space by trying to remove it.
It is the ‘image’ file for all your memory; this actually contains the data and information that is currently in your physical RAM.
/proc/kcore is an image of the RAM of the Server. The entire [...]
以cwrsync为例,软件安装完毕后,启动Windows操作系统的命令窗口,在安装目录(比如C:\Program Files\cwRsync\bin)下运行rsync是ok的,但是在其他任意目录下运行rsync就会报错,如下图
这意味着我们还不能使用rsync命令,这是因为:虽然我们以经安装了cwrsync,而安装目录下也包含了rsync这个命令,但计算机不知道去哪里去找这两个命令。但是我们如果说进入到cwrsync的安装目录下的bin目录,再依次运行rsync命令,又是可以正常运行的。 计算机是如何查找命令的呢?Windows操作系统根据Path环境变量来查找命令。 Path环境变量的值是一系列路径,Windows操作系统会在这一系列的路径中查找命令。注意:在Windows操作系统里是不区分大小写的,而在Linux系统里,我们应该设置PATH环境变量。
在Windows平台上设置环境变量如果下图:
我的电脑->属性->高级->环境变量->系统变量中添加环境变量
对于Windows系统而言,名为Path的环境变量以经存,可以直修改该环境变量,在该环境变量值后面追加C:\Program Files\cwRsync\bin。然后新开一个命令窗口,运行path看看新加的环境变量是否存在了。
再在任何目录下运行rsync命令就都ok了
一般建议在用户变量里,去添加环境变量 。
用户变量与系统变量的区别:用户变量和系统变量并没有什么太大的区别,只是用户变量只对当前用户有效,而系统变量对所有用户有效。不过,系统变量会排在用户变量前面,如果说,两个地方都包含了rsync命令,则优先执行Path系统变量路径里包含的rsync命令。
linux 与 windows 文件传输:rz/sz
ZModem is a full-duplex file transfer protocol that supports fast data transfer rates and effective error detection. ZModem is very user friendly, allowing either the sending or receiving party to initiate a file transfer. ZModem supports multiple file (”batch”) transfers, and allows the use of wildcards when specifying filenames. ZModem also supports [...]
隐藏shell光标的主要方法是产生有效的转义系列,方法如下:
echo ^[[?25l
请注意这个转义系列的敲法是,<ctrl+v><escape>[?25l(是字母l不是数字1)
先同是按下<ctrl> 和 v ,松开后然后按<escape>,就会出现^[ ,再输入[?25l
要使光标恢复则
echo ^[[?25h
注:这些字符一定要手敲,不要粘贴!
sendmail发附件需要用uuencode命令这个命令在sharutils组件中,可以远程安装
apt-get install sharutils
yum install sharutils
也可以用rpm安装,可以去安装光盘里找。如我的redhat 5.2 x_86_64系统,rpm包:sharutils-4.6.1-2.x86_64.rpm
安装后有uuencode命令
开启sendmail服务
#/etc/rc.d/init.d/sendmail start
现在就可以发送附件了
uuencode /root/tmp.tar tmp.tar | mail -s “tmp.tar” xxx@email.com
注:如上发送时如果加上邮件内容
uuencode /root/tmp.tar tmp.tar | mail -s “tmp.tar” xxx@email.com EOF
如此发送的话,邮件内容将会覆盖掉附件。
shmmax内核参数定义单个共享内存段的最大值,即单个进程的最大内存使用量,如果该参数设置小于某些进程的设置,那么就会被分配多个共享内存段。这在繁忙的系统中可能成为性能负担,带来系统问题。32位CPU的寻址空间是4G,32位机器shmmax一般不能超过4G
老版本CentOS、Redhat的shmmax默认值为33554432字节(33554432bytes/1024/1024=32MB)。现在新版本是
[root@localhost ~]# cat /proc/sys/kernel/shmmax
4294967295
长久修改shmmax的值:
vi /etc/sysctl.conf 编辑这个文件,在最后一行加入
kernel shmmax = 807374182
然后执行以下命令使配置生效:
/sbin/sysctl -p
临时更改该值:
echo 字节数 > /proc/sys/kernel/shmmax
按照以上方法更改,在每次重启系统时,该值会被自动还原。如果想永久更改,可以修改/etc/sysctl.conf文件,设置:
kernel.shmmax = 字节数
注:vi /etc/sysctl.conf 编辑这个文件,在最后一行加入
kernel shmmax = 807374182
重启生效.
Problem:
The kernel repeatedly prints errors messages similar to the following:
EDAC i5000 MC0: NON-FATAL Errors found!!! 1st NON-FATAL Err Reg= 0×40000
EDAC i5000: SPD Protocol Error, Bits= 0×40000
Description:
This is caused by the optional IPMI card and the i5000_edac kernel module trying to access the platforms EDAC (Error Detection and Correction) information at the same time.
Solution:
The workaround for [...]