随笔分类 -  linux

摘要:我常用的shell命令tar:tar jxvf filename.tar.bz2tar xvf filename.tartar cvf filename.tar filetar cjvf filename.tar.bz2 filewc:ls -l | wc -ltr:ls -l | tr 'a-z' 'A-Z'grep:ls -l | grep ^dls -l | grep -n ^dls -l | grep -v ^decho "theaaaathebbbbthe | grep '\<the\>'echo "th 阅读全文
posted @ 2011-09-15 17:09 酱油哥 阅读(154) 评论(0) 推荐(0)
摘要:今天学到一个命令,用sed将文件中内容按行翻转一下。比如:123翻转之后变成321命令是sed '1!G;h;$!d' filename 如果想将改变直接保存到文本,那命令是sed -i '1!G;h;$!d' filename 阅读全文
posted @ 2011-09-14 18:43 酱油哥 阅读(194) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> int main(void) { fd_set rfds; struct timeval tv; int retval; int rof = open("aa.tt", O_RDONLY); printf( 阅读全文
posted @ 2011-08-23 17:47 酱油哥 阅读(169) 评论(0) 推荐(0)
摘要:研究了两天也没找到个很好的办法, 这里记录一下研究过的办法以及提出一个设想1, inotify-tools + rsync 使用inotify-watch监视文件夹, 有改动即执行rsync 安装使用简单, 满足实时的需要, 但不能双向,性能也是瓶颈2, sersync inotify + rsync, c++ 编写, 配置较多,能满足一些复杂的需求, 如过滤和plugin, 能满足实时的需求,性能也不错(经测试, 一次同步8000个文件没有问题, 而且不管原有多少文件,同步文件的时间比较固定),而且有出错重传机制, 唯一的遗憾是只能单向同步, 因为,它也是监控主服务器上的文件夹有... 阅读全文
posted @ 2011-06-30 16:20 酱油哥 阅读(488) 评论(0) 推荐(0)
摘要:解决方法:gelmjw@voyager:~$ sudo aa-complain /usr/sbin/mysqld[sudo] password for gelmjw:Setting /usr/sbin/mysqld to complain mode.gelmjw@voyager:~$ sudo /etc/init.d/apparmor reloadReloading AppArmor profiles : done.gelmjw@voyager:~$ 阅读全文
posted @ 2010-12-13 13:39 酱油哥 阅读(453) 评论(0) 推荐(0)
摘要:转自http://coolshell.cn/articles/2822.html这里给大家介绍一个小技巧用来恢复一些被rm了的文件中的数据。我们知道,rm命令其实并不是真正的从物理上删除文件内容,只过不把文件的inode回收了,其实文件内容还在硬盘上。所以,如果你不小删除了什么比较重要的程序配置文件的时候,我们完全可以用grep命令在恢复,下面是一个恢复示例:查看源代码打印帮助1grep -a -B 50 -A 60 'some string in the file' /dev/sda1 > results.txt说明:关于grep的-a意为–binary-files=t 阅读全文
posted @ 2010-09-03 10:19 酱油哥 阅读(167) 评论(0) 推荐(0)
摘要:sudo apt-get install poppler-datasudo apt-get install xpdf-chinese-simplified xpdf-chinese-traditional 阅读全文
posted @ 2010-08-29 13:44 酱油哥 阅读(132) 评论(0) 推荐(0)