Code
Here document, another way to write multiline into one file
Besides of opening a file using vim and emacs, there is another single way to write some characters into one file. (more…)
Unix (all-caps UNIX for the trademark) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, developed in the 1970s at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.
Besides of opening a file using vim and emacs, there is another single way to write some characters into one file. (more…)
Docker is a lightweight virtual machine container. To minimize the image, most of the official distributions were erased most the unnecessary system tools. (more…)
我们通常编辑 /etc/fstab
来确定启动时候挂载的硬盘, swap 等. 若文件内容有误, 重启后的效果就是直接挂了, 然后必须通过安全模式或者单用户模式进去修改, 这很麻烦.
可否不重启就检查下 fstab 呢? 答案是可以的. (more…)
freebsd 下摆弄启动参数,不小心把 /etc/rc.conf 改错了,怎么办? 每次登录都启动直接执行rc中的内容,然后就跑飞了,这个怎么整是好.
启动后首先使用single mode,可以进入文件系统. 但是直接修改是不行的,它说是readonly file system,需要挂载下才行. (more…)
一般情况下,我们用rsync可以很容易的同步一个远程目录.
$ rsync -avzh --progress --delete \ name@remote_host:source_dir target_dir
这样就把远程的一个目录同步回来了.
但是现在问题来了,当 port 为非标准的 22 端口时, 我们应该怎样加参数呢?比如有时候我们会 NAT 到 2222 端口.
使用到mongo,redis等数据库的时候,往往会遇到这样一个坑。某mongo跑着跑着突然没了,某redis启动先给个warning,仔细一看log说最大文件打开数不够..
# You requested maxclients of 10000 requiring at least 10032 # max file descriptors. # Redis can't set maximum open files to 10032 because of OS error: # Operation not permitted. # Current maximum open files is 1024. # maxclients has been reduced to 4064 # to compensate for low ulimit. # If you need higher maxclients increase 'ulimit -n'.
locate是一个系统命令,用于建立文件索引,当我们需要寻找什么文件的时候,只要敲入
locate xxx
它就会搜索全系统中匹配这个名字的文件。 但是在某个新的机器里面,我locate某文件,始终显示如下的错误信息:
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
前天,也就是7月8号,YUM,全称Yellowdog Updater, Modified的开发者, Seth Vidal 遇到车祸去世.当时是一个黑夜,一个汽车司机在躲避另外一场车祸的时候,撞到了Seth Vidal的自行车上,那个汽车司机随后逃逸.在送往医院后,Seth Vidal伤重不治,死在了医院.[1][2]. (more…)
statfs是一个很有用的linux库函数。在它的帮助下,我们可以很容易得到硬盘信息啥的。 以前全是调用command命令,弱爆了。如果用 man 2 statfs 命令可以得到很多其使用方法。本post就简单写个demo表示下存在感 (more…)
我理解中,.so文件就相当于windows下的.dll文件。 环境不一样,感觉就不一样。 windows下的.dll文件虽然做了好些,但是怎么用makefile写还是不怎么了解。到了linux下更是完全扯着蛋了。
随便写了个so文件的sample。如有误,看官请指出。 (more…)