-
#[cd ~]或者直接[cd]回到自己的Home目录
-
#[cd –]回到上一次的目录(比如在/home/aa目录用[cd ../bb]切换到/home/bb。然后反复[cd –]就可在/home/aa和/home/bb来回切换)
-
[Jadyer@Jadyer-RHEL63 ~]$ cd /app/code/CucPayTradePortal/
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortal]$ cd /app/software/
-
[Jadyer@Jadyer-RHEL63 software]$ cd -
-
/app/code/CucPayTradePortal
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortal]$ cd -
-
/app/software
-
[Jadyer@Jadyer-RHEL63 software]$ cd ~
-
[Jadyer@Jadyer-RHEL63 ~]$ pwd
-
/home/Jadyer
-
[Jadyer@Jadyer-RHEL63 ~]$ cd ~root
-
bash: cd: /root: 权限不够
-
[Jadyer@Jadyer-RHEL63 ~]$
-
#列出当前目录里最大的10个文件
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ du -s * | sort -n | tail
-
4428 autoRecoverOrder.log.20121114
-
5596 autoRecoverOrder.log.20121120
-
6148 autoRecoverOrder.log.20121121
-
6632 autoRecoverOrder.log.20121113
-
12300 autoRecoverOrder.log.20121122
-
12820 autoRecoverOrder.log
-
40344 autoRecoverOrder.log.20121109
-
60460 autoRecoverOrder.log.20121110
-
113652 nohup.log
-
330348 log_bak
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$
-
#[ls -lhS]查询日志文件的大小,并以大小倒序排序(参数大S用于指定排序)
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ ls -lhS
-
总用量 2.6G
-
-rw-r--r-- 1 wzf develop 2.1G 11月 23 14:44 nohup.log
-
-rw-r--r-- 1 root root 243M 11月 22 23:59 autoRecoverOrder.log.20121122
-
-rw-r--r-- 1 root root 162M 11月 23 14:44 autoRecoverOrder.log
-
-rw-r--r-- 1 root root 45M 11月 23 14:10 netBankResultNotify.log
-
-rw-r--r-- 1 root root 29M 11月 22 23:42 netBankResultNotify.log.20121122
-
-rw-r--r-- 1 root root 6.7M 11月 22 23:54 default.log.20121122
-
-rw-r--r-- 1 root root 2.0M 11月 22 06:50 orderResultNotify.log.20121122
-
-rw-r--r-- 1 root root 1.5M 11月 23 14:43 default.log
-
-rw-r--r-- 1 root root 560K 11月 23 06:20 orderResultNotify.log
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ ls -lh
-
总用量 2.6G
-
-rw-r--r-- 1 root root 162M 11月 23 14:44 autoRecoverOrder.log
-
-rw-r--r-- 1 root root 243M 11月 22 23:59 autoRecoverOrder.log.20121122
-
-rw-r--r-- 1 root root 1.5M 11月 23 14:43 default.log
-
-rw-r--r-- 1 root root 6.7M 11月 22 23:54 default.log.20121122
-
-rw-r--r-- 1 root root 45M 11月 23 14:10 netBankResultNotify.log
-
-rw-r--r-- 1 root root 29M 11月 22 23:42 netBankResultNotify.log.20121122
-
-rw-r--r-- 1 wzf develop 2.1G 11月 23 14:44 nohup.log
-
-rw-r--r-- 1 root root 560K 11月 23 06:20 orderResultNotify.log
-
-rw-r--r-- 1 root root 2.0M 11月 22 06:50 orderResultNotify.log.20121122
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$
-
#[less -p "keyword" logfile]根据指定的关键字查询日志(关键字需用双引号括起来,并注意不要出现'>''-'等特殊字符)
-
#也可以直接使用[less logfile],然后再键入"/keyword"来按照关键字查询日志
-
#当通过keyword找到日志后,就可以使用向上or向下箭头来查看前后的日志,退出日志查看时直接按下Q(大小写均可)键即可
-
#其相比[vi logfile]的优点就是:日志载入查询快,它是读一行解析一行的,而不是一次都载入内存,效率自然高些
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ less -p "无磁无密" default.log
-
[20121121 04:09:52][pool-3-thread-9][NoCardNoPasswordPaymentAction]无磁无密-->检查商户请求参数的有效性,检查结果:[参数有效]
-
[20121121 04:09:52][pool-3-thread-9][NoCardNoPasswordPaymentAction]无磁无密-->对商户的请求参数进行验签,验签结果:[验签通过]
-
[20121121 04:09:52][pool-3-thread-9][NoCardNoPasswordPaymentAction]无磁无密-->发往支付处理的报文[0002831101520600001201211210409520673308396701248842791`tea`中国`GB18030`GDB_CREDIT`MD5`05_YEEPAY_1`]
-
[20121121 04:09:52][pool-3-thread-9][NoCardNoPasswordPaymentAction]无磁无密-->支付处理的响应报文[00015610122502该支付方式只支持信用卡^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
-
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@201210310000121846512012112104093520121031]
-
#另外,补充几个vi的用法
-
#vi一个logfile时,[gg]为定位到日志第一行,[G]为定位到日志最后一行,[/keyword]为向下搜索,[?keyword]为向上搜索
-
#[n]为向前搜索,[N]为向后搜索(注意这里的措辞:就是说当使用[?]时,[n]就是向上搜索。使用[/]时,[n]就是向下搜索)
-
#还有一个[tail]也是比较常用的,用法为[tail -1000f logfile],作用是实时地显示日志的后1000行,达到实时监视的效果
-
#参数[-f]会不停地读取最新的内容,使用[Ctrl+c]可以终止日志显示。至于[cat][more]两个命令就不怎么常用了
-
#统计keyword在日志中的出现次数
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ grep -c "无磁无密" default.log
-
238
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$
-
#[curl ifconfig.me]当你的机器在内网时,可以通过该命令查看其外网的IP
-
[Jadyer@Jadyer-RHEL63 ~]$ curl ifconfig.me
-
61.149.24.203
-
[Jadyer@Jadyer-RHEL63 ~]$
-
#输出最为常用的十条命令,由此甚至可以洞察你是一个什么类型的程序员
-
#另外,可以直接使用[history]查看以往执行过的命令,然后使用[!number]执行指定编号的历史命令
-
[Jadyer@Jadyer-RHEL63 ~]$ history|awk '{CMD[$2]++;count++;} END {for(a in CMD)print CMD[a]" "CMD[a]/count*100 "% " a}'|grep -v "./"|column -c3 -s " " -t|sort -nr|nl|head -n10
-
1 47 20.0855% cd
-
2 38 16.2393% ll
-
3 18 7.69231% pwd
-
4 12 5.12821% vi
-
5 12 5.12821% exit
-
6 12 5.12821% ab
-
7 8 3.4188% halt
-
8 8 3.4188% cat
-
9 7 2.99145% su
-
10 7 2.99145% rm
-
[Jadyer@Jadyer-RHEL63 ~]$ history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rn|head -10
-
47 cd
-
38 ll
-
18 pwd
-
12 vi
-
12 exit
-
12 ab
-
8 halt
-
8 cat
-
7 su
-
7 rm
-
[Jadyer@Jadyer-RHEL63 ~]$
-
#[scp 可选参数 file_source file_target]两个主机间复制文件
-
#举例:将本机文件复制到远程主机的指定目录下
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortal]$ scp startup.sh wzf@192.168.8.24:/app/wzf/code/
-
wzf@192.168.8.24's password:
-
startup.sh 100% 1564 1.5KB/s 00:00
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortal]$
-
#举例:将远程主机文件复制到本机的当前目录下
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortal]$ scp wzf@192.168.8.24:/app/wzf/code/startup_824.sh ./
-
wzf@192.168.8.24's password:
-
startup_824.sh 100% 1564 1.5KB/s 00:00
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortal]$
-
#补充:使用scp也可以在不同主机间复制目录,只要使用[-r]这个可选参数就行了,示例略。
-
#查询指定端口的监听及运行情况
-
#其它的诸如[free][top][df -h][ps -ef|grep java][kill -9 PID][nohup ./startup.sh &]等等就不举例了
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ netstat -tlanop | grep :80
-
tcp 0 0 :::8080 :::* LISTEN 5053/java off (0.00/0/0)
-
tcp 0 0 ::ffff:192.168.8.31:80 :::* LISTEN 17608/java off (0.00/0/0)
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$ lsof -i:80
-
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
-
java 17608 root 163u IPv6 29073040 0t0 TCP bjgg-kfvm-31:http (LISTEN)
-
[Jadyer@Jadyer-RHEL63 CucPayTradePortalLog]$
-
#查看指定年份和月份的日历,及当前时间(使用[cal 2012]则可以直接查看2012的年历)
-
[Jadyer@Jadyer-RHEL63 ~]$ cal 11 2012
-
十一月 2012
-
日 一 二 三 四 五 六
-
1 2 3
-
4 5 6 7 8 9 10
-
11 12 13 14 15 16 17
-
18 19 20 21 22 23 24
-
25 26 27 28 29 30
-
-
[Jadyer@Jadyer-RHEL63 ~]$ date
-
2012年 11月 23日 星期五 14:36:18 CST
-
[Jadyer@Jadyer-RHEL63 ~]$
-
#[man ascii]显示ASCII码表(免去了Google时遇到GWF的烦恼)
-
[Jadyer@Jadyer-RHEL63 ~]$ man ascii
-
DESCRIPTION
-
Oct Dec Hex Char Oct Dec Hex Char
-
------------------------------------------------------------------------
-
000 0 00 NUL '\0' 100 64 40 @
-
001 1 01 SOH (start of heading) 101 65 41 A
-
002 2 02 STX (start of text) 102 66 42 B
-
003 3 03 ETX (end of text) 103 67 43 C
-
004 4 04 EOT (end of transmission) 104 68 44 D
-
005 5 05 ENQ (enquiry) 105 69 45 E
-
006 6 06 ACK (acknowledge) 106 70 46 F
-
007 7 07 BEL '\a' (bell) 107 71 47 G
-
010 8 08 BS '\b' (backspace) 110 72 48 H
-
011 9 09 HT '\t' (horizontal tab) 111 73 49 I
-
012 10 0A LF '\n' (new line) 112 74 4A J
-
013 11 0B VT '\v' (vertical tab) 113 75 4B K
-
014 12 0C FF '\f' (form feed) 114 76 4C L
-
015 13 0D CR '\r' (carriage ret) 115 77 4D M
-
016 14 0E SO (shift out) 116 78 4E N
-
......
-
......
-
......
-
(责任编辑:IT) |