unix shell命令

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh          

chsh -s /bin/zsh

编辑 ~/.zshrc

ZSH_THEME = "robbyrussell"

 

 

man  commandxx    查看某个命令的使用说明

权限----------------------

chmod o+wx   testfile  给某个目录权限

chmod 777 README.md  也可用code代替一个权限结合 7最高权限  a-b-c

chown user filelist  ( "change owner")

chgrp group filelist ("change group")

passwd 改密码

cal 显示日历

PS1="[\\u@\\h]:\$PWD>\$" 修改前面提示符

 

ps 显示进程

kill  UID 终止某个进程

ftp  hostname or ip

ping


文件相关-----------------------------------------

cat  显示文件内容                 vi   编辑               wc 显示 总行,总单词,总字母

cp souceA  destB复制文件    rm 删除

目录-----

cd  ~,  cd ~username         mkdir创建目录      mv移动文件夹(也可用于重命名)

 

过滤---------

ls -l | grep -i  "carol.*aug"

sort 排序

几个高级命令   ed, sed, awk, grep 

 

 

shell 编程

不写分号

`expr $a + $b`  表达式应该这样

arr1[0] = 23

if [$a == $b]      *****

逻辑运算 ! -o  -a,关系运算还可以 -eq -gt -ge -le ...

字符串关系运算(单独) = ,!=,-z,-n

文件状态boolean   [ -b $file ]  , -b,-c,-f.....

 

条件语句

  • if...fi statement
  • if...else...fi statement

  • if...elif...else...fi statement

case   http://www.tutorialspoint.com/unix/case-esac-statement.htm

循环语句http://www.tutorialspoint.com/unix/unix-shell-loops.htm

Hello Zara Ali  

ret=$?  #Capture value returnd by last command

unset .f function_name 删除某个函数

 

 

 

 

参考资料

http://www.tutorialspoint.com/unix/unix-processes.htm

git资料

http://git.oschina.net/progit/index.html

 

posted @ 2016-06-15 16:53  三剑客  阅读(676)  评论(0编辑  收藏  举报