ITeye博客

linux

共 62 篇文章

一个命令创建多个目录

可能我太土了,才发现下面这个命令! mkdir -p src/{test,main}/{java,resources}

2013-06-13 12:36 · linux · shell

use "--links" option of rsync

Today I used rsync to copy some files but I found for symbolic links it will ignore them if you just use simple command line: rsync SRC DEST With google, I finally figure out I need to add the "--links" option. --copy-links Turn all symlinks into normal files (leaving no symlinks for any other opti…

2013-05-23 10:45 · linux

Makefile tutorial

Old but good. http://www.codeproject.com/Articles/31488/Makefiles-in-Linux-An-Overview You should also notice the use of special characters (- and @) preceding the commands. As explained before, - tells make to continue processing even an error occurs and @ tells make not to print command before ex…

2013-01-07 14:30 · linux

crontab定期执行命令详解,以及实例

使用时可以参考这个博客: http://blog.51yip.com/linux/1046.html

2012-12-18 17:29 · linux

vim tips

I read some articles about vim tips. Now I write down the ones I have tried successfully here. 在insert模式下,C-R (register) 插入register里的内容,一个有趣的reg是"=". 假设你想输入123K的具体字节数,不用打开计算器,试试这个“ =1024*123 ”, “125952”就出来了! 另外在命令行里C-R C-W和C-R C-A是必用的技巧,它们将光标下的 和 考到命令行里,省了你无数的typing。 %用来匹配块, 如果你的光标在类似() 或者#ifdef #e…

2012-07-04 13:59 · linux

cvs不能更新文件的权限

一个project用到了古老的cvs管理源代码。 一个文件我commit之后发现没有执行权限,于是在自己的working copy改变了文件的mode重新commit,但是发现无法更改cvs repository里面的文件执行权限。 处理办法。。。 要么去cvs里面改,要么去除这个文件,重新添加?

2012-06-28 13:07 · linux

GNU Make Variables: simple and recursive

今天有时间看了一下teammate写的makefile,学习了一下,其中发现定义变量的时候用的是=,有的是:=,查了一下发现真的有学问在里面。 这是一篇讲得很清楚的文章: http://www.electric-cloud.com/blog/2009/03/23/makefile-performance-shell/

2012-04-19 14:17 · linux

How do I find the largest top 10 files in linux?

http://www.cyberciti.biz/faq/how-do-i-find-the-largest-filesdirectories-on-a-linuxunixbsd-filesystem/ To find out largest file only use command ls as follows in current directory: ls -lSh . | head -5 Output: -rw-r–r– 1 vivek vivek 267M 2004-08-04 15:37 WindowsXP-KB835935-SP2-ENU.exe -rw-r–r– 1 vive…

2012-04-06 15:24 · linux

xargs usage with multi arguments

http://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.html I saw this article when I was wondering how to move a lot of files listed in a file to another place. I found xargs is very useful here. cat filename list | xargs -I % mv % newfolder Note that in the article above it mentions usi…

2011-11-30 12:24 · linux

how to explain free buffers and cached memory usage

free -m total used free shared buffers cached Mem: 48269 2424 45845 0 139 1120 -/+ buffers/cache: 1164 47105 Swap: 8197 0 8197 total used free shared buffers cached Mem: A B C D E F -/+ buffers/cache: G H Swap: I J K Note: A=B+C A=G+H G=B-E-F H=C+E+F The display columns mean: total: Your total (phy…

2011-07-18 11:57 · linux

Pro Git Tips

1. git init Create a new repo with exsiting project. 2. git diff This command compares what's in your working directory with what's in your staging area. The result tells what changes have not been staged. 3. git diff --cached Shows what you've stage that will go into your next commit. In Git v1.6 …

2011-07-14 17:53 · linux

"error in locking authority file .Xauthority

今天在windows上vncviewer连linux机器的时候,报这个错误。 解决方案: 删除所有~/.Xauthority文件。

2011-01-11 11:34 · linux

raid 0 vs. raid1

RAID 0 (block-level striping without parity or mirroring ) provides improved performance and additional storage but no redundancy or fault tolerance (making it not true RAID, according to the acronym's definition). However, because of the similarities to RAID (especially the need for a controller t…

2010-12-30 10:20 · linux

hwo to configure linux vncserver

http://bobpeers.com/linux/vnc

2010-12-24 14:10 · linux

set cpu performance mode

A cheap/dirty little hack to increase idle CPU frequency and increase performance in general (don't blame me when your battery runs dry in about 3 hours): (must have root first!) cat /proc/cpuinfo (use this to see cpu speed, you will see at idle its 162.54mhz) adb shell echo "performance" > /sys/de…

2010-11-15 14:38 · linux

Ten Amazing Linux Commands

sudo !! 以 root 帐户执行上一条命令。 python -m SimpleHTTPServer 利用 Python 搭建一个简单的 Web 服务器,可通过 http://$HOSTNAME:8000 访问。 :w !sudo tee % 在 Vim 中无需权限保存编辑的文件。 cd - 更改到上一次访问的目录。 ^foo^bar 将上一条命令中的 foo 替换为 bar,并执行。 cp filename{,.bak} 快速备份或复制文件。 mtr google.com traceroute + ping。 !whatever:p 搜索命令历史,但不执行。 $ssh-copy-id …

2010-11-08 22:42 · linux

awk code

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

2010-10-26 17:53 · linux

Queue sysfs files

Based on kernel version 2.6.34 . Page generated on 2010-05-31 16:02 EST . 1 Queue sysfs files 2 ================= 3 4 This text file will detail the queue files that are located in the sysfs tree 5 for each block device. Note that stacked devices typically do not export 6 any settings, since their …

2010-07-28 13:50 · linux

Install blktrace

I use libaio-0.3.106.tar.gz and blktrace-1.0.1.tar.gz to install blktrace on my linux server. 1. Install libaio make prefix=/usr install 2. Install blktrace make intall See the blktrace user guide in attachment.

2010-07-27 13:15 · linux

awk使用实例

awk使用实例(转载) 2009-08-25 16:41 简介 awk是一种编程语言,非常适合处理文本,使用简单,功能却很强大。awk扫描文件中的每一行,查找与命令行中所给定内容相匹配的模式。如果发现匹配内容,则进行下一个编程步骤。如果找不到匹配内容,则继续处理下一行 示例 基本使用 输出文件的第一列 awk '{print $1}' access_log 使用自定义的分隔符(默认是空格) awk -F ', ' '{print $1}' access_log awk -F '&q=' '{print $2}' access_log 条件判断 awk '$9==304 {print}' ac…

2010-02-09 15:47 · linux