linux command

来源:互联网 发布:电话骚扰软件 免费 编辑:程序博客网 时间:2024/05/22 02:20
tr -s ' ' '.'  [.replace of ' ' ]


linux tr -s[space] ' ' ' '    [tr means transfer]




cut -d[delimit] ':' -f2     【-f后面跟上几就取第几个】


linux cut -d ':'[separate] -f2






sed 1,2d test.sh [cut 1 to 2 from test.sh]


sed 3,\$d test.sh [cut beginning of 3 to end] the same as above
sed '3,$d' test.sh 


sed [-i] (实行插入动作) 's/oldstring/newstring/g' test.sh  [g]表示global [line process.]




tar -zxvf execute [name.tar]
tar -zcvf difiniteName.jar create [name file1 file2]


tar -xvf difiniteName.tar file1 file2




awk[col processor.]


awk -F ':' '{print$2}'  forexample ["67:89"] display 89;




tipping points
'{}'


forexample
awk '{if ($4 >= 60) print $1" : "$4}' file.txt


tipping points
awk '{$2="red";$3="ljc";print}' tt.txt


forexample
The brown fox jumped on the lazy dog.. quickly.
The red ljc jumped on the lazy dog.. quickly.




/*logic caculate*/


 # awk '{total=$3 + $4 + $5;number= NF - 2; average= total/number;if(NR < 2) printf("%s\t%s\n",$0,"AVERAGE");if(NR >=2) printf("%s\t%3.2f\n",$0,average)}' test.sh




FName LName English Chinese Math AVERAGE        AVERAGE
Kenny Chen 80 80 50 70.00       52.50
Eward Lee 70 90 90 83.33        62.50
Amigo Chu 50 80 80 70.00        52.50
John Smith 90 50 75 71.67`      53.75






rpm -e 包名         【卸载的功能】
rpm -ivh YYYY.rpm   [安装rpm类型的软件]


ls -a 显示以dot开头的隐藏文件


rc.local 文件  启动循序的问题  开机启动(不需要用户登入)JAVA_HOME
profile 文件  总的配置文件
.bashrc 文件 一般单个用户进入后 配置的一些常量 for instance JAVA_HOME




groupadd 组名
useradd -g 组名 username


chown 用户名  文件名


chmod 755 文件名称
chmod u+x 文件名称






如果有这样的文件  file.tar.zip




解压过程
unzip [-d dirname] file.tar.zip
变成 file.tar
tar -zxvf file.tar
才变成 file 目录。




定义环境变量时直接 JAVA_HOME=usr/java_0.12_jre


然后不要忘了  export JAVA_HOME


export 后面可以跟多个 for example JAVA_HOME1 JAVA_HOME2


linux 区别大小写








crontab -e 编写定时器的内容


crontab -r 删除定时器的内容 command


crontab -l 显示定时器的条数。