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

转载于:https://www.cnblogs.com/zaric/archive/2011/10/20/2218811.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值