CentOS 6 (74)

centos ssh puttygen

我也碰到你这样的情况,我开始是成成pub key文件以后再记事本打开,复制的,不能登陆。不过我后来直接从puttygen的界面上的公匙框里面复制到authorized_keys文件里面,就可以登陆了。
Read more...

sort very large file

LC_ALL=C sort -u --buffer-size=2G --temporary-directory=/root/Desktop/tmp --output=joined_sorted.txt joined.txt uniq joined_sorted.txt joined_sorted_uniqed.txt split bigFileName -l 按行分割 wc -l joined.txt split -l 10000000 joined.txt joined_split_ for f in joined_split_*; do sort -u "$f" > "$f"_sorted done sort -u -m joined_split_*_sorted > final.out
Read more...

strace命令

root@ubuntu:/usr# strace cat /dev/null execve("/bin/cat", ["cat", "/dev/null"], [/* 22 vars */]) = 0 brk(0) = 0xab1000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f29379a7000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) ... brk(0) = 0xab1000 brk(0xad2000) = 0xad2000 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 open("/dev/null", O_RDONLY) = 3 fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0 read(3, "", 32768) = 0 close(3) = 0 close(1) = 0 close(2) = 0 exit_group(0) = ? --- 每一行都是一条系统调用,等号左边是系统调用的函数名及其参数,右边是该调用的返回值。strace 显示这些调用的参数并返回符号形式的值。strace 从内核接收信息,而且不需要以任何特殊的方式来构建内核。 --   -c 统计每一系统调用的所执行的时间,次数和出错的次数等. -d 输出strace关于标准错误的调试信息. -f 跟踪由fork调用所产生的子进程. -ff 如果提供-o…
Read more...

Lexicographically sorting large files in Linux

When I hear the word “sort” my first thought is usually “Hadoop”! Yes, sorting is one thing that Hadoop does well, but if you’re working with large files in Linux the built-in sort command is often all you need. Let’s say you have a large file on a host with 2GB or more of main memory free. The following sort command is a efficient way to lexicographically-order large files. LC_COLLATE=C sort --buffer-size=1G --temporary-directory=./tmp --unique bigfile.txt Let’s break this command down and examine each part in detail.
Read more...

关于”running yum-complete-transaction first” 的提示信息

今天在用yum升级一台新机器时,顾客用ssh远程把server重新启动了。之后,在使用yum 时总是有提示信息: There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.The program yum-complete-transaction is found in the yum-utils package. 意思是,有未完成的yum事务,建议先运行yum-complete-transaction命令清除。 处理步骤: # 安装 yum-complete-transaction yum install yum-utils # 运行 yum-complete-transaction yum-complete-transaction –cleanup-only # 清除可能存在的重复包 package-cleanup –dupes # 清除可能存在的损坏包 package-cleanup –problems
Read more...

ntpq -p输出含义

位置 标志 含义 remote之前 * 响应的NTP服务器和最精确的服务器 + 响应这个查询请求的NTP服务器 blank(空格) 没有响应的NTP服务器 列表上方 remote 响应这个请求的NTP服务器的名称 refid NTP服务器使用的更高一级服务器的名称 st 正在响应请求的NTP服务器的级别 when 上一次成功请求之后到现在的秒数 poll 本地和远程服务器多少时间进行一次同步,单位秒, 在一开始运行NTP的时候这个poll值会比较小,服务器同步的频率大,可以尽快调整到正确的时间范围,之后poll值会逐渐增大,同步的频率也就会相应减小 reach 用来测试能否和服务器连接,是一个八进制值,每成功连接一次它的值就会增加 delay 从本地机发送同步要求到ntp服务器的往返时间 offset 主机通过NTP时钟同步与所同步时间源的时间偏移量,单位为毫秒,offset越接近于0,主机和ntp服务器的时间越接近 jitter 统计了在特定个连续的连接数里offset的分布情况。简单地说这个数值的绝对值越小,主机的时间就越精确
Read more...

awk实例操作学习记录

