`
DavyJones2010
  • 浏览: 151830 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Linux: Frequently used command

阅读更多

1. List disk space usage:

df -hl
// "l" means "local", limit listing to local file systems
// "h" means "human-readable", print sizes in human readable format
 du -cks *|sort -rn|head
// recurisive sort file size under current folder

2. Sort file by size:

ls -hlS
// "h": "human-readable", print sizes in human readable format
// "l" : use a long listing format
// "S": sort by file size
// "t" : sort by modification date
// "r" : reverse order while sorting
// "s" : size, with "-l" print size of each file, in blocks

// For file, the output is the size of the file.
// For directory, the output is fixed 4.0K.

3. Delete file by size:

find . -size +10240k -exec rm -rf {} \;

4. Delete file by date:

find . -mtime +5 -exec rm -rf {} \;

5. Overview of CPU, I/O, Memory:

> vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 778576 337756 3527900    0    0     1    21    0    0  1  0 98  1  0

// Processes:
//  r: The number of processes waiting for runtime.
// b: The number of processes in uninterruptible sleep.
// Memory:
// swpd: The amount of virtual memory used.
// free  : The amount of idle memory
// buff  : The amount of memory used as buffers.
// cache: the amout of memory used as cache.
// Disk/Memory Swap:
// si: Amount of memory swapped from disk.
// so: Amount of memory swapped to disk.
// I/O:
// bi: Blocks received from a block device
// bo: Blocks sent to a block device
// System:
// in: The number of interrupts per second, including the clock
// cs: The number of context switches per second
// CPU:
// us: Time spent runnning non-kernel code. (user time)
// sy: Time spent running kernel code. (system time)
// id: Time spent idel.
// wa: Time spent waiting for IO
// st: Time stolen from a virtual machine.

6. Brief overview of system load average

>uptime
03:33:32 up 271 days,  9:44,  1 user,  load average: 0.93, 1.06, 0.99
// 0.93 is the load average for last 1 minute
// 1.06 is the load average for last 5 minutes
// 0.99 is the load average for last 15 minutes
// Command above should usually used combine with command below:

> grep 'model name' /proc/cpuinfo
model name      : Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz
model name      : Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz
// Means our system are 2-core machine.

7. Real time CPU/Memory/Load Average usage monitor:

> top
top - 03:58:40 up 151 days, 18:50,  4 users,  load average: 0.78, 0.67, 0.28
Tasks: 157 total,   1 running, 156 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.0%id,  0.8%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   8174448k total,  4369796k used,  3804652k free,   138580k buffers
Swap:        0k total,        0k used,        0k free,  1491884k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                         
16267 rcastdev  15   0 10888 1104  800 R  0.3  0.0   0:00.01 top                                                             
16769 root      15   0     0    0    0 S  0.3  0.0   0:06.31 pdflush

8. Network statistical info:

> netstat -s
> netstat -pt
// -p: show PID which possess the port number
// t: show TCP protocol only
Proto Recv-Q Send-Q Local Address               Foreign Address             State PID  
tcp    0          0          ***.***:23010            ***.***:43333 ESTABLISHED  123

9. Memory statistical  info:

> free
             total       used       free     shared    buffers     cached
Mem:       8174448    4369228    3805220          0     138664    1492784
-/+ buffers/cache:    2737780    5436668
Swap:            0          0          0

10. SCP:

// SCP local file to remote:
scp {local-file} {username}@{remote-machine}:{remote-dir}
// SCP remote file to local:
scp {username}@{remote-machine}:{remote-file} {local-dir}

 

 

 

 

Reference Links:

1> Load average: http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages

2> SCP: http://www.hypexr.org/linux_scp_help.php

 

分享到:
评论

相关推荐

    Frequently Asked Questions for FreeBSD.pdf

    根据提供的文档信息,我们可以深入探讨FreeBSD操作系统的常见问题及其解答。这不仅涵盖了FreeBSD的基础知识,还涉及了具体的版本信息和技术细节。以下是从给定的文档标题、描述、标签和部分内容中提取的关键知识点。...

    C Programming FAQs: Frequently Asked Questions

    根据提供的文件信息,我们可以归纳出一系列与C编程相关的知识点,主要围绕着《C Programming FAQs: Frequently Asked Questions》这本书以及其在网络上的公开版本。下面将详细解释这些知识点。 ### 知识点一:书籍...

    Linux: Powerful Server Administration

    Linux servers are frequently selected over other server operating systems for their stability, security and flexibility advantages.This Learning Path will teach you how to get up and running with ...

    Verilog_Frequently_Asked_Questions.pdf

    《Verilog常见问题》是一本专注于Verilog语言及其在数字IC设计和FPGA开发领域应用的电子书。本文将根据所给文件内容,深入解析Verilog语言中的一些基础知识点,包括连续赋值与过程赋值的区别、initial和always构造中...

    Verilog:Frequently Asked Questions(英文)

    在上述文件信息中,我们主要关注关于Verilog的常见问题。Verilog是一种硬件描述语言(HDL),广泛用于数字电路设计和电子系统设计的建模、仿真以及测试。文件中提及到的内容主要涉及Verilog的基础知识、任务和函数的...

    Frequently Asked Questions about Today's Cryptography Ver4.1

    ... ...该文档由RSA实验室编撰,于2000年发布。 ...它涉及信息的加密、解密以及相关的安全协议设计等多方面内容。...- **消息认证码(MAC)**:一种使用密钥对消息进行签名的方式,用以确保消息的完整性和真实性。...

    A few frequently used SSL commands

    SSL(Secure Sockets Layer)是网络安全领域中一种广泛使用的协议,用于在互联网上提供安全通信。它通过加密传输数据来保护用户的隐私和信息安全。本文将详细介绍一些常用的与SSL相关的OpenSSL命令,帮助你管理和...

    Frequently used Phrasal Verbs in Daily English(日常英语常用词及短语)

    在日常英语交流中,掌握一些常用的短语动词是至关重要的,它们能够帮助我们更自然、流畅地表达思想。以下是一些常见的短语动词及其用法: 1. **break** - 分解或破裂 - break down:设备故障,不能正常工作;...

    C+programming+FAQs

    C++编程语言是计算机科学中的一个基石,广泛应用于软件开发、系统编程以及游戏制作等领域。这份C++编程常见问题解答(FAQs)旨在为初学者和经验丰富的开发者提供关于C++语言的深入理解和实践指导。...

    Self.Service.Linux.Mastering.the.Art.of.Problem.Determination

    and improve ROI. <br/>Discover proven best practices for diagnosing problems in Linux ...frequently used Linux troubleshooting tool <br/>Use /proc to uncover crucial information about hardware...

    页面置换算法(Linux下运行)

    4) 最不经常使用法(Least Frequently Used) 5) 最近未使用法(No Used Recently) 其中,命中率=1-页面失效次数/页地址流长度。试对上述算法的性能加以较:页面个数和命中率间的关系;同样情况下的命中率...

    Linux-Command-Line.zip_Linux/Unix编程_Unix_Linux_

    Linux Command Line.This book is a beginner’s guide for fast learning Linux commands which are frequently used by Linux administrators or beginners.

    matlab分时代码-Frequently-used-code-blocks:一些常用的代码块

    Frequently-used-code-blocks Some frequently used code blocks. Python project structure for a learning paper Reference: , Self's AnomalyDetection - Dataset(Fold) - 保存和处理真实数据集 - dataset1(Fold)...

    Some-frequently-used-C-code.zip_visual c

    在编程领域,C语言是一种非常基础且强大的编程语言,它被广泛应用于系统编程、嵌入式开发、软件工程等多个方面。Visual C++是微软公司推出的一款集成开发环境(IDE),专门用于编写C和C++代码,它提供了丰富的功能,...

    openssl官方文档离线版(2017.04.03)

    frequently-asked questions (FAQ) https://www.openssl.org/docs/faq.html what standards (RFC's) are implemented https://www.openssl.org/docs/standards.html manual pages的master下的所有内容 ...

    Verilog学习资料.rar

    一共两本资料,其一是Verilog HDL的中文学习资料,讲解的很全面,对初学... Verilog: Frequently Asked Questions),介绍了很多Verilog的使用技巧和实际工程中一些问题的常见解决方案,分析了其利弊,很有用的一本书。

Global site tag (gtag.js) - Google Analytics