From eb9dda21169ddb96bb94664fa68b15161b862153 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Sep 2019 14:23:47 +0800 Subject: [PATCH] '' --- Linux_man_cn/7z.md | 129 +++++++++++ Linux_man_cn/apt-get.md | 83 ++----- Linux_man_cn/badblocks.md | 166 ++------------ Linux_man_cn/blkid.md | 103 +++------ Linux_man_cn/chgrp.md | 75 +++--- Linux_man_cn/crontab.md | 8 +- Linux_man_cn/curl.md | 8 +- Linux_man_cn/dpkg.md | 1 + Linux_man_cn/ethtool.md | 8 +- Linux_man_cn/fdisk.md | 5 + Linux_man_cn/find.md | 2 +- Linux_man_cn/gdb.md | 471 ++------------------------------------ Linux_man_cn/gpasswd.md | 68 ++---- Linux_man_cn/groupdel.md | 26 +-- Linux_man_cn/groupmod.md | 28 ++- Linux_man_cn/id.md | 82 ++----- Linux_man_cn/iostat.md | 12 +- Linux_man_cn/iperf.md | 467 +++++++++++-------------------------- Linux_man_cn/kill.md | 19 +- Linux_man_cn/ldd.md | 49 +--- Linux_man_cn/lsblk.md | 179 ++++++++------- Linux_man_cn/lshw.md | 34 +++ Linux_man_cn/lspci.md | 1 + Linux_man_cn/mpstat.md | 14 +- Linux_man_cn/mv.md | 30 +-- Linux_man_cn/perf.md | 1 + Linux_man_cn/perl.md | 29 +-- Linux_man_cn/ps.md | 17 ++ Linux_man_cn/pwck.md | 54 ++--- Linux_man_cn/rpm.md | 22 +- Linux_man_cn/sar.md | 8 +- Linux_man_cn/screen.md | 131 +---------- Linux_man_cn/set.md | 58 ++--- Linux_man_cn/su.md | 58 ++--- Linux_man_cn/sysctl.md | 203 +++------------- Linux_man_cn/tar.md | 18 +- Linux_man_cn/top.md | 46 ++-- Linux_man_cn/touch.md | 43 ++-- Linux_man_cn/useradd.md | 28 +-- Linux_man_cn/vmstat.md | 50 ++-- Linux_man_cn/wget.md | 6 +- Linux_man_cn/which.md | 11 +- Linux_man_cn/who.md | 72 +++--- Linux_man_cn/yum.md | 14 +- ls.md | 119 ++++++++++ 45 files changed, 1045 insertions(+), 2011 deletions(-) create mode 100644 Linux_man_cn/7z.md create mode 100644 Linux_man_cn/lshw.md create mode 100644 Linux_man_cn/perf.md create mode 100644 ls.md diff --git a/Linux_man_cn/7z.md b/Linux_man_cn/7z.md new file mode 100644 index 0000000..f3ebe22 --- /dev/null +++ b/Linux_man_cn/7z.md @@ -0,0 +1,129 @@ +# **7z** + +## 选项 + +```markdown +Usage: 7z [...] [...] + [<@listfiles...>] + + + a : Add files to archive + b : Benchmark + d : Delete files from archive + e : Extract files from archive (without using directory names) + h : Calculate hash values for files + i : Show information about supported formats + l : List contents of archive + rn : Rename files in archive + t : Test integrity of archive + u : Update files to archive + x : eXtract files with full paths + + + -- : Stop switches parsing + -ai[r[-|0]]{@listfile|!wildcard} : Include archives + -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives + -ao{a|s|t|u} : set Overwrite mode + -an : disable archive_name field + -bb[0-3] : set output log level + -bd : disable progress indicator + -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line + -bt : show execution time statistics + -i[r[-|0]]{@listfile|!wildcard} : Include filenames + -m{Parameters} : set compression Method + -mmt[N] : set number of CPU threads + -o{Directory} : set Output directory + -p{Password} : set Password + -r[-|0] : Recurse subdirectories + -sa{a|e|s} : set Archive name mode + -scc{UTF-8|WIN|DOS} : set charset for for console input/output + -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files + -scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands + -sdel : delete files after compression + -seml[.] : send archive by email + -sfx[{name}] : Create SFX archive + -si[{name}] : read data from stdin + -slp : set Large Pages mode + -slt : show technical information for l (List) command + -snh : store hard links as links + -snl : store symbolic links as links + -sni : store NT security information + -sns[-] : store NTFS alternate streams + -so : write data to stdout + -spd : disable wildcard matching for file names + -spe : eliminate duplication of root folder for extract command + -spf : use fully qualified file paths + -ssc[-] : set sensitive case mode + -ssw : compress shared files + -stl : set archive timestamp from the most recently modified file + -stm{HexMask} : set CPU thread affinity mask (hexadecimal number) + -stx{Type} : exclude archive type + -t{Type} : Set type of archive + -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options + -v{Size}[b|k|m|g] : Create volumes + -w[{path}] : assign Work directory. Empty path means a temporary directory + -x[r[-|0]]{@listfile|!wildcard} : eXclude filenames + -y : assume Yes on all queries + +p7zip p7zip-plugins +``` + +# 支持的zip格式压缩方法 +* 0 - Store +* 1 - Shrink (decompression only) +* 6 - Implode (decompression only) +* 8 - Deflate +* 9 - Deflate64 +* 12 - BZip2 +* 14 - LZMA +* 95 - xz (decompression only) +* 98 - PPMd +* 99 - WinZip AES + +# 支持的7z格式压缩方法 +| 压缩方法 | 描述 | +| :------: | :------: | +| LZMA | Improved and optimized version of LZ77 algorithm | +| LZMA2 | LZMA-based compression method. It provides better multithreading support than LZMA | +| PPMD | Dmitry Shkarin's PPMdH with small changes | +| BCJ | Converter for 32-bit x86 executables | +| BCJ2 | Converter for 32-bit x86 executables | +| BZip2 | Standard BWT algorithm | +| Deflate | Standard LZ77-based algorithm | + +# 退出码含义 + +| Code | Meaning | +| :------: | :------: | +| 0 | No error | +| 1 | Warning (Non fatal error(s)). For example, one or more files were locked by some other application, so they were not compressed. | +| 2 | Fatal error | +| 7 | Command line error | +| 8 | Not enough memory for operation | +| 255 | User stopped the process | + +## 实例 + +```bash +7z a -r achive.7z /home # 压缩home目录,-r可以省略 +7z e archive.7z -o/home # 解压文件到home目录 +7z x archive.7z # 以完整路径解压文件 +7z u archive.7z *.doc # 更新所有doc文件并压缩到archive压缩包中 +7z d -r archive.7z *.log # 从压缩包删除文件,删除压缩包所有后缀为log文件 +7z l archive.7z # 列出压缩包中文件 +7z t -r archive.7z *.doc # 测试压缩包中的所有doc文件 + +# 7z压缩文件,-t7z可以省略,/root/achive.7z表示将压缩文件放到root目录下,-m0=LZMA2 -mx表示以LZMA2算法等级是9,(0-9),-aoa直 +# 接覆盖现有文件,-mmt多线程(30个线程)加速压缩,-y默认允许所有,-pSECRET表示密码是SECRET,-bb3设置输出日志文件等级(0-3), +# -bsp1将命令输出写入到out.log文件 +7z a -r -t7z /root/achive.7z /home -m0=LZMA2 -mx=9 -aoa -mmt=30 -y -pSECRET -bb3 -bsp1 > out.log + +``` + +## 恢复损坏的7z压缩包 + +错误类型有两种: +* 解压或测试时,提示:数据错误或CRC错误 +* 打开时,提示:文件'a.7z'作为存档无法打开 + + diff --git a/Linux_man_cn/apt-get.md b/Linux_man_cn/apt-get.md index 025c7f7..42e1a42 100644 --- a/Linux_man_cn/apt-get.md +++ b/Linux_man_cn/apt-get.md @@ -2,79 +2,38 @@ ## 说明 -**apt-get命令** 是Debian Linux发行版中的APT软件包管理工具。所有基于Debian的发行都使用这个包管理系统。deb包可以把一个应用的文件包在一起,大体就如同Windows上的安装文件。 +**apt-get命令** 是Debian Linux发行版中的APT软件包管理工具。所有基于Debian的发行都使用这个包管理系统。deb包可以把一个 +应用的文件包在一起,大体就如同Windows上的安装文件 -``` --c:指定配置文件。 -``` - -### 参数 - -* 管理指令:对APT软件包的管理操作; -* 软件包:指定要操纵的软件包。 - -### 实例 +## 选项 -使用apt-get命令的第一步就是引入必需的软件库,Debian的软件库也就是所有Debian软件包的集合,它们存在互联网上的一些公共站点上。把它们的地址加入,apt-get就能搜索到我们想要的软件。/etc/apt/sources.list是存放这些地址列表的配置文件,其格式如下: +```markdown -``` -deb web或[ftp地址] [发行版名字] main/contrib/non-[free] ``` -我们常用的Ubuntu就是一个基于Debian的发行,我们使用apt-get命令获取这个列表,以下是我整理的常用命令: +## 实例 -在修改`/etc/apt/sources.list`或者`/etc/apt/preferences`之后运行该命令。此外您需要定期运行这一命令以确保您的软件包列表是最新的: +```markdown +使用apt-get命令的第一步就是引入必需的软件库,Debian的软件库也就是所有Debian软件包的集合,它们存在互联网上的一些公共 +站点上。把它们的地址加入,apt-get就能搜索到我们想要的软件。/etc/apt/sources.list是存放这些地址列表的配置文件,其格式如下: +deb web或[ftp地址] [发行版名字] main/contrib/non-[free] -``` +修改`/etc/apt/sources.list`或者`/etc/apt/preferences`之后运行该命令。需要定期运行这一命令以确保您的软件包列表是最新的: apt-get update ``` -安装一个新软件包: - -``` -apt-get install packagename -``` - -卸载一个已安装的软件包(保留配置文件): - -``` -apt-get remove packagename -``` - -卸载一个已安装的软件包(删除配置文件): - -``` -apt-get –purge remove packagename -``` - -会把已装或已卸的软件都备份在硬盘上,所以如果需要空间的话,可以让这个命令来删除你已经删掉的软件: - -``` -apt-get autoclean apt -``` - -这个命令会把安装的软件的备份也删除,不过这样不会影响软件的使用的: - -``` -apt-get clean -``` - -更新所有已安装的软件包: - -``` -apt-get upgrade -``` - -将系统升级到新版本: - -``` -apt-get dist-upgrade -``` -定期运行这个命令来清除那些已经卸载的软件包的.deb文件。通过这种方式,您可以释放大量的磁盘空间。如果您的需求十分迫切,可以使用`apt-get clean`以释放更多空间。这个命令会将已安装软件包裹的.deb文件一并删除。大多数情况下您不会再用到这些.debs文件,因此如果您为磁盘空间不足 而感到焦头烂额,这个办法也许值得一试: +```bash +apt-get dist-upgrade # 将系统升级到新版本 -``` +# 卸载软件包,清除残余的配置文件 +apt-get remove --purge -y +apt-get autoremove --purge -y +sudo apt-get clean apt-get autoclean -``` - +dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P +apt-get autoremove # 要删除作为依赖项安装但不再具有父应用程序的软件包 +dpkg --purge --force-remove-essential kernel-image-NNN # 删除旧内核 +dpkg --get-selections | grep PACKAGE_NAME | awk '{ print $1}'| xargs apt-get -y --purge autoremove # 删除专用软件包 +``` diff --git a/Linux_man_cn/badblocks.md b/Linux_man_cn/badblocks.md index 8e5c905..74c407f 100644 --- a/Linux_man_cn/badblocks.md +++ b/Linux_man_cn/badblocks.md @@ -9,150 +9,30 @@ ## 选项 ```markdown --b<区块大小>:指定磁盘的区块大小,单位为字节; --o<输出文件>:将检查的结果写入指定的输出文件; --s:在检查时显示进度; --v:执行时显示详细的信息; --w:在检查时,执行写入测试。 - OPTIONS - -b block-size - Specify the size of blocks in bytes. The default is 1024. - - -c number of blocks - is the number of blocks which are tested at a time. The default is 64. - - -e max bad block count - Specify a maximum number of bad blocks before aborting the test. The default is 0, meaning the test will continue until the - end of the test range is reached. - - -d read delay factor - This parameter, if passed and non-zero, will cause bad blocks to sleep between reads if there were no errors encountered in the - read operation; the delay will be calculated as a percentage of the time it took for the read operation to be performed. In - other words, a value of 100 will cause each read to be delayed by the amount the previous read took, and a value of 200 by - twice the amount. - - -f Normally, badblocks will refuse to do a read/write or a non-destructive test on a device which is mounted, since either can - cause the system to potentially crash and/or damage the filesystem even if it is mounted read-only. This can be overridden - using the -f flag, but should almost never be used --- if you think you're smarter than the badblocks program, you almost cer‐ - tainly aren't. The only time when this option might be safe to use is if the /etc/mtab file is incorrect, and the device - really isn't mounted. - - -i input_file - -e max bad block count - Specify a maximum number of bad blocks before aborting the test. The default is 0, meaning the test will continue until the - end of the test range is reached. - - -d read delay factor - This parameter, if passed and non-zero, will cause bad blocks to sleep between reads if there were no errors encountered in the - read operation; the delay will be calculated as a percentage of the time it took for the read operation to be performed. In - other words, a value of 100 will cause each read to be delayed by the amount the previous read took, and a value of 200 by - twice the amount. - - -f Normally, badblocks will refuse to do a read/write or a non-destructive test on a device which is mounted, since either can - cause the system to potentially crash and/or damage the filesystem even if it is mounted read-only. This can be overridden - using the -f flag, but should almost never be used --- if you think you're smarter than the badblocks program, you almost cer‐ - tainly aren't. The only time when this option might be safe to use is if the /etc/mtab file is incorrect, and the device - really isn't mounted. - - -i input_file - Read a list of already existing known bad blocks. Badblocks will skip testing these blocks since they are known to be bad. If - input_file is specified as "-", the list will be read from the standard input. Blocks listed in this list will be omitted from - the list of new bad blocks produced on the standard output or in the output file. The -b option of dumpe2fs(8) can be used to - retrieve the list of blocks currently marked bad on an existing filesystem, in a format suitable for use with this option. - - -n Use non-destructive read-write mode. By default only a non-destructive read-only test is done. This option must not be com‐ - bined with the -w option, as they are mutually exclusive. - - -o output_file - Write the list of bad blocks to the specified file. Without this option, badblocks displays the list on its standard output. - The format of this file is suitable for use by the -l option in e2fsck(8) or mke2fs(8). - - -p num_passes - Repeat scanning the disk until there are no new blocks discovered in num_passes consecutive scans of the disk. Default is 0, - meaning badblocks will exit after the first pass. - - -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk. Note - that badblocks may do multiple test passes over the disk, in particular if the -p or -w option is requested by the user. - - -t test_pattern - Specify a test pattern to be read (and written) to disk blocks. The test_pattern may either be a numeric value between 0 and - ULONG_MAX-1 inclusive, or the word "random", which specifies that the block should be filled with a random bit pattern. For - read/write (-w) and non-destructive (-n) modes, one or more test patterns may be specified by specifying the -t option for each - test pattern desired. For read-only mode only a single pattern may be specified and it may not be "random". Read-only testing - with a pattern assumes that the specified pattern has previously been written to the disk - if not, large numbers of blocks - will fail verification. If multiple patterns are specified then all blocks will be tested with one pattern before proceeding - to the next pattern. - - -v Verbose mode. Will write the number of read errors, write errors and data- corruptions to stderr. - - -w Use write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on - every block of the device, reading every block and comparing the contents. This option may not be combined with the -n option, - as they are mutually exclusive. - - -B Use buffered I/O and do not use Direct I/O, even if it is available. - - -X Internal flag only to be used by e2fsck(8) and mke2fs(8). It bypasses the exclusive mode in-use device safety check. - - -``` - -### 参数 - -* 磁盘装置:指定要检查的磁盘装置; -* 磁盘区块数:指定磁盘装置的区块总数; -* 启始区块:指定要从哪个区块开始检查。 - -### 实例 - -badblocks以4096的一个block,每一个block检查16次,将结果输出到“hda-badblocks-list”文件里。 - -``` +-b block-size 指定磁盘的区块大小,默认是bytes为单位大小为1024 +-c number of blocks is the number of blocks which are tested at a time. The default is 64 +-e max bad block count 在中止测试之前指定最大数量的坏块。 默认值为0,表示测试将持续到达测试范围结束 +-d read delay factor 如果读取操作中没有遇到错误,则此参数(如果已传递且非零)将导致坏块在读取之间休眠; 延迟将计算 + 为执行读取操作所用时间的百分比。 换句话说,值100将导致每次读取延迟前一次读取所花费的数量,并且 + 值为200的两倍量 +-f +-i input_file +-e max bad block count 在中止测试之前指定最大数量的坏块。 默认值为0,表示测试将持续到达测试范围结束 +-o output_file 将检查的结果写入指定的输出文件 +-p num_passes +-s 在检查时显示进度 + +# 参数 +* 磁盘装置:指定要检查的磁盘装置 +* 磁盘区块数:指定磁盘装置的区块总数 +* 启始区块:指定要从哪个区块开始检查 +``` + +## 实例 + +```bash +# badblocks以4096的一个block,每一个block检查16次,将结果输出到hda-badblocks-list文件里 badblocks -b 4096 -c 16 /dev/hda1 -o hda-badblocks-list -``` - -hda-badblocks-list是个文本文件,内容如下: ``` -cat hda-badblocks-list -51249 -51250 -51251 -51253 -51254 -…… -61245 -…… -``` - -可以针对可疑的区块多做几次操作。下面,badblocks以4096字节为一个“block”,每一个“block”检查1次, 将结果输出到“hda-badblocks-list.1”文件中,由第51000 block开始,到63000 block结束。 - -``` -badblocks -b 4096 -c 1 /dev/hda1 -o hda-badblocks-list.1 63000 51000 -``` - -这次花费的时间比较短,硬盘在指定的情况下在很短的时间就产生“嘎嘎嘎嘎”的响声。由于检查条件的不同,其输出的结果也不完全是相同的。重复几次同样的操作,因条件多少都有些不同,所以结果也有所不同。进行多次操作后,直到产生最后的hda-badblock-list.final文件。 - -### 其他 - - **1、fsck使用badblocks的信息** - -badblocks只会在日志文件中标记出坏道的信息,但若希望在检测磁盘时也能跳过这些坏块不检测,可以使用fsck的-l参数: - -``` -fsck.ext3 -l /tmp/hda-badblock-list.final /dev/hda1 -``` - - **2、在创建文件系统前检测坏道** - -badblocks可以随e2fsck和mke2fs的-c删除一起运行(对ext3文件系统也一样),在创建文件系统前就先检测坏道信息: - -``` -mkfs.ext3 -c /dev/hda1 -``` - -代码表示使用-c在创建文件系统前检查坏道的硬盘。 - -这个操作已经很清楚地告知我们可以采用`mkfs.ext3 -c`选项用`read-only`方式检查硬盘。这个命令会在格式化硬盘时检查硬盘,并标出错误的硬盘“block”。用这个方法格式化硬盘,需要有相当大的耐心,因为命令运行后,会一个个用读的方式检查硬盘。 - - diff --git a/Linux_man_cn/blkid.md b/Linux_man_cn/blkid.md index a00b14e..df51fbc 100644 --- a/Linux_man_cn/blkid.md +++ b/Linux_man_cn/blkid.md @@ -2,91 +2,56 @@ ## 说明 -在Linux下可以使用 **blkid命令** 对查询设备上所采用文件系统类型进行查询。blkid主要用来对系统的块设备(包括交换分区)所使用的文件系统类型、LABEL、UUID等信息进行查询。要使用这个命令必须安装e2fsprogs软件包。 +在Linux下可以使用 **blkid命令** 对查询设备上所采用文件系统类型进行查询。blkid主要用来对系统的块设备(包括交换分区)所使用的文件系统类型、 +LABEL、UUID等信息进行查询。要使用这个命令必须安装e2fsprogs软件包 -### 语法 +## info -``` -blkid -L | -U -blkid [-c ] [-ghlLv] [-o] [-s ][-t ] -[w ] [ ...] -blkid -p [-s ] [-O ] [-S ][-o] ... -blkid -i [-s ] [-o] ... -``` +```markdown +用法: +blkid -L