awk '/^root/ { print }' /etc/passwd 打印以root开头的行 awk是一种编程语言,用于在linux/unix下对文本和数据进行处理。数据可以来自标准输入、一个或多个文件,或其它命令的输出。它支持用户自定义函数和动态正则表达式等先进功能,是linux/unix下的一个强大编程工具。 awk的处理文本和数据的方式是这样的,它逐行扫描文件,从第一行到最后一行,寻找匹配的特定模式的行,并在这些行上进行你想要的操作。如果没有指定处理动作,则把匹配的行显示到标准输出(屏幕),如果没有指定模式,则所有被操作所指定的行都被处理。 例子: 一般语法格式 1.# awk '{ print }' /etc/passwd 或# awk '{ print $0 }' /etc/passwd 马上显示/etc/passwd的内容,其中$0变量表示整个当前行 2.# awk '{ print "william" }' /etc/passwd 或# awk '{ print "" }' /etc/passwd 第一条按照/etc/passwd文件中的行数显示william,第二条则显示空行。 字段 3.# awk -F: '{ print $1 }' /etc/passwd 或# awk -F: '{ print $1 $3 }' /etc/passwd 第一条打印输入文件中每一行中出现的第一个字段,第二条则打印第一和第三字段。其中-F:表示指定“:”作为字段分隔符。 4.# awk -F: '{ print $1 " " $3 }' /etc/passwd # awk -F: '{ print "username: "$1 "\t\tuid: " $3 }' /etc/passwd 例3中输出的结果两个字段之间没有空格,这第一条命令就是加空格,第二条则加了文本标签。 外部脚本 5.# awk -f my.awk /etc/passwd 如果要运行外部的脚本加上-f选项即可,其中my.awk是脚本,/etc/passwd是要操作的文本。 BEGIN和END块 6.BEGIN{ FS=":" 相当于命令行中的-F: } { print $1 } END{…
Read more...

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName解决办法非常简单:#vim /web/apache/conf/httpd.conf (在这里/web/apahce是我安装apache的目录,你默认安装的话应该是/usr/local/apache2/icons)找到#ServerName www.example.com:80 把#去掉,再重启apache即可没事了。现象: bogon:~/webserver/httpd-2.0.59 # /usr/local/apache2/bin/apachectl starthttpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerNamehttpd (pid 20183) already running 這個問題應該是沒有在 /etc/httpd/conf/httpd.conf 中設定 ServerName vi /usr/local/apache2/conf/httpd.conf 最简单的,修改httpd.conf文件,增加:ServerName www.example.com:80我的改为: ServerName www.example.com:80 再次启动就正常了!------------------------------------------------------------------------------------------------------------------------------------------------------------AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this messagehttpd (pid 7907) already running修改:去掉注释即可。# If your host doesn't have a registered DNS name, enter its IP address here.#ServerName www.example.com:8080解决方案:进入apache的安装目录:Windows : D:\Program Files\Apache Software Foundation\Apache2.2\conflinux : /usr/local/apache/conf用记事本打开httpd.conf将里面的#ServerName localhost:80注释去掉即可。再执行httpd然后可以通过浏览器访问http://localhost:80,如果页面显示“It…
Read more...

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php on line 191
Call Stack
#TimeMemoryFunctionLocation
10.0006404896{main}( ).../index.php:0
20.10521322896Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.10521322896Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.41322980224Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.41423004584Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.41553059912Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.41563076968require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.42243143720K2ControllerItemlist->execute( ).../k2.php:64
90.42253143720K2ControllerItemlist->display( ).../BaseController.php:710
100.42863232808K2ControllerItemlist->display( ).../itemlist.php:49
110.42863232808K2ControllerItemlist->display( ).../controller.php:19
120.43063251704Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.43283272440K2ViewItemlist->display( ).../ViewController.php:102
140.60194159832K2ViewItemlist->display( ).../view.html.php:1407
150.60194159832K2ViewItemlist->loadTemplate( ).../HtmlView.php:230
160.60434229952include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php' ).../HtmlView.php:701