linux & mac
kaqi072821
这个作者很懒,什么都没留下…
展开
-
shell判断文件,目录是否存在或者具有权限
转自 http://blog.chinaunix.net/u/24023/showart_303934.html #!/bin/sh myPath="/var/log/httpd/"myFile="/var /log/httpd/access.log"#这里的-x 参数判断$myPath是否存在并且是否具有可执行权限if [ ! -x "$myPath"]; thenmk...原创 2008-08-18 10:47:20 · 96 阅读 · 0 评论 -
start sublime from terminal on mac
Put this in the profile. If you use fish, put it in ~/.config/fish/config.fish ln /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/st原创 2017-07-19 16:41:58 · 146 阅读 · 0 评论 -
Append path to $PATH in fish shell on mac & linux
The best way I have found to persistently add a path to your $PATH is set-U fish_user_paths $fish_user_paths ~/path/name This prepends to $PATH. And since it's persistent, the path stays in ...原创 2016-11-01 18:11:07 · 171 阅读 · 0 评论 -
Setting environment variables via launchd.conf no longer works in OS X Yosemite/
Create an environment.plist file in ~/Library/LaunchAgents/ with this content:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple...原创 2016-05-11 16:40:40 · 159 阅读 · 0 评论 -
Extend image disk size in KVM
1. Switch to root2. sudo qemu-img resize images/win2008.img +20G3. Start windows vm and go to server manager4. Server Manager->Storage->Diskmanagement5. Extend volume of C with the adde...原创 2015-07-14 11:35:05 · 151 阅读 · 0 评论 -
fish config.fish
vi ~/.config/fish/config.fish原创 2013-09-19 22:02:12 · 531 阅读 · 0 评论 -
Default shell
How do I make fish my default shell?Edit /etc/shells as root, and add the line (if missing):/usr/local/bin/fishThen run:chsh -s /usr/local/bin/fish To change back to bashchsh -s /bin/ba...原创 2013-08-13 15:40:33 · 173 阅读 · 0 评论 -
Setting environment variables in OS X?
stackoverflow.com/questions/135688/setting-environment-variables-in-os-x Bruno is right on track. I've done extensive research and if you want to set variables that are available in all GUI ap...原创 2013-08-13 02:43:14 · 175 阅读 · 0 评论 -
start SimpleHTTPServer with python
python -m SimpleHTTPServer原创 2013-11-06 23:18:58 · 197 阅读 · 0 评论 -
vm中的ubuntu共享主机的文件
http://www.cnblogs.com/liu_xf/archive/2011/02/18/1957579.html 方法一:通过mount来挂载首先在Ubuntu下创建一个文件夹,再到本机上也创建一个文件夹并共享,然后在ubuntu终端,通过mount命令挂接。 如: 本机ip:192.168.1.119 本机共享文...原创 2011-04-07 15:07:58 · 90 阅读 · 0 评论 -
用源码编译安装MYSQL5.5到ubuntu10.10上
http://forum.ubuntu.org.cn/viewtopic.php?t=319886用源码编译安装MYSQL5.5到ubuntu10.10上[手记]鄙人初学乍练,写的不好,大家原谅~今天泡了下午论坛,没找到MYSQL的合适的安装配置教程,只好自己去看官方文档了,着实花了时间,下列是我的操作过程,写出来,希望对大家能有点帮助。下载地址,http://de...原创 2011-04-05 21:36:48 · 109 阅读 · 0 评论 -
ubuntu network config
1. config network:sudo vi /etc/network/interfaces the configuration: auto eth0iface eth0 inet staticaddress 172.16.9.144gateway 172.16.9.254netmask 255.255.255.0network 172.16...原创 2011-03-16 13:04:50 · 681 阅读 · 0 评论 -
shell替换某个目录下文件中的字符串
cd /home/work/dirnamefind ./ -type f -name "*" > filelistwhile read myfdo sed "s#stringa#stringb#g" $myf > temp.txt sed "s#string1#string2#g" temp.txt > temp1.txt ...2009-01-08 20:54:20 · 829 阅读 · 0 评论 -
gcc编译命令
$ gcc -Wall calc.c /usr/lib/libm.a -o calc $ gcc -Wall -I/opt/gdbm-1.8.3/include -L/opt/gdbm-1.8.3/lib dbmain.c -lgdbm2008-12-25 18:08:49 · 207 阅读 · 0 评论 -
iostat 结果解析
2. iostat 结果解析# iostat -xLinux 2.4.21-9.30AX (localhost) 2004年07月14日avg-cpu: %user %nice %sys %idle3.85 0.00 0.95 95.20Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz a...原创 2008-11-19 12:07:30 · 797 阅读 · 0 评论 -
Linux下常用压缩格式的压缩与解压方法
.tar解包: tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)---------------------------------------------.gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz压缩:gzip FileName.tar.gz...原创 2008-10-30 10:29:18 · 109 阅读 · 0 评论 -
linux命令
while ((1)) ;do du -sh * ; sleep 2; done 查看拷贝进度./apachectl stop 关闭apache./apachectl start 起动apachenetstat -ano md5sum -c *.md5 du -sh dirname 查看文件夹大小 tar -czvf bashtimelibtest.tar...2008-10-24 10:31:52 · 83 阅读 · 0 评论 -
linux environment setup
1. set default OS in launchsudo gedit /boot/grub/menu.lstlook for"default 5", set the number to the index of your default OS./boot/grub/grub.cfg "replaces" Grub Legacy's /boot/grub/men...2008-08-19 21:16:18 · 210 阅读 · 0 评论 -
Read write text file in shell
#!/bin/bashcontains() { string="$1" substring="$2" if test "${string#*$substring}" != "$string" then return 0 # $substring is in $string else return 1 ...原创 2017-11-21 22:57:53 · 222 阅读 · 0 评论