Ubuntu 命令记

yudao@ubuntu:~$ sudo cp xx /var/www/tt/
cp: omitting directory `xx'

无法复制目录

Usage: cp [OPTION]... [-T] SOURCE DEST
-R, -r, --recursive copy directories recursively
--remove-destination remove each existing destination file before
attempting to open it (contrast with --force)
--sparse=WHEN control creation of sparse files
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument

yudao@ubuntu:~$ sudo cp -r xx /var/tt/

 top

top动态查看系统负荷

top -n 1

显示后退出

[root@localhost utx86]# top -n 1
top - 14:23:20 up 5:14, 14 users, load average: 0.00, 0.04, 0.01
Tasks: 183 total, 1 running, 181 sleeping, 1 stopped, 0 zombie
Cpu(s): 1.8%us, 1.4%sy, 0.0%ni, 95.8%id, 0.7%wa, 0.1%hi, 0.2%si, 0.0%st
Mem: 2066240k total, 1507316k used, 558924k free, 190472k buffers
Swap: 2031608k total, 88k used, 2031520k free, 1087184k cached

1、获取cpu占用情况

[root@localhost utx86]# top -n 1 |grep Cpu

 

Cpu(s): 1.9%us, 1.3%sy, 0.0%ni, 95.9%id, 0.6%wa, 0.1%hi, 0.2%si, 0.0%st

解释:1.9%us是用户占用cpu情况

1.3%sy,是系统占用cpu情况

得到具体列的值:

[root@localhost utx86]# top -n 1 |grep Cpu | cut -d "," -f 1 | cut -d ":" -f 2
1.9%us
[root@localhost utx86]# top -n 1 |grep Cpu | cut -d "," -f 2
1.3%sy

 

2、获得内存占用情况

[root@localhost utx86]# top -n 1 |grep Mem
Mem: 2066240k total, 1515784k used, 550456k free, 195336k buffers

获得内存情况指定列

[root@localhost c++_zp]# top -n 1 |grep Mem | cut -d "," -f 1 | cut -d ":" -f 2
2066240k total
[root@localhost c++_zp]# top -n 1 |grep Mem | cut -d "," -f 2
1585676k used

posted @ 2011-10-20 12:42  zaric  阅读(260)  评论(0编辑  收藏  举报