Linux-monitoring systems and hard disk partitioning and network fundamentals
1. Top
1分钟 5分钟 15分钟 ni nice越高优先级越低
Options
-b:以批处理模式操作; -c:显示完整的治命令; -d:屏幕刷新间隔时间; -I:忽略失效过程; -s:保密模式; -S:累积模式; -i<时间>:设置间隔时间; -u<用户名>:指定用户名; -p<进程号>:指定进程; -n<次数>:循环显示的次数。
Interaction
h:显示帮助画面,给出一些简短的命令总结说明; k:终止一个进程; i:忽略闲置和僵死进程,这是一个开关式命令; q:退出程序; r:重新安排一个进程的优先级别; S:切换到累计模式; s:改变两次刷新之间的延迟时间(单位为s),如果有小数,就换算成ms。输入0值则系统将不断刷新,默认值是5s; f或者F:从当前显示中添加或者删除项目; o或者O:改变显示项目的顺序; l:切换显示平均负载和启动时间信息; m:切换显示内存信息; t:切换显示进程和CPU状态信息; c:切换显示命令名称和完整命令行; M:根据驻留内存大小进行排序; P:根据CPU使用百分比大小进行排序; T:根据时间/累计时间进行排序; w:将当前设置写入~/.toprc文件中。
2. Free
-b:以Byte为单位显示内存使用情况; -k:以KB为单位显示内存使用情况; -m:以MB为单位显示内存使用情况; -o:不显示缓冲区调节列; -s<间隔秒数>:持续观察内存使用状况; -t:显示内存总和列; -V:显示版本信息
The first part of the Mem line explains:
total:内存总数; used:已经使用的内存数; free:空闲的内存数; shared:当前已经废弃不用; buffers Buffer:缓存内存数; cached Page:缓存内存数。
The second part (-/+ Buffers/cache) explains:
(-buffers/cache) used内存数:第一部分Mem行中的 used – buffers – cached
The visible-buffers/cache reflects the memory that is actually eaten by the program, and +buffers/cache reflects the total amount of memory that can be appropriated.
used=buffer+cached+(-buffer/cache)used(-buffer/cache)free=free+buffers+cached
Echo 3>/proc/sys/vm/drop_caches
Uname-a-R
Cat/etc/redhat-release
Df-h Df-i Mount
Ls/dev/zeo DD If=/dev/zero DD If=/dev/zero (OF=/DEV/SDC) of=/a.txt bs=1g count=1
XFS File System
PS aux PS aux | Head-n 3 PS aux | grep MySQL
Top & Background Run
kill-9 PID pkill-9 Process Name
View process Tree Pstree ps-elf display Ppid
3. Hard disk Partitioning
Single disk to do Raid0,raid level recognition hard drive, does not change the drive letter
Ls/dev/ad fdisk-l/DEV/SDA GPT: Disk label type and DOS
Fdisk/dev/add
a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition‘s system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
--
Command (m for help): n Command action e extended p primary partition (1-4) p //建立主分区 Partition number (1-4): 1 //分区号 First cylinder (1-391, default 1): //分区起始位置 Using default value 1 last cylinder or +size or +sizeM or +sizeK (1-391, default 391): 100 //分区结束位置,单位为扇区 Command (m for help): n //再建立一个分区 Command action e extended p primary partition (1-4)p Partition number (1-4): 2 //分区号为2 First cylinder (101-391, default 101): Using default value 101 Last cylinder or +size or +sizeM or +sizeK (101-391, default 391): +200M //分区结束位置,单位为M
Mkfs.sfs/dev/adb1
Extended partition and logical partition a partition can be mounted on a two-path, with Mount View
Umount-l forced uninstallation
MKFS Error occurred
[[email protected] ~]# mkfs -t ext4 /dev/sdb2mke2fs 1.42.9 (28-Dec-2013)mkfs.ext4: inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks, specify higher inode_ratio (-i) or lower inode count (-N).
View/DEV/SDB2 Types
/dev/sdb2 5001216 41943039 18470912 5 Extended
Direct formatting of extended partitions is not allowed, only primary and logical partitions can be formatted;
4. Creating Logical partitions
5. DD Test speed
bs=<字节数>:将ibs(输入)与欧巴桑(输出)设成指定的字节数; cbs=<字节数>:转换时,每次只转换指定的字节数; conv=<关键字>:指定文件转换的方式; count=<区块数>:仅读取指定的区块数; ibs=<字节数>:每次读取的字节数; obs=<字节数>:每次输出的字节数; of=<文件>:输出到文件; seek=<区块数>:一开始输出时,跳过指定的区块数; skip=<区块数>:一开始读取时,跳过指定的区块数;
Example:
[[email protected] text]# dd if=/dev/zero of=sun.txt bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.006107 seconds, 172 MB/s [[email protected] text]# du -sh sun.txt 1.1M sun.txt
The command creates a 1M size file sun.txt, where the parameters are interpreted:
- The IF represents the input file. If you do not specify if, the input is read from the stdin by default.
- The of represents the output file. If you do not specify in, the default is to stdout as the default output
- BS represents the block size for bytes
- Count represents the number of blocks being copied
- /dev/zero is a character device that will constantly return 0 value bytes (.)
6-linux-Disk Network monitoring