
Unix/Linux
nomad2
<a href="http://www.fi
展开
-
logrotate 里面应该使用copytruncate
1. 参考http://unix.stackexchange.com/questions/33447/why-we-should-use-create-and-copytruncate-together原创 2014-05-13 02:45:30 · 7391 阅读 · 1 评论 -
Linux下推荐应用程序列表
from: http://www.lcy.name/?p=291* 特殊软件:windows下访问ext2fs, ext3fs: http://www.ext2fs-anywhere.com/http://fs-driver.org/修复分区表:Disk Genius(原名DiskMan), diskfix分区大小调整:parted,gparted(分区大小无损转载 2012-02-21 21:34:52 · 759 阅读 · 0 评论 -
python spark
http://pages.cpsc.ucalgary.ca/~aycock/spark/Spark 是一种用Python 编写的强大的、通用的解析器/编译器框架, see https://www.ibm.com/developerworks/cn/linux/sdk/python/charm-27/原创 2012-02-12 11:58:36 · 2187 阅读 · 0 评论 -
sed1line中文版
from: http://www.chinaunix.net/jh/24/723012.html------------------------------------------------------------------------- SED单行脚本快速参考(Unix 流编辑器) 2005年12月29日 英文标题:USEFUL ONE-LINE SCRIPTS FOR SE转载 2012-02-10 18:53:59 · 1400 阅读 · 0 评论 -
python file operation
和c语言一样,不能使用'rw'方式打开一个文件并进行读写,正确的方式是‘r+’,详见http://mail.python.org/pipermail/python-bugs-list/2001-May/005216.htmlBugs item #420771, was updated on 2001-05-02 10:11You can respond by visiting:原创 2012-01-01 11:32:54 · 1808 阅读 · 0 评论 -
cygwin 安装 python setuptools
see http://serverfault.com/questions/7282/how-to-run-easy-install-in-cygwin$ wget http://peak.telecommunity.com/dist/ez_setup.py$ python ez_setup.py原创 2012-01-30 21:20:29 · 2663 阅读 · 0 评论 -
perl 字符串数组,如何输出带引号的数组元素
from: http://stackoverflow.com/questions/739214/how-do-i-output-each-perl-array-element-surrounded-in-quotes例如:/home/a/j/nomad2:cat 1#!/usr/bin/perlmy @strArray = ("abc", "bcd");my $text = do原创 2011-11-05 17:36:21 · 2368 阅读 · 0 评论 -
理解Linux的性能
http://www.linuxfly.org/post/114/项目中常遇到需要对目前运行的系统进行效率分析,或碰到客户咨询如何优化系统的效率问题。更多的情况是,在系统出现问题的时候,需要分析原因,定位系统故障或瓶颈,当然,最好是可以一并解决故障。但实际上,操作系统优化是一个非常复杂的问题,况且linux有自己一套有别于其他操作系统管理的机制,由此会引起很多不必要的误解和麻烦。自问我转载 2011-10-21 19:32:02 · 586 阅读 · 0 评论 -
Linux Event Logging
参考《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 8syslogd/home/a/j/nomad2:ps -ef |grep klogdroot 4364 1 0 07:12原创 2011-10-06 20:01:33 · 924 阅读 · 2 评论 -
诊断系统错误信息
参考《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 7The Oops message is one way the kernel can show you that one of原创 2011-10-05 22:49:34 · 744 阅读 · 0 评论 -
nginx
from : http://wiki.nginx.org/ChsNginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器 。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的Ramb原创 2011-10-15 17:16:34 · 555 阅读 · 0 评论 -
查看进程资源
参考《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 61. The wchan option is the most interesting option for finding t原创 2011-10-04 14:06:54 · 1133 阅读 · 0 评论 -
查看Linux系统信息
《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 5/proc目录:Process-Specific SubdirectoriesEach process原创 2011-10-03 20:41:12 · 634 阅读 · 0 评论 -
linux下SAR命令的用法
from: http://space.itpub.net/24435147/viewspace-694224dmesg可以直接查看cpu的主频,要查看CPU、内存的使用情况可以使用sar!sar 命令行的常用格式:sar [options] [-A] [-转载 2011-10-12 20:44:59 · 1639 阅读 · 0 评论 -
oprofile: a System-Wide Profiler
参考《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 10oprofile is a low-overhead, system-wide profiler for Linux that原创 2011-10-12 20:43:01 · 706 阅读 · 0 评论 -
Ubuntu 命令技巧
from : http://wiki.ubuntu.org.cn/UbuntuSkills目录[隐藏]1 前言2 安装升级 2.1 查看软件xxx安装内容2.2 查找软件库中的软件2.3 显示系统安装包的统计信息2.4 显示系统全部可用包的名称转载 2011-10-12 20:48:07 · 1969 阅读 · 0 评论 -
4种内存管理调试工具
参考:《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 41. memwatch2. yamd3. electric fence4. valgrind 因为unix-c原创 2011-10-02 22:04:19 · 789 阅读 · 0 评论 -
使用gcov提高代码测试覆盖率
参考:《Linux® Debugging and Performance Tuning: Tips and Techniques》 chapter 21. 待测代码如下:/home/a/j/nomad2:cat sample.c#include #include原创 2011-09-25 10:44:49 · 3193 阅读 · 0 评论 -
Avoiding tar's (or any other commandline's) argument list too long error
1. from: http://snippets.dzone.com/posts/show/2803使用--files-from 选项2. 可以使用-r追加tar文件3. -X 指定排除的文件转载 2012-02-20 21:53:33 · 514 阅读 · 0 评论 -
linux cpu affinity demo
from: http://blog.youkuaiyun.com/chenji001/article/details/5546396参考: http://www.ibm.com/developerworks/cn/linux/l-affinity.html http://www.ibm.com/developerworks/linux/library/l-affinity/index.html转载 2012-03-06 21:31:22 · 619 阅读 · 0 评论 -
Perl associative array (hash) and array
refer to : http://www.thegeekstuff.com/2011/09/perl-complex-data-structures/ and http://www.perlmonks.org/?node_id=1978Perl developers should understand how to use complex data structures effect原创 2012-03-31 18:52:01 · 957 阅读 · 0 评论 -
程序员的自我修养 ch7 动态链接
1. DSO,Dynamic Shared Objects[serverate: /local/root/c/ch7 ]>> cat lib.h#ifndef LIB_H#define LIB_Hvoid foo(int i);#endif[serverate: /local/root/c/ch7 ]>> cat lib.c#include void fun(int i)原创 2013-06-30 07:29:11 · 1177 阅读 · 0 评论 -
RPM Command: 15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
RPM command is used for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Linux system.RPM stands for Red Hat Package Manager.With root privilege, you c转载 2013-05-31 20:50:58 · 1260 阅读 · 0 评论 -
软件级负载均衡器(LVS/HAProxy/Nginx)的特点简介和对比
From: http://andrewyu.blog.51cto.com/1604432/697466现在网站发展的趋势对网络负载均衡的使用是随着网站规模的提升根据不同的阶段来使用不同的技术:一种是通过硬件来进行进行,常见的硬件有比较昂贵的NetScaler、F5、Radware和Array等商用的负载均衡器,它的优点就是有专业的维护团队来对这些服务进行维护、缺点就是花销太大,所以转载 2013-05-31 20:45:13 · 669 阅读 · 0 评论 -
memcached hash算法
From: http://stackoverflow.com/questions/10434375/what-hashing-algorithm-does-memcached-use-to-hash-keysQuestion:Memcached uses distributed consistent hashing to choose which server to put a key o原创 2013-05-31 20:42:44 · 1158 阅读 · 0 评论 -
Understanding SCSI, ATA, SAS and SATA
From: http://www.webopedia.com/DidYouKnow/Computer_Science/2007/sas_sata.aspThe Differences Between Parallel and Serial InterfacesFor years the parallel interface has been wide转载 2013-05-31 20:40:29 · 1193 阅读 · 0 评论 -
Getting The Hang Of IOPS v1.3
From: http://www.symantec.com/connect/articles/getting-hang-iops-v13In today's enterprise, application administrators are increasingly required to be IT generalists with knowledge spanning f转载 2013-05-31 20:37:26 · 1002 阅读 · 0 评论 -
关于SSH的一些总结
1. 查看sshd的版本root # rpm -qf /usr/sbin/sshdopenssh-server-4.3p2-82.el5root # rpm -qi openssh-server-4.3p2-82.el5Name : openssh-server Relocations: (not relocatable)Version原创 2013-05-31 20:32:28 · 6265 阅读 · 0 评论 -
程序员的自我修养 ch6 可执行文件的装载与进程
参考《程序员的自我修养》ch61. MMUMMU是Memory Management Unit的缩写,中文名是内存管理单元,它是中央处理器(CPU)中用来管理虚拟存储器、物理存储器的控制线路,同时也负责虚拟地址映射为物理地址,以及提供硬件机制的内存访问授权。在ELF中把这些属性相似的,又连在一起的段叫做一个“segment”,而系统正是按照“segment”而不是“section”原创 2013-02-03 14:40:00 · 2579 阅读 · 0 评论 -
程序员的自我修养 ch4 静态链接
参考《程序员的自我修养》ch4.1. 空间与地址分配这里的空间分配只关注于虚拟地址空间的分配现在的链接器空间分配基本上都采用 相同类型合并 的策略,使用这种方法的链接器一般采用一种叫 两步链接(Two-pass Linking) 的方法。 也就是说整个过程分两步:第一步 空间与地址分配;第二步 符号解析与重定位,这一步是链接的核心,特别是重定位;>> ld a.o b.原创 2013-01-13 15:59:29 · 2516 阅读 · 0 评论 -
程序员的自我修养 ch3 目标文件
参考《程序员的自我修养》ch31. 目标文件的种类>> file hello.ohello.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped>> file /bin/ls/bin/ls: ELF 32-bit LSB executable, Intel 80386, vers原创 2013-01-04 21:08:30 · 1466 阅读 · 0 评论 -
buffer vs. cache
In order to make clear about the difference between “buffers and cached” from the ‘top’ result, here are the operations and observations, the server is of about 50G memory.1. cat /dev/vg00/lv原创 2013-01-03 20:23:07 · 611 阅读 · 0 评论 -
Linux top command illustration
1. 关于CPU的wa, si, hi, 理想系统的wa应该为0%, si, hi 应小于5%.wa高说明系统等待IO的时间长,例如:http://hi.baidu.com/higkoo/item/70600834426247483075a1df 2. 关于block和cache的区别和联系,下面是几个小实验的测试结果,测试机器内存约50G。1. cat /dev原创 2012-11-25 15:43:36 · 898 阅读 · 0 评论 -
Memory Layout And The Stack
From: http://www.dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.phpUsing GNU's GDB DebuggerMemory Layout And The StackBy Peter Jay SalzmanPrevious: IntroductionNext: Debugging转载 2012-11-25 15:45:23 · 1315 阅读 · 0 评论 -
Linux Debugging 7 - Stack and Heap
1. 进程空间布局对于32位机器来说,kernel占用了0xC0000000以及更高的地址,代码装载到0x08048000,数据段和BSS在代码段上面,栈从0xBFFFFFFF开始往下,堆的位置不确定,共享对象在最下面。可以查看进程的maps来看,下面是64位机器的例子,/home/a/j/nomad2:cat /proc/16683/maps 00400000-004be0原创 2010-12-12 19:52:00 · 1408 阅读 · 0 评论 -
Linux I/O scheduler
from: http://www.redhat.com/magazine/008jun05/features/schedulers/4种调度方法:Completely Fair Queuing—elevator=cfq (default)Deadline—elevator=deadlineNOOP—elevator=noopAnticipatory—elevator=as转载 2012-06-17 15:46:06 · 630 阅读 · 0 评论 -
使用vim/sed去除网上copy的源代码行号和空格
from http://imzc.net/archives/122有些时候,在网上搜索到的代码都包含有行号,高亮显示控件不支持直接提取,如: test.sh 01 #!/bin/bash 02 echo “aaa”简单的去掉行号和前面的空格:转载 2011-09-24 10:19:13 · 1536 阅读 · 0 评论 -
gcc Option Needed for gprof
来自 《Linux® Debugging and Performance Tuning: Tips and Techniques》ch1重点如下:1) 编译时 使用 -pg 产生profile gmon.out2) gprof -b a.out3) 编译时使原创 2011-09-24 10:47:01 · 959 阅读 · 0 评论 -
vmstat 查看虚拟内存
# vmstat -a -S Mprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free inact active si so bi bo in cs us sy id wa st 2 0 1076原创 2011-06-23 15:24:00 · 1137 阅读 · 0 评论 -
Linux Debugging 1 - Kernel Introduction
kernel introduction, scheduler, CFS原创 2010-12-10 21:07:00 · 1074 阅读 · 0 评论