├── .github └── stale.yml ├── .readthedocs.yaml ├── LICENSE ├── README.md ├── docs ├── access │ ├── imgs │ │ └── file-permission │ │ │ ├── chmod_mode.png │ │ │ ├── chmod_operator.png │ │ │ ├── chmod_reference.png │ │ │ └── octal-mode.png │ ├── sudo使用.md │ ├── 分区和文件系统.md │ ├── 文件权限.md │ ├── 本地用户信息.md │ ├── 本地组信息.md │ ├── 用户密码.md │ ├── 用户权限调整.md │ ├── 用户查询-创建和删除.md │ ├── 目录权限.md │ ├── 组权限调整.md │ └── 组查询-创建和删除.md ├── configure │ ├── [Docker][Ubuntu 18.04]g++安装失败.md │ ├── [Linux]LVM配置.md │ ├── [Thinkpad T470p][Ubuntu 16.04]双显卡配置.md │ ├── [Thinkpad T470p]安装Ubuntu 16.04单系统及Nvidia显卡驱动安装.md │ ├── [Ubuntu 16.04]Cuda和Cudnn安装.md │ ├── [Ubuntu 16.04]Thunderbird邮箱配置.md │ ├── [Ubuntu 16.04]VMware安装.md │ ├── [Ubuntu 16.04]开放热点.md │ ├── [Ubuntu 16.04]桌面美化.md │ ├── [Ubuntu 18.04]PPA方式安装Nvidia驱动.md │ ├── [Ubuntu 18.04]VMware安装.md │ ├── [Ubuntu 18.04]桌面美化.md │ ├── apt-升级操作.md │ ├── imgs │ │ ├── 16.04-desktop │ │ │ ├── profile.png │ │ │ └── unity-tweak-tool.png │ │ ├── 163-password.png │ │ ├── 18.04-desktop │ │ │ ├── appearance.png │ │ │ ├── icons.png │ │ │ ├── panel-configure.png │ │ │ ├── panel.png │ │ │ └── theme.png │ │ ├── Wi-Fi.png │ │ ├── existing-email.png │ │ ├── hotspot-info.png │ │ ├── imap.png │ │ ├── network-connections.png │ │ ├── open-hotspot.png │ │ ├── preferences.png │ │ ├── profiles.png │ │ ├── scrolling.png │ │ ├── system-email.png │ │ ├── system-monitor-process.png │ │ ├── type-wifi.png │ │ ├── wifi-ipv4.png │ │ └── wifi-security.png │ ├── locale-字符集设置.md │ ├── localtime-设置时区.md │ ├── troubleshooting.md │ ├── ubuntu-DEBIAN_FRONTEND.md │ ├── ubuntu-中文乱码.md │ ├── wps-中文字体.md │ ├── 切换home目录到新硬盘.md │ ├── 删除陈旧的APT仓库.md │ ├── 制作桌面启动器.md │ ├── 应用查询-安装-卸载-清理.md │ ├── 快捷键-复制和粘贴.md │ ├── 扩容boot分区.md │ ├── 扩展命令行窗口滚动行数.md │ ├── 更换国内源.md │ ├── 查询阻塞进程并杀死.md │ └── 系统备份.md ├── index.md ├── operation │ ├── 复制大量小文件.md │ ├── 对目录下的每一个文件夹单独打包.md │ └── 格式化移动硬盘.md ├── requirements.txt ├── shell │ ├── dash-bash.md │ ├── imgs │ │ ├── arithmetic-operator.png │ │ ├── bool-operator.png │ │ ├── file-operator.png │ │ ├── logic-operator.png │ │ ├── redirect.png │ │ ├── relational-operator.png │ │ ├── special-symbol.png │ │ └── string-operator.png │ ├── set.md │ ├── troubleshooting.md │ ├── 函数.md │ ├── 参数传递.md │ ├── 变量.md │ ├── 基本运算符.md │ ├── 字符串.md │ ├── 条件表达式.md │ ├── 流程控制.md │ └── 输入和输出重定向.md └── tool │ ├── 7zip.md │ ├── alias.md │ ├── apache-ant.md │ ├── aria2.md │ ├── cmake.md │ ├── cp.md │ ├── curl.md │ ├── eog.md │ ├── free.md │ ├── grep-sed.md │ ├── grep.md │ ├── imgs │ ├── cmake-gui.png │ ├── desktop-location.png │ ├── free.gif │ ├── gnome-desktop.png │ ├── note.png │ ├── watch-free-diff.gif │ ├── watch-free-no-header.gif │ └── watch-free.gif │ ├── indicator-stickynotes.md │ ├── java.md │ ├── ln.md │ ├── ls-df-du.md │ ├── rsync.md │ ├── sed.md │ ├── split-cat.md │ ├── sshfs.md │ ├── tabby.md │ ├── tar.md │ ├── tee.md │ ├── thunar.md │ ├── tmux.md │ ├── touch-mkdir.md │ ├── unrar.md │ ├── watch.md │ ├── wc.md │ ├── wget.md │ └── zip.md ├── imgs ├── LinuxGuide.png └── LinuxGuide.svg ├── mkdocs.yml └── requirements.txt /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | mkdocs: 9 | configuration: mkdocs.yml 10 | 11 | # Optionally set the version of Python and requirements required to build your docs 12 | python: 13 | version: 3.8 14 | install: 15 | - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 语言: 3 | 🇨🇳 4 | 5 | 6 |
7 | 8 |
9 | 10 |

11 | «LinuxGuide»记录了Linux系统配置、工具使用、脚本语法以及访问控制 12 |
13 |
14 | 15 | 16 | 17 | 18 | Documentation Status 19 | 20 |

21 | 22 | ## 内容列表 23 | 24 | - [内容列表](#内容列表) 25 | - [主要维护人员](#主要维护人员) 26 | - [参与贡献方式](#参与贡献方式) 27 | - [许可证](#许可证) 28 | 29 | ## 主要维护人员 30 | 31 | * zhujian - *Initial work* - [zjykzj](https://github.com/zjykzj) 32 | 33 | ## 参与贡献方式 34 | 35 | 欢迎任何人的参与!打开[issue](https://github.com/ZJDoc/LinuxGuide/issues)或提交合并请求。 36 | 37 | 注意: 38 | 39 | * `GIT`提交,请遵守[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/)规范 40 | * 语义版本化,请遵守[Semantic Versioning 2.0.0](https://semver.org)规范 41 | * `README`编写,请遵守[standard-readme](https://github.com/RichardLitt/standard-readme)规范 42 | 43 | ## 许可证 44 | 45 | [Apache License 2.0](LICENSE) © 2021 zjykzj -------------------------------------------------------------------------------- /docs/access/imgs/file-permission/chmod_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/access/imgs/file-permission/chmod_mode.png -------------------------------------------------------------------------------- /docs/access/imgs/file-permission/chmod_operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/access/imgs/file-permission/chmod_operator.png -------------------------------------------------------------------------------- /docs/access/imgs/file-permission/chmod_reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/access/imgs/file-permission/chmod_reference.png -------------------------------------------------------------------------------- /docs/access/imgs/file-permission/octal-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/access/imgs/file-permission/octal-mode.png -------------------------------------------------------------------------------- /docs/access/sudo使用.md: -------------------------------------------------------------------------------- 1 | 2 | # sudo使用 3 | 4 | `sudo`允许系统管理员授予某些用户或用户组以根用户或其他用户身份运行命令的权限,同时提供对命令及其参数的审核跟踪 5 | 6 | ## 安装 7 | 8 | ``` 9 | apt-get install sudo 10 | ``` 11 | 12 | ## 查询 13 | 14 | 查询当前用户的`sudo`配置 15 | 16 | ``` 17 | # sudo -ll 18 | Matching Defaults entries for root on 326272a9a4eb: 19 | env_reset, mail_badpass, 20 | secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin 21 | 22 | User root may run the following commands on 326272a9a4eb: 23 | 24 | Sudoers entry: 25 | RunAsUsers: ALL 26 | RunAsGroups: ALL 27 | Commands: 28 | ALL 29 | ``` 30 | 31 | 查询指定用户的`sudo`配置 32 | 33 | ``` 34 | # sudo -lU zj 35 | Matching Defaults entries for zj on 326272a9a4eb: 36 | env_reset, mail_badpass, 37 | secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin 38 | 39 | User zj may run the following commands on 326272a9a4eb: 40 | (ALL : ALL) ALL 41 | ``` 42 | 43 | * 参数`-l`表示列出用户权限或检查特定命令;使用两次`-ll`可获得更长的格式 44 | 45 | * 参数`-U`表示在列表模式下显示用户的权限 46 | 47 | ## 解释 48 | 49 | 打开配置文件`/etc/sudoers` 50 | 51 | ``` 52 | # cat /etc/sudoers 53 | # 54 | # This file MUST be edited with the 'visudo' command as root. 55 | # 56 | # Please consider adding local content in /etc/sudoers.d/ instead of 57 | # directly modifying this file. 58 | # 59 | # See the man page for details on how to write a sudoers file. 60 | # 61 | Defaults env_reset 62 | Defaults mail_badpass 63 | Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" 64 | 65 | # Host alias specification 66 | 67 | # User alias specification 68 | 69 | # Cmnd alias specification 70 | 71 | # User privilege specification 72 | root ALL=(ALL:ALL) ALL 73 | zj ALL=(ALL:ALL) ALL 74 | 75 | # Members of the admin group may gain root privileges 76 | %admin ALL=(ALL) ALL 77 | 78 | # Allow members of group sudo to execute any command 79 | %sudo ALL=(ALL:ALL) ALL 80 | 81 | # See sudoers(5) for more information on "#include" directives: 82 | 83 | #includedir /etc/sudoers.d 84 | ``` 85 | 86 | 对于用户权限规范有 87 | 88 | ``` 89 | root ALL=(ALL:ALL) ALL 90 | zj ALL=(ALL:ALL) ALL 91 | ``` 92 | 93 | * 第一列表示用户名 94 | * 第一个`ALL`表示允许从任何终端、机器访问`sudo` 95 | * 第二个`ALL`表示`sudo`命令被允许以任何用户身份执行 96 | * 第三个`ALL`表示`sudo`命令被允许以任何组身份执行 97 | * 第四个`ALL`表示所有命令都可以作为`root`执行 98 | 99 | 对于组权限规范有 100 | 101 | ``` 102 | # Members of the admin group may gain root privileges 103 | %admin ALL=(ALL) ALL 104 | 105 | # Allow members of group sudo to execute any command 106 | %sudo ALL=(ALL:ALL) ALL 107 | ``` 108 | 109 | ## 修改 110 | 111 | 使用命令`visudo`进行配置文件的修改,其会先进行语法检查;或者使用编辑器配置完成后,执行以下命令进行语法检查 112 | 113 | ``` 114 | visudo -c -f /copy/of/sudoers 115 | ``` 116 | 117 | * 参数`-c`表示语法检查 118 | * 参数`-f`表示指定文件位置 119 | 120 | ## 无密码运行sudo命令 121 | 122 | 修改`/etc/sudoers`文件如下 123 | 124 | ``` 125 | # 允许无密码执行echo和ls 126 | zj ALL=(ALL) NOPASSWD: /bin/echo /bin/ls 127 | # 允许无密码执行所有命令 128 | zj ALL=(ALL) NOPASSWD: ALL 129 | ``` 130 | 131 | ## 相关阅读 132 | 133 | * [Sudo](https://wiki.archlinux.org/index.php/Sudo) 134 | 135 | * [linux sudo 与 /etc/sudoer的配置](https://zhuanlan.zhihu.com/p/43934300) 136 | 137 | * [Linux 系统中 sudo 命令的 10 个技巧](https://zhuanlan.zhihu.com/p/36037822) -------------------------------------------------------------------------------- /docs/access/分区和文件系统.md: -------------------------------------------------------------------------------- 1 | 2 | # 分区和文件系统 3 | 4 | ## 分区 5 | 6 | 分区(`partition`)是将磁盘空间划分可独立访问,分离管理的单个或多个空间,比如启动空间,交换空间,生成的分区信息存储在分区表方案中,如`MBR`或`GPT` 7 | 8 | 划分好磁盘空间后,必须格式化为文件系统,才能进行文件读写操作 9 | 10 | 常用分区工具:`fdisk, parted` 11 | 12 | ## 文件系统 13 | 14 | 文件系统控制了文件存储和检索的方式,用于管理信息组及其名称的结构和逻辑规则称为“文件系统” 15 | 16 | 文件系统使用权限(读写执行)和属性(用户/组/其他)来规定系统进程对文件和目录交互的级别 17 | 18 | ## 命令 19 | 20 | 如何管理分区(当前分区,新建分区,删除分区,修改分区) 21 | 22 | 如何管理文件系统(如何分片,如何扩容) 23 | 24 | ## 查看文件系统的状态 25 | 26 | $ stat /home/zj/ 27 | File: '/home/zj/' 28 | Size: 4096 Blocks: 8 IO Block: 4096 directory 29 | Device: 10304h/66308d Inode: 17039361 Links: 53 30 | Access: (0755/drwxr-xr-x) Uid: ( 1000/ zj) Gid: ( 1000/ zj) 31 | Access: 2019-02-24 15:43:55.344024704 +0800 32 | Modify: 2019-02-24 15:27:08.247767421 +0800 33 | Change: 2019-02-24 15:27:08.247767421 +0800 34 | Birth: - 35 | 36 | $ stat / 37 | File: '/' 38 | Size: 4096 Blocks: 8 IO Block: 4096 directory 39 | Device: 10303h/66307d Inode: 2 Links: 24 40 | Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) 41 | Access: 2019-02-24 15:26:55.191767471 +0800 42 | Modify: 2019-01-11 20:55:22.710805402 +0800 43 | Change: 2019-01-11 20:55:22.710805402 +0800 44 | Birth: - 45 | 46 | ## 相关阅读 47 | 48 | * [Partitioning](https://wiki.archlinux.org/index.php/partitioning) 49 | 50 | * [Disk partitioning](https://en.wikipedia.org/wiki/Disk_partitioning) 51 | 52 | * [File systems](https://wiki.archlinux.org/index.php/File_systems) 53 | 54 | * [Linux](https://en.wikipedia.org/wiki/Linux) 55 | 56 | * [File system](https://en.wikipedia.org/wiki/File_system) 57 | -------------------------------------------------------------------------------- /docs/access/文件权限.md: -------------------------------------------------------------------------------- 1 | 2 | # 文件权限 3 | 4 | ## 2级访问控制 5 | 6 | `Linux`使用`2`级权限方式控制文件的访问: 7 | 8 | * 第一级是针对读/写/执行的权限设置; 9 | * 第二级是针对用户/组/其他的权限设置 10 | 11 | ### 读/写/执行 12 | 13 | * 读权限控制文件内容是否可以被读取,以`r`表示 14 | * 写权限控制文件内容是否可以被修改,以`w`表示 15 | * 执行权限控制文件是否可以被执行,以`x`表示 16 | 17 | ### 用户/组/其他 18 | 19 | `Linux`针对当前文件将用户划分为`3`个范围: 20 | 21 | * 拥有该文件的用户 22 | * 和当前用户属于同一组的其他用户 23 | * 不和当前用户属于同一组的其他用户 24 | 25 | ## 查询工具 26 | 27 | 通常使用以下几种工具查询文件权限 28 | 29 | * `ls` 30 | * `stat` 31 | 32 | ### ls 33 | 34 | `ls`是最常用的文件信息查询工具 35 | 36 | >List information about the FILEs (the current directory by default). 37 | 38 | #### 单个文件 39 | 40 | ``` 41 | $ ls -al Dockerfile 42 | -rw-rw-r-- 1 zj zj 119 9月 24 16:03 Dockerfile 43 | ``` 44 | 45 | #### 多个文件 46 | 47 | 搜索当前目录的所有文件权限 48 | 49 | ``` 50 | $ ls -al 51 | total 68 52 | drwxrwxr-x 10 zj zj 4096 9月 28 09:53 . 53 | drwxr-xr-x 74 zj zj 4096 9月 29 09:25 .. 54 | drwxrwxr-x 17 zj zj 4096 9月 25 16:20 deepin-wine-ubuntu 55 | -rw-rw-r-- 1 zj zj 119 9月 24 16:03 Dockerfile 56 | drwxrwxr-x 201 zj zj 4096 9月 24 11:22 dockerfiles 57 | ... 58 | ... 59 | ``` 60 | 61 | #### 说明 62 | 63 | 以单个文件搜索结果为例,文件权限部分在第一列 64 | 65 | ``` 66 | -rw-rw-r-- 67 | ``` 68 | 69 | 第一字节表示节点类型(`node type`):`-`表示文件;`d`表示目录;`l`表示符号链接;`c`表示字符设备;`p`表示伪终端;`b`表示块设备 70 | 71 | 接下来`9`个字符分为`3`块,分别代表用户、组和其他的权限;每块`3`个字符,分别代表读、写和执行权限 72 | 73 | `r`表示读;`w`表示写;`x`表示执行;`-`表示没有权限 74 | 75 | 所以文件`Dockerfile`可以被当前用户读/写,被同组用户读/写,被其他用户读 76 | 77 | ### stat 78 | 79 | `stat`是一个更详细的文件权限查询工具 80 | 81 | ``` 82 | $ stat Dockerfile 83 | File: 'Dockerfile' 84 | Size: 119 Blocks: 8 IO Block: 4096 regular file 85 | Device: 10304h/66308d Inode: 17118015 Links: 1 86 | Access: (0664/-rw-rw-r--) Uid: ( 1000/ zj) Gid: ( 1000/ zj) 87 | Access: 2019-09-26 15:38:17.136309351 +0800 88 | Modify: 2019-09-24 16:03:31.089612824 +0800 89 | Change: 2019-09-24 16:03:31.121613208 +0800 90 | Birth: - 91 | ``` 92 | 93 | #### 打印访问权限 94 | 95 | ``` 96 | $ stat -c %A Dockerfile 97 | -rw-r--r-- 98 | $ stat -c %a Dockerfile 99 | 644 100 | ``` 101 | 102 | #### 打印所属用户/组 103 | 104 | ``` 105 | # 组合打印文件所属用户/组 106 | $ stat -c %U:%G dockerfiles/ 107 | zj:zj 108 | ``` 109 | 110 | #### 打印文件类型 111 | 112 | ``` 113 | # 文件 114 | $ stat -c %F Dockerfile 115 | regular file 116 | # 目录 117 | $ stat -c %F dockerfiles/ 118 | directory 119 | ``` 120 | 121 | ## 设置工具 122 | 123 | 针对`Linux`的`2`级访问控制,使用`chmod`修改文件的读/写/执行权限,使用`chown/chgrp`修改文件的用户/组/其他权限 124 | 125 | ### chmod 126 | 127 | 使用[chmod](https://en.wikipedia.org/wiki/Chmod)进行设置,有两种方式设置文件权限 128 | 129 | 1. 数值设置 130 | 2. 符号设置 131 | 132 | *参数`-v`表示显示文件权限的改变信息* 133 | 134 | *参数`-R, --recursive`表示递归设置文件权限* 135 | 136 | #### 数值设置 137 | 138 | 语法如下: 139 | 140 | ``` 141 | chmod [OPTION]... OCTAL-MODE FILE... 142 | ``` 143 | 144 | `chmod`以`8`进制数值表示文件的权限,通过数值设置可以准确修改用户/组/其他的文件权限 145 | 146 | ![](./imgs/file-permission/octal-mode.png) 147 | 148 | 以`754`为例,其表示如下 149 | 150 | * 对于当前用户而言,其对文件能够*读/写/执行* 151 | * 对于同组用户而言,其对文件能够*读/执行* 152 | * 对于其他用户而言,其对文件能够*读* 153 | 154 | 执行如下: 155 | 156 | ``` 157 | $ chmod -v 754 Dockerfile 158 | mode of 'Dockerfile' changed from 0775 (rwxrwxr-x) to 0754 (rwxr-xr--) 159 | ``` 160 | 161 | #### 符号设置 162 | 163 | 语法如下: 164 | 165 | ``` 166 | $ chmod [references][operator][modes] file ... 167 | ``` 168 | 169 | 符号设置由`3`部分组成,第一个部分指定对象,第二个部分指定如何操作,第三个部分指定操作的内容 170 | 171 | ##### 指定对象 172 | 173 | ![](./imgs/file-permission/chmod_reference.png) 174 | 175 | * 符号`u`表示当前用户 176 | * 符号`g`表示同组用户 177 | * 符号`o`表示其他用户 178 | * 符号`a`表示所有用户 179 | 180 | ##### 如何操作 181 | 182 | ![](./imgs/file-permission/chmod_operator.png) 183 | 184 | * 符号`+`表示增加指定权限(如果没有的话) 185 | * 符号`-`表示移除指定权限(如果有的话) 186 | * 符号`=`表示设置指定对象的文件权限 187 | 188 | ##### 操作内容 189 | 190 | ![](./imgs/file-permission/chmod_mode.png) 191 | 192 | * 符号`r`表示读权限 193 | * 符号`w`表示写权限 194 | * 符号`x`表示执行权限 195 | 196 | ##### 示例 197 | 198 | 对所有用户添加写入权限 199 | 200 | ``` 201 | $ chmod -v a+w Dockerfile 202 | mode of 'Dockerfile' changed from 0754 (rwxr-xr--) to 0776 (rwxrwxrw-) 203 | ``` 204 | 205 | 设置当前用户为读/写权限 206 | 207 | ``` 208 | $ chmod -v u=rw Dockerfile 209 | mode of 'Dockerfile' changed from 0776 (rwxrwxrw-) to 0676 (rw-rwxrw-) 210 | ``` 211 | 212 | 取消同组用户/其他用户的写和执行操作 213 | 214 | ``` 215 | $ chmod -v go-wx Dockerfile 216 | mode of 'Dockerfile' changed from 0676 (rw-rwxrw-) to 0644 (rw-r--r--) 217 | ``` 218 | 219 | ### chown/chgrp 220 | 221 | * [chown](https://linux.die.net/man/1/chown)修改当前文件所属的用户 222 | * [chgrp](https://en.wikipedia.org/wiki/Chgrp)修改当前文件所属的组 223 | 224 | #### chown 225 | 226 | 系统中任何文件的所有权只能由超级用户更改。用户不能放弃文件的所有权,即使用户拥有它。类似地,只有组成员才能将文件的组`ID`更改为该组 227 | 228 | ``` 229 | chown [OPTION]... [OWNER][:[GROUP]] FILE... 230 | ``` 231 | 232 | *参数`-v`表示显示文件权限的改变信息* 233 | 234 | *参数`-R, --recursive`表示递归设置文件权限* 235 | 236 | 修改文件`Dockerfile`的当前用户为`root` 237 | 238 | ``` 239 | # chown -v root Dockerfile 240 | changed ownership of 'Dockerfile' from zj to root 241 | ``` 242 | 243 | 此时文件`Dockerfile`的当前用户是`root`,所属组为`zj`。再次修改文件`Dockerfile`的当前用户为`root`,同时其组为`root` 244 | 245 | ``` 246 | # chown -v root:root Dockerfile 247 | changed ownership of 'Dockerfile' from root:zj to root:root 248 | ``` 249 | 250 | #### chgrp 251 | 252 | `chgrp`修改文件所属组 253 | 254 | ``` 255 | chgrp [OPTION]... GROUP FILE... 256 | ``` 257 | 258 | *参数`-v`表示显示文件权限的改变信息* 259 | 260 | *参数`-R, --recursive`表示递归设置文件权限* 261 | 262 | 修改文件`Dockerfile`所属组为`root` 263 | 264 | ``` 265 | # chgrp -v root Dockerfile 266 | changed group of 'Dockerfile' from zj to root 267 | ``` 268 | 269 | 此时其用户为`zj`,所属组为`root` -------------------------------------------------------------------------------- /docs/access/本地用户信息.md: -------------------------------------------------------------------------------- 1 | 2 | # 本地用户信息 3 | 4 | `/etc/passwd`保存了本机所有的用户信息:每一行表示一个用户账户,共有`7`个字段 5 | 6 | ``` 7 | account:password:UID:GID:GECOS:directory:shell 8 | ``` 9 | 10 | ## 解析 11 | 12 | * `account`:用户名,不能为空 13 | * `passwd`:用户密码,通常使用占位符`x`表示,真正密码保存在`/etc/shadow`中 14 | * `UDI`:用户`ID`。首次创建的用户`ID`通常为`1000`,之后创建的用户`ID`会以此递增 15 | * `GID`:初始组`ID`。组`ID`保存在`/etc/group`中 16 | * `GECOS`:可选字段,记录用户的个人情况,通常为空 17 | * `directory`:主目录,也就是用户的起始目录 18 | * `shell`:用户指定的登录`shell`地址,通常设置为`/bin/bash` 19 | 20 | 示例如下: 21 | 22 | ``` 23 | zj:x:1000:1000::/home/zj:/bin/bash 24 | ``` 25 | 26 | ## 伪用户 27 | 28 | 通常称不能登录的用户为伪用户(`pseudo user`),其登录`shell`为空或为`/usr/sbin/nologin` 29 | 30 | 其存在主要是方便系统管理,满足相应的系统进程对文件属主的要求,常见的有 31 | 32 | ``` 33 | bin 拥有可执行的用户命令文件 34 | sys 拥有系统文件 35 | adm 拥有帐户文件 36 | uucp UUCP使用 37 | lp lp或lpd子系统使用 38 | nobody NFS使用 39 | ``` 40 | 41 | ## 相关阅读 42 | 43 | * [User database](https://wiki.archlinux.org/index.php/Users_and_groups#User_database) 44 | 45 | * [/etc/passwd](https://www.runoob.com/linux/linux-user-manage.html) 46 | -------------------------------------------------------------------------------- /docs/access/本地组信息.md: -------------------------------------------------------------------------------- 1 | 2 | # 本地组信息 3 | 4 | 本地组信息保存在`/etc/group`中,其包含`4`个字段 5 | 6 | ``` 7 | GROUP_NAME:PASSWD:GID:GROUP_LIST 8 | ``` 9 | 10 | ## 解析 11 | 12 | * 第一个字段表示组名 13 | * 第二个字段表示组密码,通常使用占位符`*`,真正密码保存在`/etc/gshadow`中 14 | * 第三个字段表示组`ID` 15 | * 第四个字段表示附加成员列表,以逗号分隔(注意:这里没有初始成员) 16 | 17 | ## 示例 18 | 19 | 首先创建两个用户`zj/zzj`,其默认初始组为`zj/zzj` 20 | 21 | ``` 22 | $ useradd zj 23 | $ useradd zzj 24 | $ cat /etc/group 25 | ... 26 | ... 27 | zj:x:1000: 28 | zjj:x:1001: 29 | ``` 30 | 31 | 然后创建用户`zzjj`,初始组设置为`zj`,附加组设置为`zzj` 32 | 33 | ``` 34 | $ useradd zzjj -g zj -G zzj 35 | $ cat /etc/group 36 | ... 37 | ... 38 | zj:x:1000: 39 | zjj:x:1001:zzjj 40 | ``` 41 | 42 | ## 相关阅读 43 | 44 | * [Understanding /etc/group File](https://www.cyberciti.biz/faq/understanding-etcgroup-file/) -------------------------------------------------------------------------------- /docs/access/用户密码.md: -------------------------------------------------------------------------------- 1 | 2 | # 用户密码 3 | 4 | 使用`passwd`设置的用户账户密码保存在文件`/etc/shadow`中,其包含`9`个字段 5 | 6 | ``` 7 | 用户名:加密密码:最后一次修改时间:最小修改时间间隔:密码有效期:密码需要变更前的警告天数:密码过期后的宽限时间:账号失效时间:保留字段 8 | ``` 9 | 10 | ## 密码解析 11 | 12 | * 采用`SHA512`散列加密算法 13 | * 伪用户的密码是`!!`或`*`,表示没有密码不能登录 14 | * 新创建的用户如果不设定密码,同样设置为`*` 15 | 16 | ## 密码疑失 17 | 18 | 普通账户密码忘记了,通过`root`账户重新设置即可 19 | 20 | ## 相关阅读 21 | 22 | * [Linux /etc/shadow(影子文件)内容解析(超详细)](http://c.biancheng.net/view/840.html) -------------------------------------------------------------------------------- /docs/access/用户权限调整.md: -------------------------------------------------------------------------------- 1 | 2 | # 用户权限调整 3 | 4 | ## usermod 5 | 6 | 使用`usermod`修改用户的各种设置 7 | 8 | 修改用户登入目录 9 | 10 | ``` 11 | $ usermod -d DIR USER 12 | ``` 13 | 14 | 修改用户初始组 15 | 16 | ``` 17 | $ usermod -g GROUP USER 18 | ``` 19 | 20 | 修改用户附属组 21 | 22 | ``` 23 | # 以逗号分隔,以先的附属组替换原先用户的附属组 24 | $ usermod -G NEW_GROUPS USER 25 | # 使用参数-a保留原先用户的附属组 26 | $ usermod -a -G NEW_GROUPS USER 27 | ``` 28 | 29 | 修改用户`ID` 30 | 31 | ``` 32 | $ usermod -u ID USER 33 | ``` 34 | 35 | 修改用户帐号名 36 | 37 | ``` 38 | $ usermod -l NAME USER 39 | ``` 40 | 41 | ## passwd 42 | 43 | 语法如下: 44 | 45 | ``` 46 | $ passwd USER 47 | ``` 48 | 49 | * 在`root`用户中不需要输入原先密码 50 | * 在普通用户中需要输入原先密码 51 | 52 | 修改密码会加密保存在`/etc/shadow`中 53 | 54 | ## 相关阅读 55 | 56 | * [Linux usermod命令](https://www.runoob.com/linux/linux-comm-usermod.html) -------------------------------------------------------------------------------- /docs/access/用户查询-创建和删除.md: -------------------------------------------------------------------------------- 1 | 2 | # 用户查询、创建和删除 3 | 4 | 用户和组是`Linux`默认的访问控制机制,在`Linux`系统中每次登录均以用户的身份进行操作。每个用户属于一个或多个组,同一组内的用户共享组权限,比如一个文件设置为组可修改,那么属于同一组内的其他用户也可修改该文件 5 | 6 | ## 查询用户 7 | 8 | 使用`id`查询指定用户的信息 9 | 10 | >Print user and group information for the specified USER 11 | 12 | 查询当前用户信息 13 | 14 | ``` 15 | $ id 16 | uid=1000(zj) gid=1000(zj) groups=1000(zj),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(docker) 17 | ``` 18 | 19 | 查询指定用户的信息 20 | 21 | ``` 22 | # 查询root用户 23 | $ id root 24 | uid=0(root) gid=0(root) groups=0(root) 25 | # 查询当前用户 26 | $ id $UID 27 | uid=1000(zj) gid=1000(zj) groups=1000(zj),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(docker) 28 | ``` 29 | 30 | 查询用户`ID` 31 | 32 | ``` 33 | $ id -u zj 34 | 1000 35 | ``` 36 | 37 | 查询初始组`ID` 38 | 39 | ``` 40 | $ id -g zj 41 | 1000 42 | ``` 43 | 44 | ## 创建用户 45 | 46 | 使用`useradd`进行用户创建,语法如下: 47 | 48 | ``` 49 | useradd [options] LOGIN 50 | ``` 51 | 52 | 创建用户(不创建目录) 53 | 54 | ``` 55 | $ useradd USER 56 | ``` 57 | 58 | 创建用户,在`HOME`目录下创建同名文件夹 59 | 60 | ``` 61 | $ useradd -m USER 62 | ``` 63 | 64 | 指定初始组,使用组名或组`ID`(注意:该初始组必须已存在) 65 | 66 | ``` 67 | # -g, --gid 68 | $ useradd -g GNAME USER 69 | ``` 70 | 71 | 指定用户`ID` 72 | 73 | ``` 74 | # -u, --uid 75 | $ useraddd -u UID USER 76 | # 使用参数`-o`表明可以指定已存在的UID 77 | $ useradd -o -u UID USER 78 | ``` 79 | 80 | 添加额外信息,添加的信息将出现在`/etc/passwd`文件每行的`GECOS`字段 81 | 82 | ``` 83 | $ useradd -c "COMMENT" USER 84 | ``` 85 | 86 | ### 登录shell 87 | 88 | 指定登录`shell` 89 | 90 | ``` 91 | $ useradd -s /bin/sh -m USER 92 | ``` 93 | 94 | 指定用户无法`shell`登录 95 | 96 | ``` 97 | $ useradd -s /sbin/nologin 98 | ``` 99 | 100 | ### 用户密码 101 | 102 | 设置登录密码,使用参数`-p`,但是没有效果,需要使用`passwd`设置用户密码 103 | 104 | ``` 105 | # passwd zj 106 | Enter new UNIX password: 107 | Retype new UNIX password: 108 | passwd: password updated successfully 109 | ``` 110 | 111 | 可在文件`/etc/shadow`下查看是否设置成功 112 | 113 | ``` 114 | zj:$6$zK72ODxA$EAq/p.5qfANxr40XOl/jldgBAmoN0Opvdxxxxxxxxxxxxxxx:18168:0:99999:7::: 115 | ``` 116 | 117 | ## 删除用户 118 | 119 | 可在`/etc/passwd`中查询创建的用户 120 | 121 | ``` 122 | # cat /etc/passwd 123 | ... 124 | ... 125 | zj:x:1000:1000::/home/zj:/bin/sh 126 | ``` 127 | 128 | 使用`userdel`进行用户删除,语法如下: 129 | 130 | ``` 131 | Usage: userdel [options] LOGIN 132 | ``` 133 | 134 | 仅删除用户信息 135 | 136 | ``` 137 | $ userdel USER 138 | ``` 139 | 140 | 同时删除`HOME`目录 141 | 142 | ``` 143 | $ userdel -r USER 144 | ``` 145 | 146 | ## 相关阅读 147 | 148 | * [Ubuntu创建新用户的正确姿势](https://segmentfault.com/a/1190000016779485) 149 | 150 | * [Users and groups (简体中文)](https://wiki.archlinux.org/index.php/Users_and_groups_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)) 151 | 152 | * [Linux useradd命令](https://www.runoob.com/linux/linux-comm-useradd.html) 153 | 154 | * [Linux userdel命令](https://www.runoob.com/linux/linux-comm-userdel.html) -------------------------------------------------------------------------------- /docs/access/目录权限.md: -------------------------------------------------------------------------------- 1 | 2 | # 目录权限 3 | 4 | 目录的权限设置和文件类似,均为`2`级访问设置,区别在于读/写/执行权限的使用 5 | 6 | ## 读/写/执行 7 | 8 | * 读权限表示目录内容是否可以查看 9 | * 写权限表示目录内容是否可以修改 10 | * 执行权限表示目录内容是否可以被`cd`访问 11 | 12 | 如果路径上的某个文件夹没有执行权限,那么无法访问最终的文件或文件夹,不论该文件或文件夹的权限状况 13 | 14 | ## 区分文件和文件夹 15 | 16 | 使用`ls -al`查询文件/文件夹信息,第一列的第一个标志位表示对象类型 17 | 18 | 1. `d`表示文件夹 19 | 2. `-`表示文件 20 | 21 | 查询当前目录 22 | 23 | ``` 24 | $ ls -al 25 | drwxrwxr-x 10 zj zj 4096 9月 29 14:58 . 26 | drwxr-xr-x 74 zj zj 4096 9月 29 14:58 .. 27 | drwxrwxr-x 17 zj zj 4096 9月 25 16:20 deepin-wine-ubuntu 28 | -rw-r--r-- 1 zj zj 119 9月 24 16:03 Dockerfile 29 | drwxrwxr-x 201 zj zj 4096 9月 24 11:22 dockerfiles 30 | ``` 31 | 32 | 如上所示,`Dockerfile`是文件,`./../deepin-wine-ubuntu/dockerfiles`是目录 33 | 34 | ## 相关阅读 35 | 36 | * [File permissions and attributes](https://wiki.archlinux.org/index.php/File_permissions_and_attributes#Viewing_permissions) 37 | -------------------------------------------------------------------------------- /docs/access/组权限调整.md: -------------------------------------------------------------------------------- 1 | 2 | # 组权限调整 3 | 4 | ## groupmod 5 | 6 | 使用`groupmod`调整用户组名和用户组`ID` 7 | 8 | 使用参数`-n, --new-name`修改组名 9 | 10 | ``` 11 | $ groupmod -n NEW_GROUP GROUP 12 | ``` 13 | 14 | 使用参数`-g, --gid`修改组`ID` 15 | 16 | ``` 17 | $ groupmod -g NEW_ID GROUP 18 | ``` 19 | 20 | ## gpasswd 21 | 22 | 使用`gpasswd`添加和删除组中的用户 23 | 24 | 使用参数`-a, --add`添加新用户 25 | 26 | ``` 27 | $ gpasswd -a USER GROUP 28 | # gpasswd -a zj zzj 29 | Adding user zj to group zzj 30 | # id zj 31 | uid=1000(zj) gid=1000(zj) groups=1000(zj),1011(zzj) 32 | ``` 33 | 34 | 使用参数`-d, --delete`删除用户 35 | 36 | ``` 37 | $ gpasswd -d USER GROUP 38 | # gpasswd -d zj zzj 39 | Removing user zj from group zzj 40 | ``` 41 | 42 | ## 相关阅读 43 | 44 | * [Group management](https://wiki.archlinux.org/index.php/Users_and_groups#Group_management) -------------------------------------------------------------------------------- /docs/access/组查询-创建和删除.md: -------------------------------------------------------------------------------- 1 | 2 | # 组查询、创建和删除 3 | 4 | ## 查询 5 | 6 | 可使用`id`查询当前用户/指定用户的用户组 7 | 8 | ``` 9 | # id 10 | uid=0(root) gid=0(root) groups=0(root) 11 | ``` 12 | 13 | 可在`/etc/group`中查询所有的用户组 14 | 15 | ## 创建 16 | 17 | 使用`groupadd`新建用户组,语法如下: 18 | 19 | ``` 20 | groupadd [options] GROUP 21 | ``` 22 | 23 | 新建用户组(不能和已有同名),组`ID`会比当前已有最大组`ID`大`1` 24 | 25 | ``` 26 | $ groupadd zzz 27 | $ cat /etc/group 28 | ... 29 | ... 30 | zj:x:1000: 31 | zzz:x:1001: 32 | ``` 33 | 34 | 指定组`ID` 35 | 36 | ``` 37 | $ group -g ID GROUP 38 | ``` 39 | 40 | 参数`-g`可以和参数`-o`一起使用,表示新建的用户组可拥有和已有组一样的`ID` 41 | 42 | ``` 43 | $ group -o -g 1000 zzzzz 44 | $ cat /etc/group 45 | ... 46 | ... 47 | zj:x:1000: 48 | zzz:x:1001: 49 | zzzzz:x:1000: 50 | ``` 51 | 52 | ## 删除 53 | 54 | 使用命令`groupdel`删除指定用户组,语法如下 55 | 56 | ``` 57 | groupdel GROUP 58 | ``` 59 | 60 | ## 相关阅读 61 | 62 | * [Group management](https://wiki.archlinux.org/index.php/Users_and_groups#Group_management) 63 | 64 | * [Linux 用户和用户组管理](https://www.runoob.com/linux/linux-user-manage.html) 65 | -------------------------------------------------------------------------------- /docs/configure/[Docker][Ubuntu 18.04]g++安装失败.md: -------------------------------------------------------------------------------- 1 | 2 | # [Docker][Ubuntu 18.04]g++安装失败 3 | 4 | 参考: 5 | 6 | [Ubuntu18.04LTS安装g++错误以及解决方法](http://blog.sina.com.cn/s/blog_64bb0c990102yv3a.html) 7 | 8 | [安装g++出现的问题解决了一部分,还有一些。求大神指教](https://forum.ubuntu.org.cn/viewtopic.php?t=465488) 9 | 10 | 使用`Docker`镜像`Ubuntu:18.04`,安装`g++`时出现错误 11 | 12 | ``` 13 | The following packages have unmet dependencies: 14 | g++ : Depends: g++-5 (>= 5.3.1-3~) but it is not going to be installed 15 | E: Unable to correct problems, you have held broken packages. 16 | ``` 17 | 18 | 网上查询时发现可能是系统镜像源设置出错,我使用了`Ubuntu 16.04`的阿里镜像。在[Mirrors](https://opsx.alibaba.com/mirror)中找到`Ubuntu 18.04`的镜像源配置 19 | 20 | ``` 21 | deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 22 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 23 | 24 | deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 25 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 26 | 27 | deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 28 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 29 | 30 | deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 31 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 32 | 33 | deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 34 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 35 | ``` 36 | 37 | 重新配置后,成功安装`g++` -------------------------------------------------------------------------------- /docs/configure/[Linux]LVM配置.md: -------------------------------------------------------------------------------- 1 | 2 | # [Linux]LVM配置 3 | 4 | 参考: 5 | 6 | [ 如何安全的从LVM中移除磁盘](https://www.cnblogs.com/pipci/p/11477148.html) 7 | 8 | [删除LVM步骤](https://blog.51cto.com/hengdao/586841) 9 | 10 | [lvremove删除逻辑卷报正在使用](https://blog.csdn.net/qianglei6077/article/details/86576034) 11 | 12 | [介绍如何从LVM的卷组中删除物理卷](https://blog.csdn.net/linuxprobe18/article/details/109461766) 13 | 14 | [在Linux中扩展/缩减LVM(第二部分) ](https://linux.cn/article-3974-1.html) 15 | 16 | [LVM : 缩减文件系统的容量](https://www.cnblogs.com/sparkdev/p/10213655.html) 17 | 18 | [如何减少/缩小Linux中的LVM(逻辑卷大小)?](https://blog.csdn.net/oMcLin/article/details/108746199) -------------------------------------------------------------------------------- /docs/configure/[Thinkpad T470p][Ubuntu 16.04]双显卡配置.md: -------------------------------------------------------------------------------- 1 | 2 | # [Thinkpad T470p][Ubuntu 16.04]双显卡配置问题:无法切换显卡 3 | 4 | 原本`Thinkpad T470p`预装的是`win10`家庭版,有双显卡,可以通过`NVIDIA Settings`进行显卡切换 5 | 6 | 现在将系统重装为`Ubuntu`,发现双显卡的配置和想象的不一样 7 | 8 | zj@zj-ThinkPad-T470p:~$ lspci | grep -i -E "vga|3d" 9 | 10 | 00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04) 11 | 02:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2) 12 | 13 | `Intel`显卡的名称为`VGA compatible controller`,而`NVIDIA`显卡的名称为`3D controller` 14 | 15 | 安装`NVIDIA`显卡驱动后,能够运行`nvidia-smi`但是不能运行`nvidia-settings`,以及图形应用`NVIDIA X Server Settings` 16 | 17 | zj@zj-ThinkPad-T470p:~$ nvidia-smi 18 | Mon Jan 14 19:34:28 2019 19 | +-----------------------------------------------------------------------------+ 20 | | NVIDIA-SMI 410.93 Driver Version: 410.93 CUDA Version: 10.0 | 21 | |-------------------------------+----------------------+----------------------+ 22 | | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | 23 | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | 24 | |===============================+======================+======================| 25 | | 0 GeForce 940MX Off | 00000000:02:00.0 Off | N/A | 26 | | N/A 32C P8 N/A / N/A | 11MiB / 2004MiB | 0% Default | 27 | +-------------------------------+----------------------+----------------------+ 28 | 29 | +-----------------------------------------------------------------------------+ 30 | | Processes: GPU Memory | 31 | | GPU PID Type Process name Usage | 32 | |=============================================================================| 33 | | No running processes found | 34 | +-----------------------------------------------------------------------------+ 35 | 36 | zj@zj-ThinkPad-T470p:~$ nvidia-settings 37 | 38 | ERROR: Unable to load info from any available system 39 | 40 | 在网上找了许多资料,发现是因为`t470p`使用了`NVIDIA Optimus`技术,默认在正常使用时基于集显,在玩游戏时基于独显,参考:[NVIDIA® Optimus™ 技术](https://www.nvidia.cn/object/optimus_technology_cn.html) 41 | 42 | 在`win10`环境下还能切换,但在`Ubuntu`环境下无法设置了 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/configure/[Thinkpad T470p]安装Ubuntu 16.04单系统及Nvidia显卡驱动安装.md: -------------------------------------------------------------------------------- 1 | # [Thinkpad T470p]安装Ubuntu 16.04单系统及Nvidia显卡驱动安装 2 | 3 | 今天在`Thinkpad T470p`上面重新安装了`Ubuntu16.04`以及`Nvidia`显卡驱动,整个安装过程比之前在其他电脑上安装快很多 4 | 5 | 不过还是出现了一些问题,记录其中的关键点 6 | 7 | ## 笔记本查询 8 | 9 | 参考[thinkpad t470p 安装ubuntu16.04](https://www.jianshu.com/p/013dce15a106)才知道可在`Ubuntu`官网上查询你的笔记本或者台式机是否能够很好的匹配`Ubuntu`, 10 | 11 | 查询地址:[Ubuntu Desktop certified hardware](https://certification.ubuntu.com/desktop/) 12 | 13 | ## `Ubuntu16.04`安装 14 | 15 | ### `U`盘制作 16 | 17 | 使用软件[Universal USB Installer](https://baike.baidu.com/item/Universal%20USB%20Installer) 18 | 19 | ### `U`盘安装 20 | 21 | 先进入`BIOS`设置`U`盘启动优先,进入系统后点击桌面上的安装图标,按照提示进行即可 22 | 23 | 这里需要注意的是分区问题,选择手动进行分区 24 | 25 | 首先还原之前已分区的空间,注意:保留`efi`分区(`windows boot manager`) 26 | 27 | 现在只需要分区`根目录、交换空间和home目录`,不再需要设置`boot`空间,最后还需要将选项`安装启动引导器的设备`设置为`windows boot manager` 28 | 29 | ## `Nvidia`显卡驱动安装 30 | 31 | 参考: 32 | 33 | [Ubuntu下安装nvidia显卡驱动(安装方式简单)](https://blog.csdn.net/linhai1028/article/details/79445722) 34 | 35 | [Linux secure boot(安全启动)时添加Nvidia显卡驱动](http://www.cnblogs.com/dreamyphone/p/4508090.html) 36 | 37 | [Ubuntu16.04 安装NVIDIA英伟达驱动教程 及常见几种报错Error的解决方案](https://blog.csdn.net/ksws0292756/article/details/79160742) 38 | 39 | [配有 Nvidia 显卡的笔记本安装 ubuntu18.04 所遇到的问题与解决](https://blog.csdn.net/bush_nj/article/details/80850937) 40 | 41 | ### 下载 42 | 43 | 查询显卡信息 44 | 45 | $ lspci | grep -i nvidia 46 | 47 | 02:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2) 48 | 49 | 在官网上下载相应驱动:[Download Drivers](https://www.nvidia.com/Download/index.aspx) 50 | 51 | ### 预处理 52 | 53 | 禁用`Ubuntu`预先安装的`nouveau`驱动 54 | 55 | 编辑文件`blacklist.conf`,添加屏蔽项 56 | 57 | sudo gedit /etc/modprobe.d/blacklist.conf 58 | 59 | blacklist rivafb 60 | blacklist vga16fb 61 | blacklist nouveau 62 | blacklist nvidiafb 63 | blacklist rivatv 64 | 65 | 卸载之前可能存在的`Nvidia`驱动 66 | 67 | # 如果存在 68 | nvidia-uninstall 69 | 70 | sudo apt-get --purge remove nvidia-* 71 | sudo apt-get autoremove 72 | 73 | 给驱动设置权限 74 | 75 | sudo chmod a+x NVIDIA-Linux*.run 76 | 77 | ### 安装驱动 78 | 79 | 关闭窗口桌面 80 | 81 | sudo service lightdm stop 82 | 83 | 切换到命令行桌面`Ctrl+Alt+F1`,执行驱动更新 84 | 85 | sudo ./NVIDIA-Linux-x86_64-410.93.run -no-x-check -no-nouveau-check -no-opengl-files 86 | 87 | 驱动会显示如下问题 88 | 89 | **问题一:the distribution-provided pre-install script failed!** 90 | 91 | 继续执行 92 | 93 | **问题二:`dkms`** 94 | 95 | 选择no 96 | 97 | **问题二:`sign the kernel module`** 98 | 99 | 需要签名才能写入,选择签名,并且重新生成,不删除私钥 100 | 101 | 安装完成后将密钥写入内核信任列表 102 | 103 | sudo mokutil --import /usr/share/nvidia/nvidia*.der 104 | 105 | 会要求输入两次密码(自定义),然后重启应用 106 | 107 | sudo reboot 108 | 109 | **问题三:`perform mok management`** 110 | 111 | 重启后会进入一个蓝色界面,需要你手动写入签名 112 | 113 | 1. 选择`enroll mok ` 114 | 2. 选择`continue` 115 | 3. 选择 `yes` 116 | 4. 输入之前设置的密码 117 | 5. 选择`reboot` 118 | 119 | 这样驱动就成功安装了 120 | 121 | zj@zj-ThinkPad-T470p:~$ nvidia-smi 122 | Fri Jan 11 20:57:56 2019 123 | +-----------------------------------------------------------------------------+ 124 | | NVIDIA-SMI 410.93 Driver Version: 410.93 CUDA Version: 10.0 | 125 | |-------------------------------+----------------------+----------------------+ 126 | | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | 127 | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | 128 | |===============================+======================+======================| 129 | | 0 GeForce 940MX Off | 00000000:02:00.0 Off | N/A | 130 | | N/A 33C P0 N/A / N/A | 0MiB / 2004MiB | 1% Default | 131 | +-------------------------------+----------------------+----------------------+ 132 | 133 | +-----------------------------------------------------------------------------+ 134 | | Processes: GPU Memory | 135 | | GPU PID Type Process name Usage | 136 | |=============================================================================| 137 | | No running processes found | 138 | +-----------------------------------------------------------------------------+ 139 | -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 16.04]Cuda和Cudnn安装.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 16.04]Cuda和Cudnn安装 3 | 4 | 之前已安装好了`Nvidia`显卡驱动,这一步安装`cuda`和`cudnn` 5 | 6 | --- 7 | 8 | ## cuda安装 9 | 10 | 参考:[Ubuntu16.04下安装cuda和cudnn的三种方法(亲测全部有效)](https://blog.csdn.net/wanzhen4330/article/details/81699769) 11 | 12 | 分`3`步: 13 | 14 | 1. 下载 15 | 2. 安装 16 | 3. 设置环境变量 17 | 18 | ### 下载 19 | 20 | 先下载对应`cuda`版本,官网下载:[CUDA Toolkit Archive](https://developer.nvidia.com/cuda-toolkit-archive) 21 | 22 | 我下载的是`.run`文件 23 | 24 | ### 安装 25 | 26 | 先授予权限 27 | 28 | sudo chmod 777 cuda*.run 29 | 30 | 直接运行即可 31 | 32 | sudo ./cuda*.run 33 | 34 | 首先显示一个应用许可(很长,可以按`'q'`键退出),然后会提示你输入是否允许 35 | 36 | Do you accept the previously read EULA? 37 | accept/decline/quit: accept 38 | 39 | 输入`accept`,然后提示你是否安装驱动,因为已经安装了,所以输入`no` 40 | 41 | Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48? 42 | (y)es/(n)o/(q)uit: no 43 | 44 | 最后提示你安装 45 | 46 | Install the CUDA 10.0 Toolkit? 47 | (y)es/(n)o/(q)uit: yes 48 | 49 | 默认安装位置即可 50 | 51 | Enter Toolkit Location 52 | [ default is /usr/local/cuda-10.0 ]: 53 | 54 | 是否安装一个软链接,默认即可 55 | 56 | Do you want to install a symbolic link at /usr/local/cuda? 57 | (y)es/(n)o/(q)uit: yes 58 | 59 | 是否安装实例 60 | 61 | Install the CUDA 10.0 Samples? 62 | (y)es/(n)o/(q)uit: yes 63 | 64 | 可以选择实例位置,默认即可 65 | 66 | Enter CUDA Samples Location 67 | [ default is /home/zj ]: 68 | 69 | 接下来就是安装过程了 70 | 71 | Installing the CUDA Toolkit in /usr/local/cuda-10.0 ... 72 | Missing recommended library: libGLU.so 73 | Missing recommended library: libX11.so 74 | Missing recommended library: libXi.so 75 | Missing recommended library: libXmu.so 76 | Missing recommended library: libGL.so 77 | 78 | Installing the CUDA Samples in /home/zj ... 79 | Copying samples to /home/zj/NVIDIA_CUDA-10.0_Samples now... 80 | Finished copying samples. 81 | 82 | =========== 83 | = Summary = 84 | =========== 85 | 86 | Driver: Not Selected 87 | Toolkit: Installed in /usr/local/cuda-10.0 88 | Samples: Installed in /home/zj, but missing recommended libraries 89 | 90 | Please make sure that 91 | - PATH includes /usr/local/cuda-10.0/bin 92 | - LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root 93 | 94 | To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin 95 | 96 | Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA. 97 | 98 | ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 10.0 functionality to work. 99 | To install the driver using this installer, run the following command, replacing with the name of this run file: 100 | sudo .run -silent -driver 101 | 102 | Logfile is /tmp/cuda_install_6910.log 103 | 104 | 安装失败了,缺少一些库,需要安装相应的库,参考:[ubuntu 16.04 安装cuda 8 出现的错误:Missing recommended library: libGLU.so;Missing recommended library: libX](https://blog.csdn.net/qjk19940101/article/details/78927109) 105 | 106 | sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev 107 | 108 | 再重新安装 109 | 110 | sudo ./cuda_10.0.130_410.48_linux.run -silent -driver 111 | 112 | ### 设置环境变量 113 | 114 | 修改`.bashrc`文件 115 | 116 | sudo gedit ~/.bashrc 117 | 118 | 添加环境变量 119 | 120 | export PATH=$PATH:/usr/local/cuda-10.0/bin 121 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64 122 | 123 | 更新环境变量 124 | 125 | source ~/.bashrc 126 | 127 | 查询版本 128 | 129 | zj@zj-ThinkPad-T470p:~$ nvcc --version 130 | nvcc: NVIDIA (R) Cuda compiler driver 131 | Copyright (c) 2005-2018 NVIDIA Corporation 132 | Built on Sat_Aug_25_21:08:01_CDT_2018 133 | Cuda compilation tools, release 10.0, V10.0.130 134 | 135 | 还可以编译`cuda sample`来查询版本 136 | 137 | cd ~/NVIDIA_CUDA-10.0_Samples/1_Utilities/deviceQuery 138 | make 139 | ./deviceQuery 140 | 141 | ./deviceQuery Starting... 142 | 143 | CUDA Device Query (Runtime API) version (CUDART static linking) 144 | 145 | Detected 1 CUDA Capable device(s) 146 | 147 | Device 0: "GeForce 940MX" 148 | CUDA Driver Version / Runtime Version 10.0 / 10.0 149 | CUDA Capability Major/Minor version number: 5.0 150 | Total amount of global memory: 2004 MBytes (2101870592 bytes) 151 | ( 3) Multiprocessors, (128) CUDA Cores/MP: 384 CUDA Cores 152 | GPU Max Clock rate: 1189 MHz (1.19 GHz) 153 | Memory Clock rate: 2505 Mhz 154 | Memory Bus Width: 64-bit 155 | L2 Cache Size: 1048576 bytes 156 | Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096) 157 | Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers 158 | Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers 159 | Total amount of constant memory: 65536 bytes 160 | Total amount of shared memory per block: 49152 bytes 161 | Total number of registers available per block: 65536 162 | Warp size: 32 163 | Maximum number of threads per multiprocessor: 2048 164 | Maximum number of threads per block: 1024 165 | Max dimension size of a thread block (x,y,z): (1024, 1024, 64) 166 | Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535) 167 | Maximum memory pitch: 2147483647 bytes 168 | Texture alignment: 512 bytes 169 | Concurrent copy and kernel execution: Yes with 1 copy engine(s) 170 | Run time limit on kernels: No 171 | Integrated GPU sharing Host Memory: No 172 | Support host page-locked memory mapping: Yes 173 | Alignment requirement for Surfaces: Yes 174 | Device has ECC support: Disabled 175 | Device supports Unified Addressing (UVA): Yes 176 | Device supports Compute Preemption: No 177 | Supports Cooperative Kernel Launch: No 178 | Supports MultiDevice Co-op Kernel Launch: No 179 | Device PCI Domain ID / Bus ID / location ID: 0 / 2 / 0 180 | Compute Mode: 181 | < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > 182 | 183 | deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.0, CUDA Runtime Version = 10.0, NumDevs = 1 184 | Result = PASS 185 | 186 | --- 187 | 188 | ## `cudnn`安装 189 | 190 | *需要注册一个账户才能下载`cudnn`* 191 | 192 | 到官网下载对应的包:[cuDNN Archive](https://developer.nvidia.com/rdp/cudnn-archive) 193 | 194 | 我的系统是`Ubuntu16.04`, 符合条件的有 195 | 196 | cuDNN Runtime Library for Ubuntu16.04 (Deb) 197 | cuDNN Developer Library for Ubuntu16.04 (Deb) 198 | cuDNN Code Samples and User Guide for Ubuntu16.04 (Deb) 199 | 200 | 下载完成后安装 201 | 202 | sudo dpkg -i libcudnn7*.deb 203 | 204 | 或者下载通用`linux`压缩包 205 | 206 | cuDNN Library for Linux 207 | 208 | 然后将文件复制到`cuda`安装路径下,参考:[How can I install CuDNN on Ubuntu 16.04?](https://askubuntu.com/questions/767269/how-can-i-install-cudnn-on-ubuntu-16-04) 209 | 210 | ### 验证cudnn 211 | 212 | 参考:[How to install CUDA and cuDNN on Ubuntu 16.04 LTS](https://blog.codingecho.com/2018/02/19/how-to-install-cuda-and-cudnn-on-ubuntu-16-04-lts/) 213 | 214 | 查询`cudnn`安装文件地址 215 | 216 | sudo updatedb 217 | locate cudnn 218 | 219 | 将测试文件复制到`home`目录下 220 | 221 | cp -r /usr/src/cudnn_samples_v7/ $HOME/cudnn_samples_v7/ 222 | cd cudnn_samples_v7/mnistCUDNN/ 223 | make clean && make 224 | ./mnistCUDNN 225 | 226 | 测试结果 227 | 228 | cudnnGetVersion() : 7401 , CUDNN_VERSION from cudnn.h : 7401 (7.4.1) 229 | Host compiler version : GCC 5.4.0 230 | There are 1 CUDA capable devices on your machine : 231 | device 0 : sms 3 Capabilities 5.0, SmClock 1189.0 Mhz, MemSize (Mb) 2004, MemClock 2505.0 Mhz, Ecc=0, boardGroupID=0 232 | Using device 0 233 | ... 234 | ... 235 | Test passed! 236 | 237 | 使用第二种复制`cudnn`文件方法的可以参考:[How to verify CuDNN installation?](https://stackoverflow.com/questions/31326015/how-to-verify-cudnn-installation) -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 16.04]Thunderbird邮箱配置.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 16.04]Thunderbird邮箱配置 3 | 4 | 参考:[使用技巧](https://support.mozilla.org/zh-CN/products/thunderbird/tips-and-tricks) 5 | 6 | `Thunderbird`是`Ubuntu 16.04`默认使用的邮箱客户端,记录一下如何进行`163`邮箱的程序设置 7 | 8 | ## `IMAP vs POP3` 9 | 10 | 参考: 11 | 12 | [POP3](https://baike.baidu.com/item/POP3/175122?fr=aladdin) 13 | 14 | [imap](https://baike.baidu.com/item/imap/350154?fr=aladdin) 15 | 16 | [IMAP 同步](https://support.mozilla.org/zh-CN/kb/imap) 17 | 18 | [IMAP和POP3有什么区别?](http://help.163.com/10/0203/13/5UJONJ4I00753VB8.html) 19 | 20 | `POP3(Post Office Protocol - Version 3)`,指`邮局协议版本3`,使用端口号为`110` 21 | 22 | `IMAP(Internet Mail Access Protocol)`,指`因特网邮件访问协议`(或称为`交互邮件访问协议`),使用端口号为`143` 23 | 24 | `IMAP`和`POP3`都属于`TCP/IP`协议族,用于邮件客户端对服务器邮件的获取。`IMAP`相对于`POP3`的优点在于`IMAP`允许客户端和服务器保持双向通信,而`POP3`仅允许客户端对服务器的单向通信 25 | 26 | POP3协议允许电子邮件客户端下载服务器上的邮件,但是在客户端的操作(如移动邮件、标记已读等),不会反馈到服务器上,比如通过客户端收取了邮箱中的3封邮件并移动到其他文件夹,邮箱服务器上的这些邮件是没有同时被移动的 。 27 | 而IMAP提供webmail 与电子邮件客户端之间的双向通信,客户端的操作都会反馈到服务器上,对邮件进行的操作,服务器上的邮件也会做相应的动作。 28 | 29 | ### 启用`IMAP` 30 | 31 | 参考:[使用 IMAP 在其他电子邮件客户端上查看 Gmail](https://support.google.com/mail/answer/7126229?visit_id=636863274743440829-2233231335&rd=1) 32 | 33 | 对于`163`邮箱,需要在`设置->POP3/SMTP/IMAP`中启用`IMAP/SMTP`服务 34 | 35 | 对于`gmail`邮箱,需要在`设置->转发和POP/IMAP`中启用`IMAP`服务 36 | 37 | ## 163邮箱设置 38 | 39 | 点击菜单项`File->New->Existing Email Account`,跳出登录框 40 | 41 | ![](./imgs/existing-email.png) 42 | 43 | 输入姓名、`Email`地址和密码,点击`Continue` 44 | 45 | ![](./imgs/imap.png) 46 | 47 | 选择`IMAP(remote folders)`模式,点击`Done`即完成设置 48 | 49 | ### `163` 50 | 51 | 参考:[网易163邮箱无法使用第三方客户端登录问题解决](https://blog.csdn.net/u013401853/article/details/69366360) 52 | 53 | 输入的密码是`客户端授权密码`,需要登录163邮箱,在菜单项`设置`中编辑`客户端授权密码` 54 | 55 | ![](./imgs/163-password.png) 56 | 57 | ## 系统默认邮箱设置 58 | 59 | 参考:[使 Thunderbird 成为默认邮件客户端](https://support.mozilla.org/zh-CN/kb/%E4%BD%BFThunderbird%E6%88%90%E4%B8%BA%E9%BB%98%E8%AE%A4%E9%82%AE%E4%BB%B6%E5%AE%A2%E6%88%B7%E7%AB%AF) 60 | 61 | 进入系统设置页面,选择`Details->Default Applications->Mail`,选择`Thunderbird`邮箱即可 62 | 63 | ![](./imgs/system-email.png) -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 16.04]VMware安装.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 16.04]VMware安装 3 | 4 | 在`Ubuntu`上安装`vmware`后遇到了一些问题,总结一下 5 | 6 | ## `VMWare WorkStation Pro`下载 7 | 8 | 官网下载地址:[Try VMware Workstation Pro](https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html) 9 | 10 | ## 安装 11 | 12 | 下载完成后得到一个`.bundle`文件 13 | 14 | VMware-Workstation-Full-15.0.2-10952284.x86_64.bundle 15 | 16 | 赋予用户权限 17 | 18 | sudo chmod a+x VMware*.bundle 19 | 20 | 安装 21 | 22 | sudo ./VMware*.bundle 23 | 24 | ## 问题:`could not open /dev/vmmon...` 25 | 26 | 新建一个虚拟机后,设置`win10 ISO`文件,开始安装,遇到如下问题 27 | 28 | could not open /dev/vmmon... 29 | 30 | 有两种解决方案 31 | 32 | 方案一是直接在`BIOS`中关闭安全启动(`secure boot)`选项 33 | 34 | 方案二参考 35 | 36 | [VMWare 15 Error on Ubuntu 18.4 - Could not open /dev/vmmon: No such file or directory](https://askubuntu.com/questions/1096052/vmware-15-error-on-ubuntu-18-4-could-not-open-dev-vmmon-no-such-file-or-dire) 37 | 38 | [VMware Workstation 12 vmmon not found or not loaded](https://askubuntu.com/questions/707281/vmware-workstation-12-vmmon-not-found-or-not-loaded) 39 | 40 | 其原理是安全启动模式下`vmware`的一些核心模块没有被写入,需要设置信任列表 41 | 42 | 第一步:生产`.priv`和`.der`文件 43 | 44 | openssl req -new -x509 -newkey rsa:2048 -keyout zj-vmware.priv -outform DER -out zj-vmware.der -nodes -days 36500 -subj "/CN=VMWARE/" 45 | 46 | 第二步: 47 | 48 | sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./zj-vmware.priv ./zj-vmware.der $(modinfo -n vmmon) 49 | sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./zj-vmware.priv ./zj-vmware.der $(modinfo -n vmnet) 50 | 51 | 第三步: 52 | 53 | sudo mokutil --import zj-vmware.der 54 | # 然后输入两次密码(自定义) 55 | 56 | 重启之后会进入蓝色界面,需要你手动写入签名 57 | 58 | 1. 选择`enroll mok ` 59 | 2. 选择`continue` 60 | 3. 选择 `yes` 61 | 4. 输入之前设置的密码 62 | 5. 选择`reboot` 63 | 64 | 测试你是否写入签名 65 | 66 | zj@zj-ThinkPad-T470p:~/software/vmware/mok$ mokutil --test-key zj-vmware.der 67 | zj-vmware.der is already enrolled 68 | 69 | ## `Win10`安装 70 | 71 | `win10`官网下载地址:[win10 ISO](https://www.microsoft.com/zh-cn/software-download/windows10ISO/) 72 | 73 | `win10`注册码:[用真正的序列号永久激活win10教程](http://www.xitongcheng.com/jiaocheng/win10_article_45002.html) 74 | 75 | `win10`安装完成后再安装`vmware tools` 76 | 77 | 打开vmware菜单栏->VM->Install VMware Tools 78 | 79 | 没有自动适配屏幕就参考[VMware问题 ,我装了WIN10也装了VMTools,依然没法自动适应窗口?](http://ask.zol.com.cn/x/3585482.html) 80 | 81 | 打开vmware菜单栏->edit->Preferences->Display,点击Autofit guest -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 16.04]开放热点.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 16.04]开放热点 3 | 4 | 参考: 5 | 6 | [Ubuntu 16.04 创建无线热点](https://blog.csdn.net/ac_dao_di/article/details/71908444) 7 | 8 | [How to create wifi hotspot in Ubuntu 16.04 since AP-Hotspot is no longer working](https://askubuntu.com/questions/762846/how-to-create-wifi-hotspot-in-ubuntu-16-04-since-ap-hotspot-is-no-longer-working) 9 | 10 | 利用笔记本开放`wifi`热点,当前系统为`Ubuntu 16.04` 11 | 12 | ## 是否支持热点 13 | 14 | 通过工具`iw`实现 15 | 16 | iw list | grep -i ap 17 | 18 | zj@zj-ThinkPad-T470p:/etc/NetworkManager/system-connections$ iw list | grep -i ap 19 | Device supports AP-side u-APSD. 20 | * AP 21 | * AP/VLAN 22 | Capabilities: 0x11ef 23 | Capabilities: 0x11ef 24 | VHT Capabilities (0x039071b0): 25 | * start_ap 26 | * set_noack_map 27 | * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0 28 | * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0 29 | * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0 30 | * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0 31 | * wake up on EAP identity request 32 | * AP/VLAN 33 | * #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1, 34 | HT Capability overrides: 35 | Driver supports full state transitions for AP/GO clients 36 | Driver/device bandwidth changes during BSS lifetime (AP/GO mode) 37 | 38 | 如果存在支持`AP`配置那么就可以开放热点 39 | 40 | ## 创建热点 41 | 42 | 点击右上角网络图标,选择`Edit Connections...` 43 | 44 | ![](./imgs/network-connections.png) 45 | 46 | 选择`Add->WIFI` 47 | 48 | ![](./imgs/type-wifi.png) 49 | 50 | 修改`Connection name` 51 | 52 | 在`Wi-Fi`目录下添加`SSID`(热点名),`Mode`改为`Hotspot` 53 | 54 | ![](./imgs/Wi-Fi.png) 55 | 56 | 在`Wi-Fi Security`目录下的`Security`选择`WPA & WPA2 Personal`,并添加密码(**注意:密码至少要包括英文、数字和符号的其中两种,否则无法保存**) 57 | 58 | ![](./imgs/wifi-security.png) 59 | 60 | 在`IPv4 Settings`目录下的`Method`选择`Shared to other computers` 61 | 62 | ![](./imgs/wifi-ipv4.png) 63 | 64 | 保存后关闭设置窗口 65 | 66 | ## 启动热点 67 | 68 | **注意 1:之前在`Win10`环境下可以同时连接`wifi`和开放热点,但是在`Ubuntu`环境下只能在连接有线网络的环境下开放热点** 69 | 70 | **注意 2:开放热点会屏蔽掉其他`wifi`,重启网络服务即可** 71 | 72 | sudo service network-manager restart 73 | 74 | 连接有线网络,点击`Connect to Hidden Wi-Fi network`,选择刚才创建的热点 75 | 76 | ![](./imgs/open-hotspot.png) 77 | 78 | 点击`Connect`即可,在`Connection Information`中可以查看 79 | 80 | ![](./imgs/hotspot-info.png) 81 | 82 | 创建的信息保存在 83 | 84 | /etc/NetworkManager/system-connections 85 | 86 | 完整信息如下 87 | 88 | [connection] 89 | id=aaa 90 | uuid=fcb29483-f14b-410c-ad06-519be984bdf2 91 | type=wifi 92 | permissions= 93 | secondaries= 94 | 95 | [wifi] 96 | mac-address-blacklist= 97 | mac-address-randomization=0 98 | mode=ap 99 | seen-bssids= 100 | ssid=aaa 101 | 102 | [wifi-security] 103 | group= 104 | key-mgmt=wpa-psk 105 | pairwise= 106 | proto= 107 | psk=zj123456 108 | 109 | [ipv4] 110 | dns-search= 111 | method=shared 112 | 113 | [ipv6] 114 | addr-gen-mode=stable-privacy 115 | dns-search= 116 | ip6-privacy=0 117 | method=ignore 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 16.04]桌面美化.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 16.04]桌面美化 3 | 4 | 参考: 5 | 6 | [ubuntu16.04修改主题的两种方式](https://jingyan.baidu.com/article/495ba841dac83e38b30ede3b.html) 7 | 8 | [Ubuntu 16.04简易美化教程](https://www.cnblogs.com/figowho/p/7895718.html) 9 | 10 | [Ubuntu16.04下的主题美化(超级完整!)](https://blog.csdn.net/X_kh_2001/article/details/81126644) 11 | 12 | ## 安装`unity-tweak-tool` 13 | 14 | sudo apt-get install unity-tweak-tool 15 | 16 | `unity-tweak-tool`是一个`unity`桌面的设置管理器,它能够提供便捷的桌面设置 17 | 18 | ![](./imgs/16.04-desktop/unity-tweak-tool.png) 19 | 20 | 安装完成后可从搜索栏找到或命令行输入`unity-tweak-tool` 21 | 22 | *对于`Ubuntu18.04`应该安装`gnome-tweak-tool`* 23 | 24 | ## 安装主题和图标 25 | 26 | ### `Flatabulous`主题和`Ultra-flat`图标 27 | 28 | sudo add-apt-repository ppa:noobslab/themes 29 | sudo apt-get update 30 | sudo apt-get install flatabulous-theme 31 | 32 | sudo add-apt-repository ppa:noobslab/icons 33 | sudo apt-get update 34 | sudo apt-get install ultra-flat-icons 35 | 36 | 更多主题可取官网下载:[Gnome](https://www.gnome-look.org/browse/) 37 | 38 | 打开`unity-tweak-tool` 39 | 40 | 点击`Theme`,选择`Flatabolous`主题 41 | 42 | 点击`Icons`,选择`Ultra-flat`主题 43 | 44 | ### Numix daily主题和Numix图标 45 | 46 | 参考:[Ubuntu下使用Unity Tweak Tool 安装Numix图标主题](https://www.linuxidc.com/Linux/2015-09/123585.htm) 47 | 48 | sudo apt-add-repository ppa:numix/ppa 49 | sudo apt-get update 50 | sudo apt-get install numix-icon-theme-circle 51 | sudo apt-get install numix-gtk-theme 52 | 53 | ## 设置桌面背景 54 | 55 | 从[wallpaper](https://www.google.com/search?client=ubuntu&channel=fs&biw=1920&bih=896&tbm=isch&sa=1&ei=k6A5XOvDD-ab0gKX6pTIBw&q=wallpaper&oq=wallpaper&gs_l=img.3...0.0..1680055...0.0..0.0.0.......0......gws-wiz-img.fuTHKZduT7g)或者[WallPapers](https://www.gnome-look.org/browse/cat/300/)下载图片 56 | 57 | 然后点击图片,右键设置为背景即可 58 | 59 | ## 设置命令行窗口 60 | 61 | 打开一个命令行窗口,点击`Edit->Preferences`,选择`Profiles->News`,新建一个`Profile` 62 | 63 | ![](./imgs/16.04-desktop/profile.png) 64 | 65 | 选择`Colors->Text and Background Color->Use transparent background`,拖动滑动条来设置背景透明度 66 | 67 | 保存该设置后退出,点击菜单栏`Terminal->Change Profile`,选择新建的`profile` -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 18.04]PPA方式安装Nvidia驱动.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 18.04]PPA方式安装Nvidia驱动 3 | 4 | 参考: 5 | 6 | [Ubuntu18.04安装Nvidia显卡驱动教程](https://blog.csdn.net/weixin_43820996/article/details/100676292) 7 | 8 | [Ubuntu 18.04安装NVIDIA显卡驱动教程](https://www.linuxidc.com/Linux/2019-02/157170.htm) 9 | 10 | 之前都是通过手动方式安装`Nvidia`驱动,这一次尝试`PPA`方式安装,操作更加简单 11 | 12 | ## 禁用nouveau 13 | 14 | 安装`Nvidia`驱动之前需要禁用`nouveau` 15 | 16 | ``` 17 | $ sudo vim /etc/modprobe.d/blacklist-nouveau.conf 18 | ``` 19 | 20 | 添加以下两条语句 21 | 22 | ``` 23 | blacklist nouveau 24 | options nouveau modeset=0 25 | ``` 26 | 27 | 更新内核并重启 28 | 29 | ``` 30 | $ sudo update-initramfs -u 31 | $ sudo reboot 32 | ``` 33 | 34 | 可以查询是否已禁用 35 | 36 | ``` 37 | $ lspci | grep nouveau 38 | ``` 39 | 40 | ## 安装Nvidia驱动 41 | 42 | 添加`PPA`源 43 | 44 | ``` 45 | $ sudo add-apt-repository ppa:graphics-drivers/ppa 46 | ``` 47 | 48 | 查询当前适用版本 49 | 50 | ``` 51 | $ ubuntu-drivers devices 52 | 53 | == /sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0 == 54 | modalias : pci:v000010DEd0000134Dsv000017AAsd0000505Ebc03sc02i00 55 | vendor : NVIDIA Corporation 56 | model : GM108M [GeForce 940MX] 57 | driver : nvidia-driver-410 - third-party free 58 | driver : nvidia-driver-415 - third-party free 59 | driver : nvidia-driver-430 - distro non-free 60 | driver : nvidia-driver-435 - distro non-free 61 | driver : nvidia-driver-390 - third-party free 62 | driver : nvidia-driver-440 - third-party free recommended 63 | driver : xserver-xorg-video-nouveau - distro free builtin 64 | ``` 65 | 66 | 当前适用`440`版本(通过官网[drivers](https://www.geforce.cn/drivers)查询可知该版本是最新版本),自动安装 67 | 68 | ``` 69 | $ sudo ubuntu-drivers autoinstall 70 | ``` 71 | 72 | 安装完成后重启,即完成`Nvidia`驱动安装 73 | 74 | ``` 75 | $ sudo reboot 76 | $ nvidia-smi 77 | Tue Dec 3 12:58:08 2019 78 | +-----------------------------------------------------------------------------+ 79 | | NVIDIA-SMI 440.26 Driver Version: 440.26 CUDA Version: 10.2 | 80 | |-------------------------------+----------------------+----------------------+ 81 | | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | 82 | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | 83 | |===============================+======================+======================| 84 | | 0 GeForce 940MX Off | 00000000:02:00.0 Off | N/A | 85 | | N/A 41C P0 N/A / N/A | 385MiB / 2004MiB | 6% Default | 86 | +-------------------------------+----------------------+----------------------+ 87 | 88 | +-----------------------------------------------------------------------------+ 89 | | Processes: GPU Memory | 90 | | GPU PID Type Process name Usage | 91 | |=============================================================================| 92 | | 0 1165 G /usr/lib/xorg/Xorg 24MiB | 93 | | 0 1629 G /usr/bin/gnome-shell 46MiB | 94 | | 0 1893 G /usr/lib/xorg/Xorg 156MiB | 95 | | 0 2085 G /usr/bin/gnome-shell 121MiB | 96 | | 0 2963 G /usr/lib/firefox/firefox 0MiB | 97 | | 0 3663 G ...uest-channel-token=10978559456542000038 29MiB | 98 | +-----------------------------------------------------------------------------+ 99 | ``` 100 | 101 | *已同时安装了`cuda`* 102 | -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 18.04]VMware安装.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 18.04]VMware安装 3 | 4 | 参考:[在ubuntu18.04上安装vmware](https://blog.csdn.net/qq_43658650/article/details/86663326) 5 | 6 | 在`Ubuntu 18.04`上安装`VMware`,之前虽然在`16.04`上安装过([[Ubuntu 16.04]VMware安装](./[Ubuntu 16.04]VMware安装.md)),但是这次操作发现还有一些需要调整的地方 7 | 8 | ## 下载 9 | 10 | 一定要去官网下载最新版本:[Try VMware Workstation Pro](https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html) 11 | 12 | 当前使用: 13 | 14 | ``` 15 | $ vmware-installer -l 16 | Product Name Product Version 17 | ==================== ==================== 18 | vmware-workstation 15.5.1.15018445 19 | ``` 20 | 21 | ## 必备条件 22 | 23 | 安装以下应用: 24 | 25 | ``` 26 | $ sudo apt install gcc g++ libcanberra-gtk-module build-essential 27 | ``` 28 | 29 | ## 安装 30 | 31 | 首先赋予执行权限 32 | 33 | ``` 34 | $ sudo chmod a+x VMware-Workstation-Full-15.5.1-15018445.x86_64.bundle 35 | ``` 36 | 37 | 然后进行安装 38 | 39 | ``` 40 | $ sudo ./VMware-Workstation-Full-15.5.1-15018445.x86_64.bundle 41 | Extracting VMware Installer...done. 42 | Installing VMware Installer 3.0.0 43 | ... 44 | ... 45 | Installing VMware Workstation 15.5.1 46 | Copying files... 47 | Configuring... 48 | Installation was successful. 49 | ``` 50 | 51 | 安装完成后启动`VMware`,进入图形界面进行配置即可 52 | 53 | ## 卸载 54 | 55 | 参考:[有关于ubuntu16.04 卸载vmware](https://blog.csdn.net/smile_5me/article/details/80799328) 56 | 57 | ``` 58 | $ sudo vmware-installer --uninstall-product vmware-workstation 59 | ``` 60 | 61 | ## 服务设置 62 | 63 | 安装完`VMWare`之后,默认开启了`3`个服务 64 | 65 | ``` 66 | vmware.service vmware-workstation-server.service 67 | vmware-USBArbitrator.service 68 | ``` 69 | 70 | 禁止`VMWare`相关服务自启动 71 | 72 | ``` 73 | # 禁止开机自启动 74 | $ sudo systemctl disable xxx 75 | # 停止服务 76 | $ sudo systemctl stop xxx 77 | ``` 78 | 79 | ## could not open /dev/vmmon:???????? 80 | 81 | 打开`vmware`时会出现`could not open /dev/vmmon:????????.`错误 82 | 83 | * 解决一:参考[关于ubuntu安装VMware出现“could not open /dev/vmmon:????????.”的解决方法-已解决](https://blog.csdn.net/weixin_40894428/article/details/84843199) 84 | * 解决二:查看是否`vmware`相关的`service`是否被关闭了,重新启动即可解决 -------------------------------------------------------------------------------- /docs/configure/[Ubuntu 18.04]桌面美化.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu 18.04]桌面美化 3 | 4 | 参考:[ubuntu18.04美化主题(完整版)](https://blog.csdn.net/qq_42527676/article/details/91356154) 5 | 6 | 从`Ubuntu 16.04`升级到了`Ubuntu 18.04`,`Ubuntu 16.04`默认使用`Unity`作为桌面,而`Ubuntu 18.04`默认使用`Gnome`,所以需要重新开始桌面配置 7 | 8 | ## 安装 9 | 10 | ``` 11 | $ sudo apt install gnome-tweak-tool gnome-shell-extensions 12 | ``` 13 | 14 | 即可从菜单栏中打开优化(`Tweaks`)工具 15 | 16 | ## 预配置 17 | 18 | 打开配置工具后如果发现`外观 -> Shell`选项有一个感叹号,需要先去除,否则无法配置这个地方 19 | 20 | 参考[ubnutu桌面环境Gnome 配置tweak tool时看不到extension插件选项](https://blog.csdn.net/ksws0292756/article/details/79936965),先注销当前用户,然后在登录界面找到一个齿轮图标,点击后选择`GNOME`主题,即可去除感叹号 21 | 22 | ## 配置 23 | 24 | 主要配置三个部分: 25 | 26 | 1. 主题 27 | 2. 图标 28 | 3. 任务栏 29 | 30 | ### 主题 31 | 32 | 从网站[ping GTK3 Themes](https://www.pling.com/browse/cat/135/order/latest/)中选择自己喜欢的主题,下载安装包,解压后放置在`/usr/share/themes`路径下。当前使用主题[Aurora-Nuevo-Blue](https://www.pling.com/p/1283611/) 33 | 34 | ![](./imgs/18.04-desktop/theme.png) 35 | 36 | 打开配置工具,右侧类别中选择`扩展`,打开`User themes`选项;选择右侧类别`外观`,在`应用程序`中选择`Aurora-Nuevo-Blue`,在`Shell`中选择`Aurora-Nuevo-Blue` 37 | 38 | ![](./imgs/18.04-desktop/appearance.png) 39 | 40 | ### 图标 41 | 42 | 从网站[ping Full icon Themes](https://www.pling.com/s/Gnome/browse/cat/132/order/latest/)中选择自己喜欢的图标,同样下载安装包,解压后放置在`/usr/share/icons`路径下.当前使用图标[Emerald](https://www.pling.com/s/Gnome/p/1012534) 43 | 44 | ![](./imgs/18.04-desktop/icons.png) 45 | 46 | 打开配置工具,选择右侧类别`外观`,在`图标`中选择`Emerald` 47 | 48 | ### 任务栏 49 | 50 | 打开配置工具,选择右侧类别`扩展`,打开选项`Dash to panel`,点击配置图标 51 | 52 | ![](./imgs/18.04-desktop/panel.png) 53 | 54 | 根据自己需求选择面板位置、任务栏位置、是否显示日期等等 55 | 56 | ![](./imgs/18.04-desktop/panel-configure.png) -------------------------------------------------------------------------------- /docs/configure/apt-升级操作.md: -------------------------------------------------------------------------------- 1 | 2 | # [apt]升级操作 3 | 4 | 使用工具`apt`进行应用升级,以`VSCode`为例 5 | 6 | ## 查询 7 | 8 | 查询指定应用的升级信息 9 | 10 | ``` 11 | $ apt list --upgradable | grep code 12 | 13 | WARNING: apt does not have a stable CLI interface. Use with caution in scripts. 14 | 15 | chromium-codecs-ffmpeg-extra/bionic-security,bionic-updates 79.0.3945.79-0ubuntu0.18.04.1 amd64 [可从该版本升级:78.0.3904.108-0ubuntu0.18.04.1] 16 | code/stable 1.41.1-1576681836 amd64 [可从该版本升级:1.40.2-1574694120] 17 | intel-microcode/bionic-security,bionic-updates 3.20191115.1ubuntu0.18.04.2 amd64 [可从该版本升级:3.20191115.1ubuntu0.18.04.1] 18 | libnvidia-decode-440/bionic 440.44-0ubuntu0~0.18.04.1 amd64 [可从该版本升级:440.26-0ubuntu0~gpu18.04.2] 19 | libnvidia-encode-440/bionic 440.44-0ubuntu0~0.18.04.1 amd64 [可从该版本升级:440.26-0ubuntu0~gpu18.04.2] 20 | ``` 21 | 22 | 从中可发现`vscode`可以从当前的`1.40.2-1574694120`升级到`1.41.1-1576681836` 23 | 24 | ## 升级 25 | 26 | 升级全部的应用 27 | 28 | ``` 29 | $ sudo apt upgrade 30 | ``` 31 | 32 | 升级指定的应用 33 | 34 | ``` 35 | $ sudo apt install code 36 | 正在读取软件包列表... 完成 37 | 正在分析软件包的依赖关系树 38 | 正在读取状态信息... 完成 39 | 下列软件包是自动安装的并且现在不需要了: 40 | fcitx-libs fonts-liberation2 fonts-opensymbol gstreamer1.0-gtk3 libabw-0.1-1 libboost-date-time1.65.1 libboost-filesystem1.65.1 libboost-iostreams1.65.1 41 | libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 42 | libexttextcat-2.0-0 libexttextcat-data libfcitx-qt0 libfreehand-0.1-1 liblangtag-common liblangtag1 libllvm8 libmhash2 libmspub-0.1-1 libmwaw-0.3-3 libmythes-1.2-0 43 | libneon27-gnutls libodfgen-0.1-1 libopencc2 libopencc2-data liborcus-0.13-0 libpagemaker-0.0-0 libqt4-opengl libqtwebkit4 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 44 | libsuitesparseconfig5 libvisio-0.1-1 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure 45 | 使用'sudo apt autoremove'来卸载它(它们)。 46 | 下列软件包将被升级: 47 | code 48 | 升级了 1 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 94 个软件包未被升级。 49 | 需要下载 57.5 MB 的归档。 50 | 解压缩后会消耗 5,707 kB 的额外空间。 51 | ``` -------------------------------------------------------------------------------- /docs/configure/imgs/16.04-desktop/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/16.04-desktop/profile.png -------------------------------------------------------------------------------- /docs/configure/imgs/16.04-desktop/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/16.04-desktop/unity-tweak-tool.png -------------------------------------------------------------------------------- /docs/configure/imgs/163-password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/163-password.png -------------------------------------------------------------------------------- /docs/configure/imgs/18.04-desktop/appearance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/18.04-desktop/appearance.png -------------------------------------------------------------------------------- /docs/configure/imgs/18.04-desktop/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/18.04-desktop/icons.png -------------------------------------------------------------------------------- /docs/configure/imgs/18.04-desktop/panel-configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/18.04-desktop/panel-configure.png -------------------------------------------------------------------------------- /docs/configure/imgs/18.04-desktop/panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/18.04-desktop/panel.png -------------------------------------------------------------------------------- /docs/configure/imgs/18.04-desktop/theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/18.04-desktop/theme.png -------------------------------------------------------------------------------- /docs/configure/imgs/Wi-Fi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/Wi-Fi.png -------------------------------------------------------------------------------- /docs/configure/imgs/existing-email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/existing-email.png -------------------------------------------------------------------------------- /docs/configure/imgs/hotspot-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/hotspot-info.png -------------------------------------------------------------------------------- /docs/configure/imgs/imap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/imap.png -------------------------------------------------------------------------------- /docs/configure/imgs/network-connections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/network-connections.png -------------------------------------------------------------------------------- /docs/configure/imgs/open-hotspot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/open-hotspot.png -------------------------------------------------------------------------------- /docs/configure/imgs/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/preferences.png -------------------------------------------------------------------------------- /docs/configure/imgs/profiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/profiles.png -------------------------------------------------------------------------------- /docs/configure/imgs/scrolling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/scrolling.png -------------------------------------------------------------------------------- /docs/configure/imgs/system-email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/system-email.png -------------------------------------------------------------------------------- /docs/configure/imgs/system-monitor-process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/system-monitor-process.png -------------------------------------------------------------------------------- /docs/configure/imgs/type-wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/type-wifi.png -------------------------------------------------------------------------------- /docs/configure/imgs/wifi-ipv4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/wifi-ipv4.png -------------------------------------------------------------------------------- /docs/configure/imgs/wifi-security.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/configure/imgs/wifi-security.png -------------------------------------------------------------------------------- /docs/configure/locale-字符集设置.md: -------------------------------------------------------------------------------- 1 | 2 | # [LOCALE]字符集设置 3 | 4 | 使用`docker ubuntu`系统时发现无法在`bash`上输入中文,以及中文文件乱码问题,查阅了相关资料,发现是因为字符集的关系 5 | 6 | ## 查询 7 | 8 | 使用命令`locale`进行字符集查询 9 | 10 | 查询当前已缓存字符集 11 | 12 | ``` 13 | $ locale -a 14 | C 15 | C.UTF-8 16 | POSIX 17 | zh_CN.utf8 18 | ``` 19 | 20 | 查询当前使用的字符集 21 | 22 | ``` 23 | $ locale 24 | LANG=zh_CN.UTF-8 25 | LANGUAGE=zh_CN.UTF-8 26 | LC_CTYPE="zh_CN.UTF-8" 27 | LC_NUMERIC="zh_CN.UTF-8" 28 | LC_TIME="zh_CN.UTF-8" 29 | LC_COLLATE="zh_CN.UTF-8" 30 | LC_MONETARY="zh_CN.UTF-8" 31 | LC_MESSAGES="zh_CN.UTF-8" 32 | LC_PAPER="zh_CN.UTF-8" 33 | LC_NAME="zh_CN.UTF-8" 34 | LC_ADDRESS="zh_CN.UTF-8" 35 | LC_TELEPHONE="zh_CN.UTF-8" 36 | LC_MEASUREMENT="zh_CN.UTF-8" 37 | LC_IDENTIFICATION="zh_CN.UTF-8" 38 | LC_ALL=zh_CN.UTF-8 39 | ``` 40 | 41 | 各个键值函数参考[Locale](https://help.ubuntu.com/community/Locale) 42 | 43 | * `LANG`:为未显式设置的`LC_*`变量提供默认值 44 | * `LC_ALL`:重写单个`LC_*`设置:如果设置了`LC_ALL`,则以下任何一项都不会有任何效果 45 | 46 | ## /etc/default/locale 47 | 48 | 当前使用的字符集设置保存在文件`/etc/default/locale`中 49 | 50 | ``` 51 | $ cat /etc/default/locale 52 | # File generated by update-locale 53 | LANG=zh_CN.UTF-8 54 | LANGUAGE=zh_CN.UTF-8 55 | LC_ALL=zh_CN.UTF-8 56 | ``` 57 | 58 | ## 设置zh_CN.UTF-8字符集 59 | 60 | 首先使用`locale -a`查询本地是否已安装`zh_CN.UTF-8`,如果没有需要下载 61 | 62 | ``` 63 | $ locale-gen zh_CN.UTF-8 64 | ``` 65 | 66 | 下载完成后更新配置文件 67 | 68 | ``` 69 | $ update-locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 70 | ``` 71 | 72 | 同时设置环境变量 73 | 74 | ``` 75 | # 修改文件/etc/profile 76 | $ sudo vim /etc/profile 77 | ... 78 | export LANG=zh_CN.UTF-8 79 | export LANGUAGE=zh_CN.UTF-8 80 | export LC_ALL=zh_CN.UTF-8 81 | ``` 82 | 83 | 重启后即可完成`zh_CN.UTF-8`字符集设置 84 | 85 | *对于`en_US.UTF-8`字符集的设置类似* 86 | 87 | ## 无字符集设置 88 | 89 | 没有`/etc/default/locale`文件,`locale`查询结果如下: 90 | 91 | ``` 92 | $ locale -a 93 | C 94 | C.UTF-8 95 | POSIX 96 | ``` 97 | 98 | 表明当前系统没有区域设置。首先安装配置文件和工具 99 | 100 | ``` 101 | $ sudo apt-get install locales 102 | ``` 103 | 104 | 其次使用上面的配置流程进行区域配置 105 | 106 | ## 相关阅读 107 | 108 | * [No locale set](https://www.thomas-krenn.com/en/wiki/Configure_Locales_in_Ubuntu) -------------------------------------------------------------------------------- /docs/configure/localtime-设置时区.md: -------------------------------------------------------------------------------- 1 | 2 | # [localtime]设置时区 3 | 4 | ## 查询当前时间 5 | 6 | 使用命令`date`可查询当前时间 7 | 8 | ``` 9 | $ date 10 | 2019年 10月 05日 星期六 09:50:58 CST 11 | ``` 12 | 13 | ## 查询当前时区 14 | 15 | ### localtime 16 | 17 | 文件`/etc/localtime`链接了当前所使用的时区 18 | 19 | ``` 20 | $ file /etc/localtime 21 | /etc/localtime: symbolic link to /usr/share/zoneinfo/Asia/Shanghai 22 | ``` 23 | 24 | ### timezone 25 | 26 | 文件`/etc/timezone`保存了当前所使用时区 27 | 28 | ``` 29 | $ cat /etc/timezone 30 | Asia/Shanghai 31 | ``` 32 | 33 | ## 时区设置 34 | 35 | 使用命令`dpkg-reconfigure`进行时区设置 36 | 37 | ### 交互方式 38 | 39 | ``` 40 | $ sudo apt-get install tzdata 41 | $ sudo dpkg-reconfigure tzdata 42 | ... 43 | ... 44 | Current default time zone: 'Asia/Shanghai' 45 | Local time is now: 2019年 10月 05日 星期六 09:56:43 CST. 46 | Universal Time is now: Sat Oct 5 01:56:43 UTC 2019. 47 | ``` 48 | 49 | ### 非交互方式 50 | 51 | ``` 52 | # ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 53 | # export DEBIAN_FRONTEND=noninteractive 54 | # dpkg-reconfigure --frontend noninteractive tzdata 55 | 56 | Current default time zone: 'Asia/Shanghai' 57 | Local time is now: Sat Oct 5 10:17:06 CST 2019. 58 | Universal Time is now: Sat Oct 5 02:17:06 UTC 2019. 59 | ``` 60 | 61 | ## 相关阅读 62 | 63 | * [apt-get install tzdata noninteractive](https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive) -------------------------------------------------------------------------------- /docs/configure/troubleshooting.md: -------------------------------------------------------------------------------- 1 | 2 | # 问题解答 3 | 4 | ## 问题一:Network service discovery disabled 5 | 6 | 经常会遇到一个问题:在开机或者切换网络过程中,右上角弹出一个提示框,显示 7 | 8 | ``` 9 | Network service discovery disabled 10 | ``` 11 | 12 | 参考[Network service discovery disabled: What does this mean for me?](https://askubuntu.com/questions/339702/network-service-discovery-disabled-what-does-this-mean-for-me) 13 | 14 | 进入目录`/etc/default/`,修改文件`avahi-daemon`如下: 15 | 16 | ``` 17 | # 1 = Try to detect unicast dns servers that serve .local and disable avahi in 18 | # that case, 0 = Don't try to detect .local unicast dns servers, can cause 19 | # troubles on misconfigured networks 20 | # AVAHI_DAEMON_DETECT_LOCAL=1 21 | AVAHI_DAEMON_DETECT_LOCAL=0 22 | ``` 23 | 24 | 重启即可 25 | 26 | ## 问题二:[VIM]中文乱码 27 | 28 | 参考:[解决配置vim中文乱码的问题](https://blog.csdn.net/weixin_36250487/article/details/79888103) 29 | 30 | `vim`配置文件为`vimrc` 31 | 32 | $ cd /etc/vim 33 | $ cat vimrc 34 | ... 35 | ... 36 | " Source a global configuration file if available 37 | if filereadable("/etc/vim/vimrc.local") 38 | source /etc/vim/vimrc.local 39 | endif 40 | 41 | 新建文件`vimrc.local`,添加如下语句 42 | 43 | set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 44 | set termencoding=utf-8 45 | set encoding=utf-8 46 | 47 | ## 问题三:[SHELL]命令行窗口假死 48 | 49 | 参考:[linux命令行模式下输入Ctrl+s后界面锁定,假死](https://blog.51cto.com/mister/2348637) 50 | 51 | 在`Ubuntu`系统操作过程中经常遇到一种情况,在命令行窗口输入数据,突然就不能输入了,好像这个命令行窗口卡死了 52 | 53 | 之前还以为是因为内存不足/`CPU`卡死/命令行窗口配置的问题,后来无意中在网上发现是因为无意中输入`ctrl+s`组合键,启动了窗口的锁屏功能 54 | 55 | 输入组合键`ctrl+q`即可解锁,**注意:锁屏期间仍旧能够输入,只是不显示而已** 56 | 57 | ## 问题四:[fcitx]重启输入法 58 | 59 | 不小心把输入法关闭了,之前有过好几回了,解决方法都是重启应用 60 | 61 | 找到一种解决方法,点击窗口键,输入`fcitx`,重新启动即可 62 | 63 | ## 问题五:[nautilus]重启文件管理器 64 | 65 | 今天遇到一个问题是文件夹突然打不开了,参考[ubuntu文件管理器假死的解决办法](https://blog.csdn.net/php_225869/article/details/73204533?utm_source=blogxgwz6)方法,查询文件管理器的`pid`并重启 66 | 67 | # 查找系统中的每个进程并搜索文件管理器nautilus 68 | $ ps -ef | grep nautilus 69 | zj 6938 1300 0 00:40 ? 00:00:01 /usr/bin/nautilus --gapplication-service 70 | zj 7822 7696 0 00:48 pts/2 00:00:00 grep --color=auto nautilus 71 | 72 | 然后杀死进程,重新点击文件夹启动 73 | 74 | kill 6938 & kill 7822 75 | -------------------------------------------------------------------------------- /docs/configure/ubuntu-DEBIAN_FRONTEND.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu]DEBIAN_FRONTEND 3 | 4 | 环境变量`DEBIAN_FRONTEND`控制安装程序时用户交互界面的类型 5 | 6 | 共`4`个类型: 7 | 8 | 1. `noninteractive` 9 | 2. `text` 10 | 3. `newt` 11 | 4. `gtk` 12 | 13 | 默认`DEBIAN_FRONTEND=newt` 14 | 15 | ## noninteractive 16 | 17 | 将`DEBIAN_FRONTEND`设置为`noninteractive`,表示安装软件时不进行交互,选择默认选项进行构建 18 | 19 | ``` 20 | sudo DEBIAN_FRONTEND=noninteractive apt-get -y install [packagename] 21 | ``` 22 | 23 | ## 相关阅读 24 | 25 | * [DEBIAN_FRONTEND](https://www.debian.org/releases/buster/s390x/ch05s02.en.html) 26 | * [ubuntu DEBIAN_FRONTEND环境变量用法](https://www.cnblogs.com/bollen/p/7137200.html) 27 | * [关于DEBIAN_FRONTEND noninteractive的正确用法](https://wp.goodmemory.cc/%E5%85%B3%E4%BA%8Edebian_frontend-noninteractive%E7%9A%84%E6%AD%A3%E7%A1%AE%E7%94%A8%E6%B3%95/) 28 | * [Ubuntu使用apt-get安装软件禁用交互模式](https://www.centos.bz/2017/12/ubuntu%e4%bd%bf%e7%94%a8apt-get%e5%ae%89%e8%a3%85%e8%bd%af%e4%bb%b6%e7%a6%81%e7%94%a8%e4%ba%a4%e4%ba%92%e6%a8%a1%e5%bc%8f/) 29 | -------------------------------------------------------------------------------- /docs/configure/ubuntu-中文乱码.md: -------------------------------------------------------------------------------- 1 | 2 | # [Ubuntu]中文乱码 3 | 4 | 将系统字符集设置为`zh_CN.UTF-8`并按装中文输入法后就能够输入中文了,但是出现中文乱码现象,这需要进一步安装中文字体 5 | 6 | ## 配置 7 | 8 | ``` 9 | sudo apt-get install ttf-wqy-microhei #文泉驿-微米黑 10 | sudo apt-get install ttf-wqy-zenhei #文泉驿-正黑 11 | sudo apt-get install xfonts-wqy #文泉驿-点阵宋体 12 | ``` 13 | 14 | ## 相关阅读 15 | 16 | * [免费中文字体](https://wiki.ubuntu.org.cn/免费中文字体) 17 | 18 | * [字体](https://wiki.ubuntu.org.cn/字体#.E8.8E.B7.E5.8F.96.E5.AD.97.E4.BD.93) 19 | -------------------------------------------------------------------------------- /docs/configure/wps-中文字体.md: -------------------------------------------------------------------------------- 1 | 2 | # [WPS]中文字体 3 | 4 | ## 复制中文字体 5 | 6 | 在`Windows`操作系统,进入`C:\Windows\Fonts` 7 | 8 | ``` 9 | $ mkdir wps 10 | # 拷贝ttf/TTF/otf/simsun.ttc字体 11 | $ cp *.ttf .\wps\ 12 | $ cp *.TTF .\wps\ 13 | $ cp *.otf .\wps\ 14 | $ cp simsun.ttc .\wps\ 15 | ``` 16 | 17 | 打包这些字体,传入`Linux`系统 18 | 19 | ## 配置中文字体 20 | 21 | 在`Linux`操作系统,进入`/usr/share/fonts/`,新建文件夹`wps_symbol_fonts`,放置中文字体 22 | 23 | ``` 24 | $ chmod 755 wps_symbol_fonts 25 | $ cd wps_symbol_fonts 26 | $ chmod 644 * 27 | $ mkfontscale 28 | $ mkfontdir 29 | $ fc-cache 30 | ``` 31 | 32 | ## 相关阅读 33 | 34 | * [Linux系统下为WPS添加字体,实现WPS输入中文](https://blog.csdn.net/haolt2010/article/details/52955864) -------------------------------------------------------------------------------- /docs/configure/切换home目录到新硬盘.md: -------------------------------------------------------------------------------- 1 | 2 | # 切换home目录到新硬盘 3 | 4 | 前几天尝试了将`home`目录切换到新安装的固态硬盘上,记录一下。 5 | 6 | ## 步骤 7 | 8 | * 步骤一:安装新硬盘,初始化环境; 9 | * 步骤二:同步数据到新硬盘; 10 | * 步骤三:切换`home`目录到新硬盘。 11 | 12 | ## 操作 13 | 14 | 将新硬盘安装到主机,进行初始化后挂载到某一路径,拷贝`home`目录下数据后绑定`home`目录到新硬盘即可。 15 | 16 | 1. 查询新挂载的硬盘 17 | 18 | $ fdisk -l 19 | # 假定新硬盘名字为/dev/sda 20 | # 21 | # 初始化硬盘环境 22 | sudo mkfs.ext4 /dev/sda 23 | 24 | 2. 挂载到指定路径(临时目录) 25 | 26 | # 注:如果/data不存在需要提前新建 27 | $ sudo mkdir /data 28 | # 29 | # sudo mount [--source] [--target] 30 | $ sudo mount /dev/sda /data 31 | # 32 | # 数据同步 33 | $ rsync -av /home /data 34 | # 35 | # 完成同步后解绑新硬盘和临时目录 36 | # sudo umount /data 37 | 38 | 3. 绑定`home`目录到新硬盘 39 | 40 | # 首先移动home目录 41 | # 有可能会出现移动失败的问题,原因在于有进程在后台操作,具体解决操作网上查询即可 42 | $ mv /home /home_old 43 | # 44 | # 挂载新硬盘到home目录 45 | $ sudo mkdir /home 46 | $ sudo mount /dev/sda /home 47 | # 48 | # 修改fstab文件,设置开机自动挂载 49 | $ sudo vim /etc/fstab 50 | # /etc/fstab: static file system information. 51 | # 52 | # Use 'blkid' to print the universally unique identifier for a 53 | # device; this may be used with UUID= as a more robust way to name devices 54 | # that works even if disks are added and removed. See fstab(5). 55 | # 56 | # 57 | # / was on /dev/nvme0n1p2 during installation 58 | UUID=878a6311-c806-4ed8-84ea-c230b0774002 / ext4 errors=remount-ro 0 1 59 | ... 60 | ... 61 | # 绑定新硬盘和home路径,同时设置为home目录 62 | /dev/sda /home ext4 default 0 2 63 | # 解绑原先home目录,同时设置为普通挂载 64 | /dev/sdb5 /home_old ext4 default 0 0 65 | 66 | 完成上述操作后重启即可。另外,如何想要查询新硬盘对应`UUID`可以查看以下路径 67 | 68 | ``` 69 | $ ls -l /dev/disk/by-uuid/ 70 | ``` 71 | 72 | ## 相关阅读 73 | 74 | * [Linux系统home目录挂载新硬盘并保存原目录下文件方法](http://dljz.nicethemes.cn/news/show-71224.html) -------------------------------------------------------------------------------- /docs/configure/删除陈旧的APT仓库.md: -------------------------------------------------------------------------------- 1 | 2 | # 删除陈旧的APT仓库 3 | 4 | ## 问题复现 5 | 6 | 使用`apt-get update`更新时发生如下错误 7 | 8 | ``` 9 | $ sudo apt-get update 10 | ... 11 | ... 12 | Ign:27 http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial/main DEP-11 64x64 Icons 13 | Err:21 http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial/main amd64 Packages 14 | 404 Not Found [IP: 91.189.95.83 80] 15 | ... 16 | ... 17 | Err:30 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial/main Sources 18 | 404 Not Found 19 | ... 20 | ... 21 | Fetched 8,289 B in 6min 42s (20 B/s) 22 | Reading package lists... Done 23 | W: The repository 'http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial Release' does not have a Release file. 24 | N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. 25 | N: See apt-secure(8) manpage for repository creation and user configuration details. 26 | W: The repository 'https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial Release' does not have a Release file. 27 | N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. 28 | N: See apt-secure(8) manpage for repository creation and user configuration details. 29 | E: Failed to fetch http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found [IP: 91.189.95.83 80] 30 | E: Failed to fetch https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/dists/xenial/main/source/Sources 404 Not Found 31 | E: Some index files failed to download. They have been ignored, or old ones used instead. 32 | ``` 33 | 34 | ## 问题解决 35 | 36 | 需要移除对应的仓库链接 37 | 38 | ### 命令行方式 39 | 40 | ``` 41 | $ sudo add-apt-repository --remove ppa:t-tujikawa/ppa 42 | ``` 43 | 44 | ### 文件编辑方式 45 | 46 | 进入`/etc/apt/sources.list.d`,查找对应的文件 47 | 48 | ``` 49 | $ cat t-tujikawa-ubuntu-ppa-xenial.list 50 | deb http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial main 51 | # deb-src http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial main 52 | $ cat t-tujikawa-ubuntu-ppa-xenial.list.save 53 | deb http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial main 54 | # deb-src http://ppa.launchpad.net/t-tujikawa/ppa/ubuntu xenial main 55 | ``` 56 | 57 | 删除文件或删除里面的内容 58 | 59 | ## 相关阅读 60 | 61 | * [Linux教程:如何查找并移除Ubuntu上陈旧的PPA仓库](https://www.linuxidc.com/Linux/2014-09/107055.htm) 62 | 63 | * [Ubuntu update 出现错误的安装源](https://juejin.im/post/5b41abc25188251acb0cd8cd) 64 | 65 | * [Ubuntu 16.04系统下出现E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found](https://www.cnblogs.com/wenzheshen/p/6599636.html) 66 | 67 | -------------------------------------------------------------------------------- /docs/configure/制作桌面启动器.md: -------------------------------------------------------------------------------- 1 | 2 | # 制作桌面启动器 3 | 4 | 想要在`Ubuntu`桌面设置一个类似`Windows`的快捷方式 5 | 6 | ## 使用已有启动器 7 | 8 | 搜索栏中的快捷方式无法通过鼠标拖动,可以在`/usr/share/applications`或`~/.local/share/applications`目录下找到,复制到桌面即可使用 9 | 10 | ## 自定义 11 | 12 | 可以通过工具`gnome-desktop-item-edit`实现 13 | 14 | sudo apt-get install --no-install-recommends gnome-panel 15 | 16 | 执行新建启动器命令 17 | 18 | gnome-desktop-item-edit --create-new ~/Desktop 19 | 20 | ![](./imgs/gnome-desktop.png) 21 | 22 | 类型默认为`Application`,输入名字,命令和描述即可新建 23 | 24 | **点击图标可以选择启动器图标** 25 | 26 | *将该文件放置到`/usr/share/applications`或`~/.local/share/applications`目录下,即可在搜索栏中找到* 27 | 28 | ## `desktop`文件解析 29 | 30 | 启动器是一个`.desktop`文件,里面内容如下: 31 | 32 | #!/usr/bin/env xdg-open 33 | [Desktop Entry] 34 | Version=1.0 35 | Type=Application 36 | Terminal=false 37 | Icon[en_US]=gnome-panel-launcher 38 | Name[en_US]=pycharm 39 | Exec=/home/zj/software/jetbrains/pycharm-2018.3.3/bin/pycharm.sh 40 | Comment[en_US]=启动pycharm 41 | Name=pycharm 42 | Comment=启动pycharm 43 | Icon=gnome-panel-launcher 44 | 45 | * 参数`Type=Application`表示该`desktop`文件用于启动一个应用 46 | * 参数`Exec`表示执行命令 47 | * 参数`Icon`用于显示的图标 48 | * 参数`Name`用于启动器名称 49 | 50 | **Note: 可以设置不同语言环境的名字和图标** 51 | 52 | ### `examples.desktop`解析 53 | 54 | `Ubuntu`默认在用户目录下有一个`examples.desktop`启动器,内容如下: 55 | 56 | [Desktop Entry] 57 | Version=1.0 58 | Type=Link 59 | Name=Examples 60 | ... 61 | ... 62 | Name[en_AU]=Examples 63 | Name[en_CA]=Examples 64 | Name[en_GB]=Examples 65 | ... 66 | ... 67 | Name[zh_CN]=示例 68 | Name[zh_HK]=範例 69 | Name[zh_TW]=範例 70 | Comment=Example content for Ubuntu 71 | ... 72 | ... 73 | Comment[en_AU]=Example content for Ubuntu 74 | Comment[en_CA]=Example content for Ubuntu 75 | Comment[en_GB]=Example content for Ubuntu 76 | ... 77 | ... 78 | Comment[zh_CN]=Ubuntu 示例内容 79 | Comment[zh_HK]=Ubuntu 的範例內容 80 | Comment[zh_TW]=Ubuntu 的範例內容 81 | URL=file:///usr/share/example-content/ 82 | Icon=folder 83 | X-Ubuntu-Gettext-Domain=example-content 84 | 85 | 双击该文件是跳转到目录`/usr/share/example-content/`,其`Type`是`Link`,跳转到参数`URL`所指定的地址 86 | 87 | 执行跳转功能的启动器也可通过`gnome-desktop-item-edit`实现,将类型修改为`Location`即可 88 | 89 | ![](./imgs/desktop-location.png) 90 | 91 | #!/usr/bin/env xdg-open 92 | [Desktop Entry] 93 | Version=1.0 94 | Type=Link 95 | Icon[en_US]=gnome-panel-launcher 96 | Name[en_US]=pycharm2 97 | URL=file:///home/zj/software/jetbrains/pycharm-2018.3.3/bin/ 98 | Comment[en_US]=跳转pycharm 99 | Name=pycharm2 100 | Comment=跳转pycharm 101 | Icon=gnome-panel-launcher 102 | 103 | ## 启动器小结 104 | 105 | 启动器可以执行`3`种功能: 106 | 107 | 1. 启动应用 108 | 2. 跳转目录 109 | 3. 在命令行窗口执行 110 | 111 | 可以通过`gnome-desktop-item-edit`工具生成这`3`种功能的启动器,设置**类型**即可 112 | 113 | ## 相关阅读 114 | 115 | * [How to create a desktop shortcut [duplicate]](https://askubuntu.com/questions/854373/how-to-create-a-desktop-shortcut/854398) 116 | 117 | * [How can I create launchers on my desktop?](https://askubuntu.com/questions/64222/how-can-i-create-launchers-on-my-desktop) -------------------------------------------------------------------------------- /docs/configure/应用查询-安装-卸载-清理.md: -------------------------------------------------------------------------------- 1 | 2 | # [apt-get][apt-cache][dpkg]查询、安装、卸载和清理 3 | 4 | ## 查询 5 | 6 | 查询已安装应用 7 | 8 | ``` 9 | apt list --installed 10 | # 或者 11 | dpkg -l 12 | ``` 13 | 14 | 查询应用依赖 15 | 16 | ``` 17 | apt-cache depends package_name 18 | ``` 19 | 20 | 搜索软件包 21 | 22 | ``` 23 | apt-cache search package_name 24 | ``` 25 | 26 | 查看指定软件信息 27 | 28 | ``` 29 | apt-cache show package_name 30 | ``` 31 | 32 | ## 安装 33 | 34 | ``` 35 | apt-get install package_name 36 | ``` 37 | 38 | * `-y, --yes, --assume-yes`:假定每次交互时输入为`yes` 39 | * `-m, --ignore-missing, --fix-missing`:忽略缺失的包 40 | * `-f, --fix-broken`:修复作用,试图纠正依赖关系已损坏的系统 41 | 42 | ``` 43 | # 禁止安装时交互,自动安装 44 | sudo DEBIAN_FRONTEND=noninteractive apt-get -y install [packagename] 45 | ``` 46 | 47 | ``` 48 | # 更新软件源中的所有软件列表 49 | apt-get update 50 | # 更新软件 51 | apt-get upgrade 52 | # 将系统升级到新版本 53 | apt-get dist-upgrade 54 | ``` 55 | 56 | ``` 57 | #安装本地deb包 58 | dpkg -i *.deb 59 | ``` 60 | 61 | ## 卸载 62 | 63 | ``` 64 | # 卸载一个已安装的软件包(保留配置文档) 65 | apt-get remove package_name 66 | # 卸载一个已安装的软件包(删除配置文档) 67 | apt-get remove --purge packagename 68 | # 删除包及其依赖的软件包 69 | apt-get autoremove packagename 70 | # 删除包及其依赖的软件包+配置文件 71 | apt-get autoremove --purge packagname 72 | ``` 73 | 74 | ``` 75 | dpkg -r *.deb 76 | ``` 77 | 78 | ## 清理 79 | 80 | ``` 81 | # 清除已卸载软件备份 82 | apt-get autoclean 83 | # 同时清除已安装软件备份 84 | apt-get clean 85 | ``` 86 | 87 | ## 相关阅读 88 | 89 | * [apt-get](https://baike.baidu.com/item/apt-get/2360755) 90 | * [linux apt-cache使用方法](https://www.cnblogs.com/zzg-home/p/8032807.html) -------------------------------------------------------------------------------- /docs/configure/快捷键-复制和粘贴.md: -------------------------------------------------------------------------------- 1 | 2 | # [控制台窗口][快捷键]复制和粘贴 3 | 4 | 平常使用`Ctrl+C/V`进行复制/粘贴操作,但是在控制台窗口中`Ctrl+C`表示退出程序操作 5 | 6 | 对于复制和粘贴快捷键,需要使用`Shift+Ctrl+C/V` -------------------------------------------------------------------------------- /docs/configure/扩容boot分区.md: -------------------------------------------------------------------------------- 1 | 2 | /dev/nvme0n1p6 181M 171M 0 100% /boot -------------------------------------------------------------------------------- /docs/configure/扩展命令行窗口滚动行数.md: -------------------------------------------------------------------------------- 1 | 2 | # 扩展命令行窗口滚动行数 3 | 4 | `Ubuntu`的命令行窗口对于缓存的函数有限制,可以通过设置进行扩展 5 | 6 | ## 配置 7 | 8 | 点击命令行窗口菜单栏`->Edit->Preferences->Profiles` 9 | 10 | ![](./imgs/preferences.png) 11 | 12 | ![](./imgs/profiles.png) 13 | 14 | 如果之前没有设置就新建一个,双击`profile`并切换到`Scrolling`界面 15 | 16 | ![](./imgs/scrolling.png) 17 | 18 | 编辑`Limit scrollback to`选项,设置扩展的行数(比如`10`万行) -------------------------------------------------------------------------------- /docs/configure/更换国内源.md: -------------------------------------------------------------------------------- 1 | 2 | # 更换国内源 3 | 4 | 可以在阿里官网[镜像](https://developer.aliyun.com/mirror)查找对应系统,点击`帮助`找到更换方法 5 | 6 | ## 更换Ubuntu16.04 7 | 8 | 备份 9 | 10 | sudo cp /etc/apt/sources.list /etc/apt/sources_init.list 11 | 12 | 修改 13 | 14 | sudo gedit /etc/apt/sources.list 15 | 16 | 替换为 17 | 18 | deb http://mirrors.aliyun.com/ubuntu/ xenial main 19 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial main 20 | 21 | deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main 22 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main 23 | 24 | deb http://mirrors.aliyun.com/ubuntu/ xenial universe 25 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe 26 | deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe 27 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe 28 | 29 | deb http://mirrors.aliyun.com/ubuntu/ xenial-security main 30 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main 31 | deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe 32 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe 33 | 34 | 更新 35 | 36 | sudo apt-get update 37 | 38 | 修复损坏的软件包,尝试卸载出错的包,重新安装正确版本的 39 | 40 | sudo apt-get -f install 41 | 42 | 升级软件 43 | 44 | sudo apt-get upgrade 45 | 46 | ## 相关阅读 47 | 48 | * [Ubuntu 更换国内源](https://blog.csdn.net/qq_35451572/article/details/79516563) 49 | 50 | * [ubuntu 18.04 (bionic) 配置 opsx 安装源](https://opsx.alibaba.com/guide?lang=zh-CN&document=69a2341e-801e-11e8-8b5a-00163e04cdbb) 51 | -------------------------------------------------------------------------------- /docs/configure/查询阻塞进程并杀死.md: -------------------------------------------------------------------------------- 1 | 2 | # 查询阻塞进程并杀死 3 | 4 | 遇到程序阻塞,需要查询到进程`id`再进行`kill`,有两种方式进行查询 5 | 6 | ## 命令行模式 7 | 8 | $ ps -ef | grep 进程名 9 | 10 | ## 图像模式 11 | 12 | 进入搜索栏,输入`System Monitor`,可以查看相应的进程信息 13 | 14 | ![](./imgs/system-monitor-process.png) 15 | 16 | ## 相关阅读 17 | 18 | * [解决android Studio 安装完运行提示failed to find build tools revision 24.0.2](https://blog.csdn.net/qq_28637193/article/details/52549622) -------------------------------------------------------------------------------- /docs/configure/系统备份.md: -------------------------------------------------------------------------------- 1 | 2 | # 系统备份 3 | 4 | 新装了电脑,配置了一大堆东西,备份一下 5 | 6 | 有`2`种方式 7 | 8 | 1. 制作`ISO`文件 9 | 2. 制作存档文件 10 | 11 | --- 12 | 13 | ## 制作ISO文件 14 | 15 | 参考:[VMWare Ubuntu 扩容](https://blog.csdn.net/u012005313/article/details/82111272#C1) 16 | 17 | --- 18 | 19 | ## 制作存档文件 20 | 21 | 最简单直接的就是`root`用户执行`tar`命令 22 | 23 | $ tar -cvpzf Ubuntu-2019-01-15.tgz --one-file-system --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/media --exclude=./Ubuntu-2019-01-15.tgz / 24 | 25 | 参数解释 26 | 27 | * `-c`: `create a new archive`(创建一个新的档案文件) 28 | * `-v`: `verbosely list files processed`(详细输出) 29 | * `-p`: `extract information about file permissions`(`default for superuser`)(提取有关文件权限的信息) 30 | * `-z`: `filter the archive through gzip`(使用`gzip`工具进行压缩) 31 | * `-f`: `use archive file or device ARCHIVE`(结果文件名) 32 | * `--one-file-system`: `stay in local file system when creating archive`(仅保存本地文件系统) 33 | * `--exclude`: `exclude files, given as a PATTERN`(不备份的路径或文件,可使用正则表达式) 34 | 35 | 所以结果档案文件为`Ubuntu-2019-01-15.tgz`,不存档的路径和文件包括`/proc`,`/lost+found`,`/mnt`,`/sys`,`/media`,`Ubuntu-2019-01-15.tgz`,存档起始路径为根目录/ 36 | 37 | ## 相关阅读 38 | 39 | * [BackupYourSystem/TAR](https://help.ubuntu.com/community/BackupYourSystem/TAR) 40 | 41 | * [Ubuntu全盘备份与恢复,亲自总结,实测可靠](https://blog.csdn.net/sinat_27554409/article/details/78227496) 42 | 43 | * [Ubuntu如何备份和恢复系统](https://www.cnblogs.com/lidonghao/p/3841037.html) 44 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Linux 2 | 3 | ## 章节 4 | 5 | * 系统配置 6 | * 工具使用 7 | * 常用操作 8 | * 访问控制 9 | * 脚本语法 10 | ## 相关阅读 11 | 12 | * [[ubuntu 18.04]重装系统小结](https://blog.zhujian.life/posts/e70eeac0.html) 13 | * [[Ubuntu]目录树](https://blog.zhujian.life/posts/8bc9b2b7.html) -------------------------------------------------------------------------------- /docs/operation/复制大量小文件.md: -------------------------------------------------------------------------------- 1 | 2 | # 复制大量小文件 3 | 4 | 之前都是通过`cp`命名进行文件复制,现在需要复制大量小文件,通过`cp`命令的速度太慢,在网上找到另一种方法 5 | 6 | ## 操作 7 | 8 | 使用`tar`加速文件复制 9 | 10 | ``` 11 | # 进入结果目录路径 12 | $ tar cf - <源目录路径> | tar xf - 13 | ``` 14 | 15 | 其原理大概是利用了`tar`的打包功能以及管道的传输功能,将多个文件打包在一起传输,有助于速度提升,是一种以空间换时间的方法 16 | 17 | ## 相关阅读 18 | 19 | * [10.13. Copying Directory Trees with tar and Pipes docstore.mik.ua/orelly/unix3/upt/ch10_13.htm](https://docstore.mik.ua/orelly/unix3/upt/ch10_13.htm) -------------------------------------------------------------------------------- /docs/operation/对目录下的每一个文件夹单独打包.md: -------------------------------------------------------------------------------- 1 | 2 | # 对目录下的每一个文件夹单独打包 3 | 4 | 从同事那边学到一招,可以通过命令行的方式对目录下的每一个文件夹单独打包 5 | 6 | ## 实现 7 | 8 | ``` 9 | # use tar 10 | $ find . -maxdepth 1 -type d ! -path '.' -exec tar -cvf "{}.tar" {} \; 11 | # use 7zip 12 | $ find . -maxdepth 1 -type d ! -path '.' -exec 7z a "{}.zip" {} \; 13 | ``` 14 | 15 | * `find .`:搜索当前文件夹 16 | * `-maxdepth 1`:遍历第一级深度 17 | * `-type d`:寻找目录类型文件 18 | * `! -path '.'`:排除上一级目录 19 | * `-exec tar -cvf "{}.tar" {} \;`:执行`tar`打包命令 20 | * ` -exec 7z a "{}.zip" {} \;`:执行`7zip`打包命名 21 | 22 | 进入目录路径,执行上述命令即可将每个文件夹单独打包 23 | 24 | ## 相关阅读 25 | 26 | * [How to run find -exec?](https://unix.stackexchange.com/questions/12902/how-to-run-find-exec) -------------------------------------------------------------------------------- /docs/operation/格式化移动硬盘.md: -------------------------------------------------------------------------------- 1 | 2 | # 格式化移动硬盘 3 | 4 | 遇到一个问题,就是移动硬盘没法写入文件了,可以通过`df -h`命名明明可以查看到还有大量的空间 5 | 6 | ## inodes=0 7 | 8 | 使用命令`df -i`查询了`inodes`使用情况,发现硬盘的`inodes=0`。在网上也没有找到很好的解决方案,所以决定格式化系统 9 | 10 | ## 格式化系统 11 | 12 | 首先备份该硬盘已有文件,然后解挂载该硬盘,最后进行格式化操作 13 | 14 | ``` 15 | # 格式化为fat32 16 | $ mkfs.fat -F 32 <硬盘ID> 17 | # 格式化为NTFS 18 | $ mkfs.ntfs <硬盘ID> 19 | # 快速格式化为NTFS(推荐) 20 | $ mkfs.ntfs -F <硬盘ID> 21 | ``` 22 | 23 | ## 相关阅读 24 | 25 | * [理解inode](http://www.ruanyifeng.com/blog/2011/12/inode.html) 26 | * [ linux下如何格式化NTFS分区 ](https://blog.51cto.com/u_2221384/2592293) 27 | * [Linux mkfs 命令](https://www.runoob.com/linux/linux-comm-mkfs.html) 28 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | mkdocs>=1.1.2 2 | mkdocs-material>=7.0.5 3 | mkdocs-material-extensions>=1.0.1 -------------------------------------------------------------------------------- /docs/shell/dash-bash.md: -------------------------------------------------------------------------------- 1 | 2 | # dash vs. bash 3 | 4 | ## dash 5 | 6 | 通常使用`sh`作为`shell`脚本的执行命令,其位于 7 | 8 | ``` 9 | $ which sh 10 | /bin/sh 11 | ``` 12 | 13 | 其是一个链接,指向 14 | 15 | ``` 16 | $ file /bin/sh 17 | /bin/sh: symbolic link to dash 18 | ``` 19 | 20 | 所以`dash`是默认解释器 21 | 22 | ``` 23 | $ file /bin/dash 24 | /bin/dash: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=504637666875a5d526ef51acfe601c99efc99114, stripped 25 | ``` 26 | 27 | ## bash 28 | 29 | 在编写`shell`文件时,会在开头加上如下语句 30 | 31 | ``` 32 | #!/bin/bash 33 | ``` 34 | 35 | 其含义是在没有指定解释器时,使用`/bin/bash`作为脚本解释器执行 36 | 37 | ``` 38 | $ file /bin/bash 39 | /bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=6f072e70e3e49380ff4d43cdde8178c24cf73daa, stripped 40 | ``` 41 | 42 | ## sh vs. dash vs. bash 43 | 44 | * `sh`是一种编程语言,指的是`shell`命令语言,其规范由[POSIX standard](https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html)指定 45 | * `bash(the GNU Bourne-Again Shell)`和`dash(the Debian Almquist Shell)`是兼容`sh`规范的脚本解释器 46 | * 对于`Debian`和`Ubuntu`系统而言,其默认的`sh`链接指向的是`dash` 47 | 48 | `bash`能实现的功能比`dash`多,具体差别参考[bash和dash区别](https://blog.csdn.net/happycxz/article/details/78543187),所以执行脚本时使用`bash` 49 | 50 | ``` 51 | $ bash test.sh 52 | ``` 53 | 54 | ## 相关阅读 55 | 56 | * [Difference between sh and bash](https://stackoverflow.com/questions/5725296/difference-between-sh-and-bash) 57 | 58 | * [Ubuntu dash与bash的区别](https://blog.csdn.net/hansel/article/details/9817129) 59 | -------------------------------------------------------------------------------- /docs/shell/imgs/arithmetic-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/arithmetic-operator.png -------------------------------------------------------------------------------- /docs/shell/imgs/bool-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/bool-operator.png -------------------------------------------------------------------------------- /docs/shell/imgs/file-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/file-operator.png -------------------------------------------------------------------------------- /docs/shell/imgs/logic-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/logic-operator.png -------------------------------------------------------------------------------- /docs/shell/imgs/redirect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/redirect.png -------------------------------------------------------------------------------- /docs/shell/imgs/relational-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/relational-operator.png -------------------------------------------------------------------------------- /docs/shell/imgs/special-symbol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/special-symbol.png -------------------------------------------------------------------------------- /docs/shell/imgs/string-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/shell/imgs/string-operator.png -------------------------------------------------------------------------------- /docs/shell/set.md: -------------------------------------------------------------------------------- 1 | 2 | # set 3 | 4 | `set`命令可以辅助脚本运行 5 | 6 | ## 环境变量 7 | 8 | 在命令行直接输入`set`,将输出所有的环境变量和`shell`函数 9 | 10 | ## set -eux 11 | 12 | * `-e`:若命令返回值不等于`0`,则立即退出 13 | * `-u`:执行时使用到未定义过的变量时,显示错误信息并停止运行 14 | * `-x`:先输出命令,再输出其运行结果 15 | 16 | `set -e`不适用于管道命令 17 | 18 | >管道命令指的是多个子命令通过管道运算符(|)组合成为一个大的命令。Bash会把最后一个子命令的返回值,作为整个命令的返回值。也就是说,只要最后一个子命令不失败,管道命令总是会执行成功,因此它后面命令依然会执行,set -e就失效了 19 | 20 | 可通过`set -o pipefail`解决此问题,`-o pipefail`的作用是一个子命令失败,整个管道命令就失败 21 | 22 | ## 小结 23 | 24 | 在每次`shell`脚本的开头加入以下`set`语句 25 | 26 | ``` 27 | set -eux 28 | set -o pipefail 29 | ``` 30 | 31 | 有助于脚本的调试和实现 32 | 33 | 对于无法编辑的脚本,可通过命令行传入`set`命令 34 | 35 | ``` 36 | $ bash -euxo pipfail script.sh 37 | ``` 38 | 39 | ## 相关阅读 40 | 41 | * [Linux set命令](https://www.runoob.com/linux/linux-comm-set.html) 42 | 43 | * [Bash 脚本 set 命令教程](http://www.ruanyifeng.com/blog/2017/11/bash-set.html?utm_source=tool.lu) 44 | -------------------------------------------------------------------------------- /docs/shell/troubleshooting.md: -------------------------------------------------------------------------------- 1 | 2 | # 问题解答 3 | 4 | ## 问题一:[[: not found 5 | 6 | 使用`sh`命令执行脚本`test.sh` 7 | 8 | ``` 9 | $ cat test.sh 10 | #!/bin/bash 11 | 12 | NAME="asdf asdf as" 13 | 14 | if [[ ${NAME} == as* ]] 15 | then 16 | echo "匹配" 17 | else 18 | echo "不匹配" 19 | fi 20 | ``` 21 | 22 | 得到问题如下: 23 | 24 | ``` 25 | $ sh test.sh 26 | test.sh: 5: test.sh: [[: not found 27 | 不匹配 28 | ``` 29 | 30 | 原因是相比较于`bash`而言,`dash`的功能少,无法解析`[[ ]]`,使用`bash`执行即可 31 | 32 | ``` 33 | $ bash test.sh 34 | 匹配 35 | ``` -------------------------------------------------------------------------------- /docs/shell/函数.md: -------------------------------------------------------------------------------- 1 | 2 | # 函数 3 | 4 | ## 定义 5 | 6 | 格式如下: 7 | 8 | ``` 9 | [function] funname() 10 | { 11 | action; 12 | [return int;] 13 | } 14 | ``` 15 | 16 | * 关键字`function`可选 17 | * 返回语句可选,如果不加,以最后一条命令运行结果作为返回值 18 | 19 | ## 示例1 20 | 21 | ``` 22 | $ cat test.sh 23 | #!/bin/bash 24 | 25 | func() 26 | { 27 | echo "this is func" 28 | } 29 | 30 | function compute() 31 | { 32 | return 3 33 | } 34 | 35 | func 36 | compute 37 | 38 | echo "compute's result is $?" 39 | ``` 40 | 41 | 定义两个函数`func`和`compute`,使用`$?`获取最后命令(即函数`compute`)的退出状态 42 | 43 | ``` 44 | $ bash test.sh 45 | this is func 46 | compute's result is 3 47 | ``` 48 | 49 | ## 参数 50 | 51 | 对于函数参数的传递和获取,其使用方式和命令行参数一致。通过`$n`获取第`n`个参数值 52 | 53 | ``` 54 | $1 55 | $2 56 | $3 57 | ... 58 | ${10} 59 | ${11} 60 | ``` 61 | 62 | 并使用以下特殊符号获取传递到函数的信息 63 | 64 | ![](./imgs/special-symbol.png) 65 | 66 | ## 示例2 67 | 68 | ``` 69 | $ cat test.sh 70 | #!/bin/bash 71 | 72 | func() 73 | { 74 | echo "command line parameters: $@" 75 | } 76 | 77 | function compute() 78 | { 79 | NUM=0 80 | for i in $@ 81 | do 82 | NUM=`expr ${NUM} + ${i}` 83 | done 84 | return ${NUM} 85 | } 86 | 87 | func "$@" 88 | compute 2 3 4 5 89 | 90 | echo "compute's result is $?" 91 | ``` 92 | 93 | 函数`func`打印所有命令行参数;函数`compute`计算输入参数之和并返回结果。结果如下: 94 | 95 | ``` 96 | $ bash test.sh zj zzjj 97 | command line parameters: zj zzjj 98 | compute's result is 14 99 | ``` 100 | 101 | ## 相关阅读 102 | 103 | * [Shell 函数](https://www.runoob.com/linux/linux-shell-func.html) -------------------------------------------------------------------------------- /docs/shell/参数传递.md: -------------------------------------------------------------------------------- 1 | 2 | # 参数传递 3 | 4 | 参数传递分两部分,一是命令行参数的传递,而是函数参数的传递 5 | 6 | 下面学习命令行参数的传递,函数参数的传递在后续有关函数的内容中学习 7 | 8 | ## 特殊符号 9 | 10 | 通过特殊符号来解析命令行参数的传递 11 | 12 | * `$#`:参数个数 13 | * `$*`:得到单个字符串,返回所有向脚本传递的参数 14 | * `$$`:当前脚本运行的进程`ID` 15 | * `$!`:后台运行的最后一个进程`ID` 16 | * `$@`:返回所有参数 17 | * `$-`:显示`shell`使用的当前选项 18 | * `$?`:显示最后命令的退出状态。`0`表示没有错误,其他数字表示有错误 19 | 20 | 另外,`$1`表示获取第一个参数,`$2`表示获取第二个参数,以此类推 21 | 22 | ## $* vs. $@ 23 | 24 | 特殊符号`$*`和`$@`都返回所有参数值,但是其格式不一致 25 | 26 | `$*`得到的是一个字符串,格式为`"$1 $2 $3"`,而`$@`得到的是一个数组,格式为`"$1" "$2" "$3"` 27 | 28 | ``` 29 | $ cat test.sh 30 | #!/bin/bash 31 | 32 | for i in "$*" 33 | do 34 | echo $i 35 | done 36 | 37 | for i in "$@" 38 | do 39 | echo $i 40 | done 41 | ``` 42 | 43 | 结果`$*`以单个字符串输出,`$@`输出单独的参数 44 | 45 | ``` 46 | $ bash test.sh a b c d 47 | a b c d 48 | a 49 | b 50 | c 51 | d 52 | ``` 53 | 54 | ## 相关阅读 55 | 56 | * [Shell 传递参数](https://www.runoob.com/linux/linux-shell-passing-arguments.html) 57 | -------------------------------------------------------------------------------- /docs/shell/变量.md: -------------------------------------------------------------------------------- 1 | 2 | # 变量 3 | 4 | 学习变量的定义和使用 5 | 6 | ## 定义 7 | 8 | 变量分`3`种类型: 9 | 10 | * 局部变量:局部变量在脚本或命令中定义,仅在当前`shell`实例中有效,其他`shell`启动的程序不能访问局部变量 11 | * 环境变量:所有的程序,包括`shell`启动的程序,都能访问环境变量,有些程序需要环境变量来保证其正常运行。必要的时候`shell`脚本也可以定义环境变量 12 | * `shell`变量:是由`shell`程序设置的特殊变量。`shell`变量中有一部分是环境变量,有一部分是局部变量,这些变量保证了`shell`的正常运行 13 | 14 | 变量定义规则如下: 15 | 16 | * 命名只能使用英文字母,数字和下划线,首个字符不能以数字开头 17 | * 中间不能有空格,可以使用下划线(`_`) 18 | * 不能使用标点符号 19 | * 不能使用`bash`里的关键字(可用`help`命令查看保留关键字) 20 | 21 | ## 使用 22 | 23 | **注意:变量赋值时不能和等号有空格** 24 | 25 | ``` 26 | VAR=adfadfa 27 | ``` 28 | 29 | 在变量名前添加美元符号(`$`)即可,变量名外的花括号(`{}`)可选(推荐使用,更具标识度) 30 | 31 | ``` 32 | $VAR 33 | ${VAR} 34 | ``` 35 | 36 | ## 只读变量 37 | 38 | 使用`readonly`关键字声明变量,可将变量设置为为只读变量 39 | 40 | ``` 41 | # 方式一 42 | VAR=... 43 | readonly VAR 44 | # 方式二 45 | readonly VAR=... 46 | ``` 47 | 48 | ## 重置变量 49 | 50 | 使用关键字`unset`重置变量为空。注意:`unset`命令不能操作只读变量 51 | 52 | ``` 53 | $ cat test.sh 54 | #!/bin/bash 55 | 56 | VAR1="asdfasfa" 57 | readonly VAR2="asdf asdf as" 58 | 59 | unset VAR1 60 | unset VAR2 61 | 62 | echo $VAR1 63 | echo $VAR2 64 | ``` 65 | 66 | `VAR1`重置后输出为空 67 | 68 | ``` 69 | $ bash test.sh 70 | test.sh: line 7: unset: VAR2: cannot unset: readonly variable 71 | 72 | asdf asdf as 73 | ``` 74 | 75 | ## 相关阅读 76 | 77 | * [Shell 变量](https://www.runoob.com/linux/linux-shell-variable.html) -------------------------------------------------------------------------------- /docs/shell/基本运算符.md: -------------------------------------------------------------------------------- 1 | 2 | # 基本运算符 3 | 4 | `shell`支持以下运算符 5 | 6 | * 算术运算符 7 | * 关系运算符 8 | * 布尔运算符 9 | * 字符串运算符 10 | * 文件测试运算符 11 | 12 | ## expr 13 | 14 | `expr`是表达式计算工具,使用它来完成表达式的求职操作 15 | 16 | 格式如下: 17 | 18 | ``` 19 | $ expr expression 20 | # 示例 21 | $ expr 3 + 4 22 | 7 23 | ``` 24 | 25 | **注意:运算符和算子之间必须要有空格** 26 | 27 | 在`shell`脚本中使用`expr`时需要用反引号将完整表达式括起来 28 | 29 | ``` 30 | VAR=`expr 3 + 4` 31 | ``` 32 | 33 | ## 算术运算符 34 | 35 | ![](./imgs/arithmetic-operator.png) 36 | 37 | **注意:乘号(`*`)必须加反斜杠`\*`** 38 | 39 | 示例如下: 40 | 41 | ``` 42 | $ cat test.sh 43 | #!/bin/bash 44 | 45 | VAR1=`expr 3 + 4` 46 | VAR2=`expr 3 == 4` 47 | 48 | echo $VAR1 49 | echo $VAR2 50 | ``` 51 | 52 | 执行如下: 53 | 54 | ``` 55 | $ bash test.sh 56 | 7 57 | 0 58 | ``` 59 | 60 | ## 关系运算符 61 | 62 | ![](./imgs/relational-operator.png) 63 | 64 | **注意:关系运算符只支持数字,不支持字符串,除非字符串的值是数字** 65 | 66 | ## 布尔运算符 67 | 68 | ![](./imgs/bool-operator.png) 69 | 70 | ## 逻辑运算符 71 | 72 | ![](./imgs/logic-operator.png) 73 | 74 | ## 字符串运算符 75 | 76 | ![](./imgs/string-operator.png) 77 | 78 | ## 文件测试运算符 79 | 80 | 文件测试运算符用于检测`Unix`文件的各种属性 81 | 82 | ![](./imgs/file-operator.png) 83 | 84 | ## 相关阅读 85 | 86 | * [Shell 基本运算符](https://www.runoob.com/linux/linux-shell-basic-operators.html) 87 | -------------------------------------------------------------------------------- /docs/shell/字符串.md: -------------------------------------------------------------------------------- 1 | 2 | # 字符串 3 | 4 | 学习`shell`字符串的语法以及用法 5 | 6 | ## 语法 7 | 8 | 可使用单引号或双引号表示字符串,两种表示方式之间有差异 9 | 10 | * 单引号里的任何字符都会原样输出,单引号字符串中的变量是无效的 11 | * 单引号字符串中不能出现单独一个的单引号(对单引号使用转义符后也不行),但可成对出现,作为字符串拼接使用 12 | * 双引号里可以有变量 13 | * 双引号里可以出现转义字符 14 | 15 | ## 获取字符串长度 16 | 17 | 使用符号`${#}`获取字符串长度,操作如下: 18 | 19 | ``` 20 | $ cat test.sh 21 | #!/bin/bash 22 | 23 | VAR="asdfadfa" 24 | echo ${#VAR} 25 | ``` 26 | 27 | 结果如下: 28 | 29 | ``` 30 | $ bash test.sh 31 | 8 32 | ``` 33 | 34 | ## 判断字符串是否以某些字符开头 35 | 36 | ``` 37 | [[ ${STR} == h* ]] 38 | ``` 39 | 40 | 使用`双中括号`和`等于号`表示字符串`STR`是否以`h`开头。注意 41 | 42 | * `h*`不需要使用引号括起来,使用引号括起来是直接做相等比较 43 | * 比较语句使用双中括号括起来,而不是使用单中括号 44 | 45 | 也可以使用正则比较方式,将`==`改为`=~`即可 46 | 47 | ``` 48 | [[ "$str" =~ ^he.* ]] 49 | ``` 50 | 51 | * `he*`:不要使用`he*`,这里的`*`号表示`e`字符`0`到多个,即`h`,以及`heeee`都可测试通过 52 | * `he.*`:表示字符串是否包含`he` 53 | * `^he.*`:表示字符串是否以`he`开头 54 | 55 | ## 判断字符串是否为空 56 | 57 | 使用双中括号和参数`-z`或`-n` 58 | 59 | ``` 60 | $ cat test.sh 61 | #!/bin/bash 62 | 63 | if [[ -z ${1} ]] 64 | then 65 | echo "第一个参数为空字符串" 66 | fi 67 | 68 | if [[ -n ${2} ]] 69 | then 70 | echo "第二个参数不是空字符串" 71 | fi 72 | ``` 73 | 74 | 执行结果如下: 75 | 76 | ``` 77 | $ bash test.sh "" "adfa" 78 | 第一个参数为空字符串 79 | 第二个参数不是空字符串 80 | ``` 81 | 82 | ## 删除字符串 83 | 84 | ``` 85 | ${var#*//} 86 | ``` 87 | 88 | `#`是运算符,`var`是变量,`*//`表示删除**从左往后**第一个`//`及之前字符 89 | 90 | ``` 91 | ${var##*//} 92 | ``` 93 | 94 | `##`是运算符,表示删除**从左往后**最后一个`//`及之前字符 95 | 96 | ``` 97 | ${var%/*} 98 | ``` 99 | 100 | `%`是运算符,表示删除**从右往左**第一个`/`及之前字符 101 | 102 | ``` 103 | ${var%%/*} 104 | ``` 105 | 106 | `%%`是运算符,表示删除**从右往左**最后一个`/`及之前字符 107 | 108 | ## 提取字符串 109 | 110 | 语法如下: 111 | 112 | ``` 113 | ${string:begin[:num]} 114 | ``` 115 | 116 | `string`是字符串变量,`:begin`是起始下标(以0开始),`:num`是字符个数,如果为空,表示其后所有字符 117 | 118 | ``` 119 | $ cat test.sh 120 | #!/bin/bash 121 | 122 | var="/home/zj/hahahaha" 123 | 124 | # 截取/zj/hahahaha 125 | echo "${var:5}" 126 | 127 | # 截取/home/zj 128 | echo "${var:0:9}" 129 | 130 | # 截取zj 131 | echo "${var:6:2}" 132 | ``` 133 | 134 | 执行结果: 135 | 136 | ``` 137 | $ bash test.sh 138 | /zj/hahahaha 139 | /home/zj/ 140 | zj 141 | ``` 142 | 143 | ## 相关阅读 144 | 145 | * [Shell 字符串](https://www.runoob.com/linux/linux-shell-variable.html) 146 | 147 | * [Linux shell字符串截取与拼接](https://www.linuxidc.com/Linux/2015-03/115198.htm) 148 | 149 | * [Linux shell判断字符串是否以某些字符开头](https://majing.io/posts/10000006301174) 150 | -------------------------------------------------------------------------------- /docs/shell/条件表达式.md: -------------------------------------------------------------------------------- 1 | 2 | # 条件表达式 3 | 4 | 条件表达式作用于流程控制判断,有两种方式进行条件判断,一是中扩号,而是`test`命令 5 | 6 | ## 中括号 7 | 8 | * 使用单中括号(`[]`)作用于算术比较和文件属性测试 9 | * 使用双中括号(`[[]]`)作用于字符串比较 10 | 11 | ``` 12 | $ cat test.sh 13 | #!/bin/bash 14 | 15 | if [ ! 3 -eq 4 ] 16 | then 17 | echo "3不等于4" 18 | fi 19 | 20 | if [ -d $HOME ] 21 | then 22 | echo "${HOME}是目录" 23 | fi 24 | 25 | if [[ ! "11" = "1" ]] 26 | then 27 | echo "字符串11不等于1" 28 | fi 29 | ``` 30 | 31 | *注意:中括号和表达式之间要有空格隔开* 32 | 33 | 执行如下: 34 | 35 | ``` 36 | $ bash test.sh 37 | 3不等于4 38 | /home/zj是目录 39 | 字符串11不等于1 40 | ``` 41 | 42 | ## test 43 | 44 | `test`命令用于检测数值,字符和文件,实现如下: 45 | 46 | ``` 47 | $ cat test.sh 48 | #!/bin/bash 49 | 50 | if test ! 3 -eq 4 51 | then 52 | echo "3不等于4" 53 | fi 54 | 55 | if test -d $HOME 56 | then 57 | echo "${HOME}是目录" 58 | fi 59 | 60 | if test ! "11" = "1" 61 | then 62 | echo "字符串11不等于1" 63 | fi 64 | ``` 65 | 66 | 执行如下: 67 | 68 | ``` 69 | $ bash test.sh 70 | 3不等于4 71 | /home/zj是目录 72 | 字符串11不等于1 73 | ``` 74 | 75 | ## 相关阅读 76 | 77 | * [Shell 中的中括号用法总结](https://www.runoob.com/w3cnote/shell-summary-brackets.html) 78 | 79 | * [Shell test 命令](https://www.runoob.com/linux/linux-shell-test.html) 80 | -------------------------------------------------------------------------------- /docs/shell/流程控制.md: -------------------------------------------------------------------------------- 1 | 2 | # 流程控制 3 | 4 | 学习以下流程控制语句 5 | 6 | 1. `if` 7 | 2. `for` 8 | 3. `while` 9 | 4. `util` 10 | 5. `case` 11 | 12 | 以及跳出循环命令 13 | 14 | 1. `break` 15 | 2. `continue` 16 | 17 | **注意:`shell`的流程控制不可为空** 18 | 19 | ## if 20 | 21 | 格式如下: 22 | 23 | ``` 24 | if condition1 25 | then 26 | command1 27 | command2 28 | ... 29 | elif condition2 30 | then 31 | command1 32 | command2 33 | ... 34 | else 35 | command1 36 | command2 37 | ... 38 | fi 39 | ``` 40 | 41 | ## for 42 | 43 | 格式如下: 44 | 45 | ``` 46 | for var in item1 item2 ... itemN 47 | do 48 | command1 49 | command2 50 | ... 51 | done 52 | ``` 53 | 54 | 其中`in`列表可以使用数组,字符串或文件名 55 | 56 | ``` 57 | $ cat test.sh 58 | #!/bin/bash 59 | 60 | for str in 'This is a string' 'This is a num' 61 | do 62 | echo $str 63 | done 64 | 65 | for var in $@ 66 | do 67 | echo $var 68 | done 69 | ``` 70 | 71 | 执行如下命令 72 | 73 | ``` 74 | $ bash test.sh a b c d 75 | This is a string 76 | This is a num 77 | a 78 | b 79 | c 80 | d 81 | ``` 82 | 83 | ## while 84 | 85 | 格式如下: 86 | 87 | ``` 88 | while condition 89 | do 90 | command 91 | done 92 | ``` 93 | 94 | `while`循环可以使用关键字`read`读取键盘信息 95 | 96 | ``` 97 | $ cat test.sh 98 | #!/bin/bash 99 | 100 | echo '按下 退出' 101 | echo -n '输入: ' 102 | 103 | while read VAR 104 | do 105 | echo "打印:${VAR}" 106 | done 107 | ``` 108 | 109 | ## until 110 | 111 | 格式如下: 112 | 113 | ``` 114 | until condition 115 | do 116 | command 117 | done 118 | ``` 119 | 120 | ## case 121 | 122 | 格式如下: 123 | 124 | ``` 125 | case 值 in 126 | 模式1) 127 | command1 128 | command2 129 | ... 130 | commandN 131 | ;; 132 | 模式2) 133 | command1 134 | command2 135 | ... 136 | commandN 137 | ;; 138 | esac 139 | ``` 140 | 141 | ## break/continue 142 | 143 | * `break`命令用于跳出所有循环(终止执行后面的所有循环) 144 | * `continue`命令用于跳出当前循环 145 | 146 | ## 相关阅读 147 | 148 | * [Shell 流程控制](https://www.runoob.com/linux/linux-shell-process-control.html) -------------------------------------------------------------------------------- /docs/shell/输入和输出重定向.md: -------------------------------------------------------------------------------- 1 | 2 | # 输入和输出重定向 3 | 4 | ## 标准文件 5 | 6 | 一般情况下,每个`Unix/Linux`命令运行时都会打开三个文件: 7 | 8 | * 标准输入文件(`stdin`):`stdin`的文件描述符为`0`,`Unix`程序默认从`stdin`读取数据 9 | * 标准输出文件(`stdout`):`stdout`的文件描述符为`1`,`Unix`程序默认向`stdout`输出数据 10 | * 标准错误文件(`stderr`):`stderr`的文件描述符为`2`,`Unix`程序会向`stderr`流中写入错误信息 11 | 12 | 默认情况下,`stdin`、`stdout`和`stderr`指向的都是当前终端 13 | 14 | ## 重定向 15 | 16 | 可通过以下命令进行重定向 17 | 18 | ![](./imgs/redirect.png) 19 | 20 | 如果需要将标准错误文件重定向到文件,操作如下: 21 | 22 | ``` 23 | command 2 > file 24 | # 追加方式 25 | command 2 >> file 26 | ``` 27 | 28 | 如果将`stdout`和`stderr`合并在一起重定向,操作如下: 29 | 30 | ``` 31 | command > file 2>&1 32 | # 追加方式 33 | command >> file 2>&1 34 | ``` 35 | 36 | ## /dev/null 37 | 38 | `/dev/null`是一个特殊文件,写入该文件的内容将被舍弃,无法从`/dev/null`中读取内容,起到`禁止输出`的作用 39 | 40 | ``` 41 | # 重定向输出到/dev/null 42 | command > /dev/null 43 | # 重定向stdout和stderr 44 | command > /dev/null 2>&1 45 | ``` 46 | 47 | ## 相关阅读 48 | 49 | * [Shell 输入/输出重定向](https://www.runoob.com/linux/linux-shell-io-redirections.html) -------------------------------------------------------------------------------- /docs/tool/7zip.md: -------------------------------------------------------------------------------- 1 | 2 | # [7zip]解压缩文件和目录 3 | 4 | ## 安装 5 | 6 | 7 | * `linux` 8 | 9 | ``` 10 | $ sudo apt-get install p7zip-full 11 | ``` 12 | 13 | * `windows`:[7zip](https://www.7-zip.org/) 14 | 15 | ## 使用 16 | 17 | ``` 18 | Usage: 7z [...] [...] 19 | [<@listfiles...>] 20 | 21 | 22 | a : Add files to archive 23 | b : Benchmark 24 | d : Delete files from archive 25 | e : Extract files from archive (without using directory names) 26 | h : Calculate hash values for files 27 | i : Show information about supported formats 28 | l : List contents of archive 29 | rn : Rename files in archive 30 | t : Test integrity of archive 31 | u : Update files to archive 32 | x : eXtract files with full paths 33 | ``` 34 | 35 | * 打包文件/文件夹 36 | 37 | ``` 38 | $ 7z a Sample.zip Sample 39 | ``` 40 | 41 | * 解压文件/文件夹 42 | 43 | ``` 44 | $ 7z e Sample.zip 45 | ``` -------------------------------------------------------------------------------- /docs/tool/alias.md: -------------------------------------------------------------------------------- 1 | 2 | # [alias]命令别名设置 3 | 4 | `alias`是系统自带的命令别名设置工具 5 | 6 | ## 定义 7 | 8 | ``` 9 | # 定义新的命令别名 10 | alias 新的命令='原命令 选项 参数' 11 | # 取消命令别名 12 | unalias 新的命令 13 | ``` 14 | 15 | ## 预定义 16 | 17 | `alias`预先定义了几个命令别名 18 | 19 | ``` 20 | $ alias 21 | alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' 22 | alias egrep='egrep --color=auto' 23 | alias fgrep='fgrep --color=auto' 24 | alias grep='grep --color=auto' 25 | alias l='ls -CF' 26 | alias la='ls -A' 27 | alias ll='ls -alF' 28 | alias ls='ls --color=auto' 29 | ``` 30 | 31 | ## 自定义 32 | 33 | 临时定义:打开命令行窗口,输入 34 | 35 | ``` 36 | alias ... 37 | ``` 38 | 39 | 永久定义,修改`~/.bashrc`,输入 40 | 41 | ``` 42 | alias ... 43 | ``` 44 | 45 | ## 相关阅读 46 | 47 | * [alias command in Linux with Examples](https://www.geeksforgeeks.org/alias-command-in-linux-with-examples/) 48 | 49 | * [alias命令](https://man.linuxde.net/alias) 50 | -------------------------------------------------------------------------------- /docs/tool/apache-ant.md: -------------------------------------------------------------------------------- 1 | 2 | # Apache Ant 3 | 4 | 官网下载[二进制包](http://ant.apache.org/bindownload.cgi),需要预先安装好`JDK` 5 | 6 | ## 设置环境变量 7 | 8 | 修改`~/.bashrc`后刷新或重启即可 9 | 10 | $ vim ~/.bashrc 11 | # ant 12 | export ANT_HOME=/home/zj/software/ant/apache-ant-1.10.5 13 | export PATH=$PATH:$ANT_HOME/bin 14 | 15 | ## 测试 16 | 17 | $ ant -version 18 | Apache Ant(TM) version 1.10.5 compiled on July 10 2018 19 | 20 | ### 问题 21 | 22 | Unable to locate tools.jar 23 | 24 | 系统默认配置的`JDK`不太完善,需要重新安装`JDK` 25 | 26 | ## 相关阅读 27 | 28 | * [Ubuntu 16.04中ant的安装和配置](https://blog.csdn.net/weiganliu/article/details/83089602) 29 | * [Apache Ant运行时Unable to locate tools.jar解决方法](https://blog.csdn.net/xifeijian/article/details/8836438) -------------------------------------------------------------------------------- /docs/tool/aria2.md: -------------------------------------------------------------------------------- 1 | 2 | # [aria2]下载工具 3 | 4 | 今天在同事的帮助下终于搞定了`Linux`环境下磁力链下载的实现,使用[aria2](http://aria2.github.io/)实现,不需要在去虚拟机中开启迅雷下载了 5 | 6 | ## 简介 7 | 8 | >aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces. 9 | 10 | ## 安装 11 | 12 | ``` 13 | $ sudo apt install aria2 14 | ``` 15 | 16 | ## 操作 17 | 18 | ``` 19 | aria2c -x 16 -c 'magnet:?xt=urn:btih:d9027770e6b72966896a4c612cf8ff0e67c7fc28&dn=%e9%98%b3%e5%85%89%e7%94%b5%e5%bd%b1www.ygdy8.com.%e5%90%8c%e5%ad%a6%e9%ba%a6%e5%a8%9c%e4%b8%9d.HD.1080p.%e5%9b%bd%e8%af%ad%e4%b8%ad%e5%ad%97.mkv&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=udp%3a%2f%2fexplodie.org%3a6969%2fannounce&tr=udp%3a%2f%2fexodus.desync.com%3a6969%2fannounce' 20 | ``` 21 | 22 | * `-c`:断点续传 23 | * `-x`:分段下载功能 24 | 25 | **注意:下载开始后,`aria2`会现在本地创建一个空文件,其大小和最终大小一致** -------------------------------------------------------------------------------- /docs/tool/cmake.md: -------------------------------------------------------------------------------- 1 | 2 | # CMake 3 | 4 | 从官网下载:[Get the Software](https://cmake.org/download/)。可以下载源码自己编译,或者下载已编译库 5 | 6 | ## 编译源码 7 | 8 | 旧的`cmake`没有卸载 9 | 10 | $ cmake . 11 | $ make 12 | $ make install 13 | 14 | 旧的`cmake`已卸载 15 | 16 | $ ./bootstrap 17 | $ make 18 | $ make install 19 | 20 | ## 卸载cmake 21 | 22 | $ sudo apt-get remove --purge cmake 23 | $ sudo apt-get autoremove 24 | 25 | ## 安装cmake 26 | 27 | 将可执行文件的路径加入`~/.bashrc` 28 | 29 | $ vim ~/.bashrc 30 | ... 31 | # cmake 32 | PATH=/home/zj/software/cmake/cmake-3.14.0-rc3-Linux-x86_64/bin:$PATH 33 | 34 | 刷新环境变量后打印版本 35 | 36 | $ source ~/.bashrc 37 | $ cmake --version 38 | cmake version 3.14.0-rc3 39 | 40 | CMake suite maintained and supported by Kitware (kitware.com/cmake). 41 | 42 | ### cmake-gui启动器设置 43 | 44 | 在官网的已编译库中已存在`cmake-gui`文件,制作启动器 45 | 46 | $ gnome-desktop-item-edit --create-new ~/Desktop 47 | 48 | ![](./imgs/cmake-gui.png) 49 | 50 | 将`cmake-gui.desktop`放入`~/.local/share/applications`中,即可在搜索栏中检索得到`cmake-gui` 51 | 52 | $ cp Desktop/cmake-gui.desktop ~/.local/share/applications/ 53 | 54 | ## 相关阅读 55 | 56 | * [Linux cmake安装,配置以及测试](https://blog.csdn.net/u012005313/article/details/45844655) 57 | * [Installing CMake](https://cmake.org/install/) -------------------------------------------------------------------------------- /docs/tool/cp.md: -------------------------------------------------------------------------------- 1 | 2 | # [cp]复制目录下排除某个文件或文件夹外的所有文件 3 | 4 | 假设源目录地址为`dir-A`,结果目标地址为`dir-B`,要求是复制`dir-A`下所有文件/文件夹到`dir-B`,除了文件/文件夹`ccc` 5 | 6 | 1. 进入源目录地址 7 | 2. 执行复制命令 8 | 9 | ``` 10 | $ cd dir-A 11 | $ cp -r `ls dir-A | grep -v ccc | xargs` dir-B 12 | ``` 13 | 14 | ## 相关阅读 15 | 16 | * [Linux复制目录下排除某个文件或文件夹外的所有文件](https://blog.csdn.net/weixin_42970378/article/details/89177318) -------------------------------------------------------------------------------- /docs/tool/curl.md: -------------------------------------------------------------------------------- 1 | 2 | # [curl]网页调试 3 | 4 | 可以通过`curl`请求网页,查询部署是否成功 5 | 6 | ## 最简单的网页请求 7 | 8 | ``` 9 | $ curl www.baidu.com 10 | # 可以指定http还是https 11 | $ curl https://www.baidu.com 12 | ``` 13 | 14 | ## 证书不受信 15 | 16 | ``` 17 | -k 允许curl使用非安全的ssl连接并且传输数据(证书不受信) 18 | # 示例 19 | $ curl -k http://xxx.xxx.xxx:7700 20 | ``` 21 | 22 | ## 指定Http请求方法 23 | 24 | 默认为`Get`请求,使用参数`-X`指定 25 | 26 | ``` 27 | $ curl -X post http://xxx.xxx.xxx:7700 28 | ``` 29 | 30 | ## 相关阅读 31 | 32 | * [curl用法详解](https://www.cnblogs.com/lxyit/p/9173842.html) 33 | -------------------------------------------------------------------------------- /docs/tool/eog.md: -------------------------------------------------------------------------------- 1 | 2 | # [eog]命令行图像查看工具 3 | 4 | 使用工具`eog`可以在命令行打开图像文件 5 | 6 | ## 安装 7 | 8 | ``` 9 | $ sudo apt install eog 10 | ``` 11 | 12 | ## 使用 13 | 14 | ``` 15 | $ eog 图像文件路径 16 | ``` -------------------------------------------------------------------------------- /docs/tool/free.md: -------------------------------------------------------------------------------- 1 | 2 | # [free]内存使用查询 3 | 4 | 可通过查询文件`/proc/meminfo`来得到当前系统内存使用情况 5 | 6 | ``` 7 | $ cat /proc/meminfo 8 | MemTotal: 65591140 kB 9 | MemFree: 510832 kB 10 | MemAvailable: 51038268 kB 11 | Buffers: 5041216 kB 12 | Cached: 44588952 kB 13 | SwapCached: 265456 kB 14 | Active: 34707380 kB 15 | 。。。 16 | 。。。 17 | ``` 18 | 19 | 不过文件查询得到的按`kB`为单位的内存数据,可以使用命令[free](http://manpages.ubuntu.com/manpages/bionic/man1/free.1.html)显示系统中的可用和已用内存量 20 | 21 | ## 定义 22 | 23 | ``` 24 | free [选项] 25 | ``` 26 | 27 | 常用选项有: 28 | 29 | 1. -b:以字节显示输出 30 | 2. -m:以M字节显示输出 31 | 3. -g:以G字节显示输出 32 | 33 | ## 示例 34 | 35 | ``` 36 | # 中文 37 | # 以M字节显示输出 38 | $ free -m 39 | 总计 已用 空闲 共享 缓冲/缓存 可用 40 | 内存: 15782 12023 812 391 2945 3154 41 | 交换: 2047 21 2026 42 | # 英文 43 | ``` 44 | $ free -h 45 | total used free shared buff/cache available 46 | Mem: 62G 12G 335M 308M 49G 48G 47 | Swap: 7.6G 4.2G 3.5G 48 | ``` 49 | ``` 50 | 51 | 配合`watch`命令,每隔`1s`查询一次并显示 52 | 53 | ``` 54 | $ watch -n 1 free -m 55 | ``` 56 | 57 | ![](./imgs/free.gif) 58 | 59 | ## 字段说明 60 | 61 | 按行说明: 62 | 63 | * `Mem`:`CPU`内存使用 64 | * `Swap`:交换区内存使用 65 | 66 | 按列说明: 67 | 68 | * `total`:总内存。等同于`meminfo`中的`MemTotal`和`SwapTotal` 69 | * `used`:使用内存。其计算方式为`total - free - buffers - cache` 70 | * `free`:未使用内存。等同于`meminfo`中的`MemFree`和`SwapFree` 71 | * `shared`:`tmpfs`使用的内存(大部分)。等同于`meminfo`中的`Shmem` 72 | * `buffers`:内核缓冲区使用的内存。等同于`meminfo`中的`Buffers` 73 | * `cache`:页缓存和`slabs`使用的内存。等同于`Cached`和`SReclaimable` 74 | * `buff/cache`:`buffers`和`cache`之和 75 | * `available`:新应用可使用内存的估计,估计了未使用和缓存内存,不过有些缓存不一定能够释放 76 | 77 | ## cache和buffer的区别 78 | 79 | >buffer是即将要被写入磁盘的,而cache是被从磁盘中读出来的 80 | 81 | ## buff/cache内存占用过高 82 | 83 | 参考: 84 | 85 | * [Linux中buff/cache内存占用过高解决办法](https://www.cnblogs.com/cpw6/p/11711817.html) 86 | * [ubuntu下buff/cache占用过大处理](https://blog.csdn.net/hechaojie_com/article/details/82782880) 87 | 88 | ## 相关阅读 89 | 90 | * [【linux】free命令中cached和buffers的区别](https://www.cnblogs.com/chenpingzhao/p/5161844.html) 91 | 92 | * [Linux free 命令中 buffers 和 cached 有什么区别?](https://www.zhihu.com/question/51283353) 93 | -------------------------------------------------------------------------------- /docs/tool/grep-sed.md: -------------------------------------------------------------------------------- 1 | 2 | # [grep][sed]替换目录下所有符合条件的内容 3 | 4 | 参考[[grep]文本搜索](./grep-文本搜索.md)和[[sed]文本替换](./sed-文本替换.md) 5 | 6 | * 首先搜索所有的符合条件的内容,并打印出其文件名 7 | 8 | ``` 9 | grep -rl xxx ./ 10 | ``` 11 | 12 | * 然后在所有文件中替换符合条件的内容 13 | 14 | ``` 15 | sed -i 's/原先内容/替换内容/g' files... 16 | ``` 17 | 18 | * 完整实现如下: 19 | 20 | ``` 21 | sed -i 's/原先内容/替换内容/g' $(grep -rl 原先内容 ./) 22 | ``` -------------------------------------------------------------------------------- /docs/tool/grep.md: -------------------------------------------------------------------------------- 1 | 2 | # [grep]文本搜索 3 | 4 | ## 定义 5 | 6 | ``` 7 | grep [选项]... PATTERN [FILE]... 8 | ``` 9 | 10 | * `[选项]...`:可包含多个选项 11 | * `PATTERN`:匹配字符串 12 | * `[FILE]...`:可搜索多个文件 13 | 14 | 常用的选项有: 15 | 16 | 1. `-i`:忽略大小写 17 | 2. `-r`:递归搜索 18 | 3. `-l`:输出**符合**`PATTERN`的文件名 19 | 4. `-L`:输出**不包含**`PATTERN`的文件名 20 | 5. `-n`:输出符合`PATTERN`的行数 21 | 22 | ## 示例 23 | 24 | **Note:可组合多个选项一起使用** 25 | 26 | ### 无选项使用 27 | 28 | ``` 29 | $ grep "内容" examples.desktop 30 | Comment[zh_CN]=Ubuntu 示例内容 31 | ``` 32 | 33 | ### 打印行数 34 | 35 | ``` 36 | $ grep -n "内容" examples.desktop 37 | 234:Comment[zh_CN]=Ubuntu 示例内容 38 | ``` 39 | 40 | ### 忽略大小写 41 | 42 | ``` 43 | $ grep -i icon examples.desktop 44 | Icon=folder 45 | ``` 46 | 47 | ### 递归搜索 48 | 49 | ``` 50 | ~/nginx$ grep -r access . 51 | ./conf.d/default.conf: #access_log /var/log/nginx/host.access.log main; 52 | ./conf.d/default.conf: # deny access to .htaccess files, if Apache's document root 53 | ./nginx.conf: access_log /var/log/nginx/access.log main; 54 | ``` 55 | 56 | ### 打印符合条件的文件名 57 | 58 | 配置递归选项一起操作 59 | 60 | ``` 61 | $ grep -rl access . 62 | ./conf.d/default.conf 63 | ./nginx.conf 64 | ``` 65 | 66 | ## 相关阅读 67 | 68 | * [Linux 查找文本工具grep](https://blog.csdn.net/u012005313/article/details/46389441) -------------------------------------------------------------------------------- /docs/tool/imgs/cmake-gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/cmake-gui.png -------------------------------------------------------------------------------- /docs/tool/imgs/desktop-location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/desktop-location.png -------------------------------------------------------------------------------- /docs/tool/imgs/free.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/free.gif -------------------------------------------------------------------------------- /docs/tool/imgs/gnome-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/gnome-desktop.png -------------------------------------------------------------------------------- /docs/tool/imgs/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/note.png -------------------------------------------------------------------------------- /docs/tool/imgs/watch-free-diff.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/watch-free-diff.gif -------------------------------------------------------------------------------- /docs/tool/imgs/watch-free-no-header.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/watch-free-no-header.gif -------------------------------------------------------------------------------- /docs/tool/imgs/watch-free.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/docs/tool/imgs/watch-free.gif -------------------------------------------------------------------------------- /docs/tool/indicator-stickynotes.md: -------------------------------------------------------------------------------- 1 | 2 | # [Indicator Stickynotes]桌面便签 3 | 4 | 偶然的机会在其他人电脑上看到桌面便签,非常实用。尝试一款`Linux`下的便签工具 - [Indicator Stickynotes](https://launchpad.net/indicator-stickynotes/) 5 | 6 | ## 安装 7 | 8 | ``` 9 | sudo add-apt-repository ppa:umang/indicator-stickynotes 10 | 11 | sudo apt update 12 | 13 | sudo apt install indicator-stickynotes -y 14 | ``` 15 | 16 | ## 使用 17 | 18 | 进入菜单栏,选择`Indicator Stickynotes`图标即可打开。可以配置背景颜色、字体颜色和字体格式 19 | 20 | ![](./imgs/note.png) 21 | 22 | ## 相关阅读 23 | 24 | * [4个最佳的Linux便签应用程序:Stickynotes,Xpad,KNotes,Pin ‘Em Up](https://ywnz.com/linuxrj/5783.html) -------------------------------------------------------------------------------- /docs/tool/java.md: -------------------------------------------------------------------------------- 1 | 2 | # Java 3 | 4 | ## 下载 5 | 6 | 官网地址:[Java Linux](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) 7 | 8 | ### wget下载 9 | 10 | 直接复制下载地址然后使用`wget`下载会出错 11 | 12 | wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" + 右键复制的链接 13 | 14 | ## 设置环境变量 15 | 16 | 修改文件`/etc/profile`,添加如下环境变量后重启即可 17 | 18 | $ sudo vim /etc/profile 19 | # JAVA 20 | export JAVA_HOME=/home/zj/software/java/jdk1.8.0_201 21 | export JRE_HOME=$JAVA_HOME/jre 22 | export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH 23 | export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH 24 | 25 | ## 修改系统默认JDK 26 | 27 | 系统默认安装了`OpenJDK`,可以设置成`SunJDK`。首先添加`SunJDK`命令到`update-alternatives` 28 | 29 | ``` 30 | $ sudo update-alternatives --install /usr/bin/java java /home/zj/software/java/jdk1.8.0_201/bin/java 300 31 | 32 | $ sudo update-alternatives --install /usr/bin/javac javac /home/zj/software/java/jdk1.8.0_201/bin/javac 300 33 | update-alternatives: using /home/zj/software/java/jdk1.8.0_201/bin/javac to provide /usr/bin/javac (javac) in auto mode 34 | 35 | $ sudo update-alternatives --install /usr/bin/jar jar /home/zj/software/java/jdk1.8.0_201/bin/jar 300 36 | update-alternatives: using /home/zj/software/java/jdk1.8.0_201/bin/jar to provide /usr/bin/jar (jar) in auto mode 37 | 38 | $ sudo update-alternatives --install /usr/bin/javah javah /home/zj/software/java/jdk1.8.0_201/bin/javah 300 39 | update-alternatives: using /home/zj/software/java/jdk1.8.0_201/bin/javah to provide /usr/bin/javah (javah) in auto mode 40 | 41 | $ sudo update-alternatives --install /usr/bin/javp javap /home/zj/software/java/jdk1.8.0_201/bin/javap 300 42 | update-alternatives: using /home/zj/software/java/jdk1.8.0_201/bin/javap to provide /usr/bin/javp (javap) in auto mode 43 | ``` 44 | 45 | 添加了`java/javac/jar/javah/javap`,有些是系统没有配置的,比如`javac/jar/javah/javap`,有些是系统已有配置的,比如`java` 46 | 47 | 然后设置`SunJDK`命令为指定配置 48 | 49 | $ sudo update-alternatives --config java 50 | There are 2 choices for the alternative java (providing /usr/bin/java). 51 | 52 | Selection Path Priority Status 53 | ------------------------------------------------------------ 54 | * 0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto mode 55 | 1 /home/zj/software/java/jdk1.8.0_201/bin/java 300 manual mode 56 | 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode 57 | 58 | Press to keep the current choice[*], or type selection number: 1 59 | update-alternatives: using /home/zj/software/java/jdk1.8.0_201/bin/java to provide /usr/bin/java (java) in manual mode 60 | 61 | $ sudo update-alternatives --config javac 62 | There is only one alternative in link group javac (providing /usr/bin/javac): /home/zj/software/java/jdk1.8.0_201/bin/javac 63 | Nothing to configure. 64 | 65 | ## 测试 66 | 67 | $ java -version 68 | java version "1.8.0_201" 69 | Java(TM) SE Runtime Environment (build 1.8.0_201-b09) 70 | Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) 71 | $ javac -version 72 | javac 1.8.0_201 73 | 74 | ## 相关阅读 75 | 76 | * [如何用wget下载jdk](https://blog.csdn.net/lwgkzl/article/details/79889983) 77 | * [ubuntu18.04 安装java](https://blog.csdn.net/sangewuxie/article/details/80958611) 78 | * [Ubuntu18.04安装和配置 Java JDK 和 JRE,并卸载自带OpenJDK](https://blog.csdn.net/freeking101/article/details/80522586) -------------------------------------------------------------------------------- /docs/tool/ln.md: -------------------------------------------------------------------------------- 1 | 2 | # [ln]软链接和硬链接 3 | 4 | 命令`ln`能够为文件创建链接(类似于`windows`中的快捷方式),分为两种形式: 5 | 6 | 1. 软链接 7 | 2. 硬链接 8 | 9 | ## 软链接 10 | 11 | ### 定义 12 | 13 | ``` 14 | # -s, --symbolic make symbolic links instead of hard links 15 | $ ln -s 目标 链接名 16 | ``` 17 | 18 | 软链接又称为符号链接,其特性在于: 19 | 20 | ``` 21 | 1.软链接,以路径的形式存在。类似于Windows操作系统中的快捷方式 22 | 2.软链接可以 跨文件系统 ,硬链接不可以 23 | 3.软链接可以对一个不存在的文件名进行链接 24 | 4.软链接可以对目录进行链接 25 | ``` 26 | 27 | ### 示例 28 | 29 | #### 链接文件 30 | 31 | ``` 32 | # 创建文件a.txt 33 | $ touch a.txt 34 | # 为其创建链接文件b.txt 35 | $ ln -s a.txt b.txt 36 | ``` 37 | 38 | 注意:链接文件不需要提前创建 39 | 40 | 得到的`b.txt`就是`a.txt`的软链接 41 | 42 | ``` 43 | $ file b.txt 44 | b.txt: symbolic link to a.txt 45 | $ ls -al b.txt 46 | lrwxrwxrwx 1 zj zj 5 3月 13 13:58 b.txt -> a.txt 47 | ``` 48 | 49 | **注意 1:修改`b.txt`或者`a.txt`都会影响对方** 50 | 51 | **注意 2:删除`a.txt`后`b.txt`将失效** 52 | 53 | ``` 54 | $ rm a.txt 55 | $ cat b.txt 56 | cat: b.txt: 没有那个文件或目录 57 | ``` 58 | 59 | #### 链接目录 60 | 61 | 链接目录操作和链接文件一样 62 | 63 | ``` 64 | $ ln -s 源目录名 结果目录名 65 | ``` 66 | 67 | *注意 1:删除结果目录链接时不要最后加**斜杠**,像文件一样删除结果链接即可* 68 | 69 | 70 | *注意 2:当出现`符号连接的层数过多`的错误时,使用绝对路径即可解决* 71 | 72 | ## 硬链接 73 | 74 | ### 定义 75 | 76 | ``` 77 | $ ln 目标 链接名 78 | ``` 79 | 80 | 硬链接中的链接文件是原文件的一个别名,两者是同一文件。其特性如下: 81 | 82 | ``` 83 | 1.硬链接,以文件副本的形式存在。但不占用实际空间。 84 | 2.不允许给目录创建硬链接 85 | 3.硬链接只有在同一个文件系统中才能创建 86 | ``` 87 | 88 | ### 示例 89 | 90 | ``` 91 | # 查询两者的inode号 92 | $ ls -ai a.txt 93 | 19663043 a.txt 94 | $ ls -ai b.txt 95 | 19663043 b.txt 96 | ``` 97 | 98 | 可通过命令`stat`查询其是否属于硬链接(硬链接`>=1`) 99 | 100 | ``` 101 | $ stat a.txt 102 | 文件:a.txt 103 | 大小:0 块:0 IO 块:4096 普通空文件 104 | 设备:10302h/66306d Inode:19663043 硬链接:2 105 | ... 106 | ... 107 | $ stat b.txt 108 | 文件:b.txt 109 | 大小:0 块:0 IO 块:4096 普通空文件 110 | 设备:10302h/66306d Inode:19663043 硬链接:2 111 | ... 112 | ... 113 | ``` 114 | 115 | **Note: 删除原文件后,链接文件依然有效** 116 | 117 | ## 软链接 vs 硬链接 118 | 119 | 1. 软链接中的链接文件是独立文件,其指向原文件;而硬链接中的链接文件是原文件的一个别名,两者是同一文件 120 | 2. 软链接可以为目录建链接;硬链接只能用于文件 121 | 3. 硬链接不能跨文件系统操作 122 | 123 | ## 相关阅读 124 | 125 | * [Linux ln命令](https://www.runoob.com/linux/linux-comm-ln.html) 126 | 127 | * [ Linux硬链接,软连接和复制的区别 ](https://zhidao.baidu.com/question/374308002874537884.html) 128 | -------------------------------------------------------------------------------- /docs/tool/ls-df-du.md: -------------------------------------------------------------------------------- 1 | 2 | # [ls][df][du]查看文件、目录、文件系统大小 3 | 4 | 经常需要判断文件、文件夹和磁盘空间的大小,总结一下 5 | 6 | 常用命令包括: 7 | 8 | 1. `ls`:列出目录内容 9 | 2. `df`:报告文件系统磁盘空间使用情况 10 | 3. `du`:估计文件空间使用率 11 | 12 | ## 查看文件、文件夹大小 13 | 14 | ### 使用ls命令查看文件大小 15 | 16 | 查看指定目录下文件大小(**不包含隐藏文件**) 17 | 18 | # 当前目录 19 | $ ls -sh 20 | 总用量 727M 21 | 4.0K blogs 4.0K git 4.0K opencv 4.0K opencv_contrib 183M opencv_contrib.tar.gz 544M opencv.tar.gz 22 | # 指定目录 23 | $ ls -sh opencv 24 | 总用量 116K 25 | 4.0K 3rdparty 4.0K apps 4.0K cmake 68K CMakeLists.txt 4.0K CONTRIBUTING.md 4.0K data 4.0K doc 4.0K include 4.0K LICENSE 4.0K modules 4.0K platforms 4.0K README.md 4.0K samples 26 | 27 | 查看指定文件大小 28 | 29 | $ ls -sh opencv.tar.gz 30 | 544M opencv.tar.gz 31 | 32 | 参数`-s`表示以块为单位打印每个文件的分配大小 33 | 34 | -s, --size 35 | print the allocated size of each file, in blocks 36 | 37 | 参数`-h`表示打印人类可读大小 38 | 39 | -h, --human-readable 40 | with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G) 41 | 42 | **如果要查看目录下隐藏文件大小,可以增加参数`-a`** 43 | 44 | 参数`-a`表示不忽略隐藏文件(以点号开头) 45 | 46 | -a, --all 47 | do not ignore entries starting with . 48 | 49 | ### 使用sh命令查看文件、文件夹大小 50 | 51 | 查看当前目录下文件和文件夹大小 52 | 53 | $ du -sh * 54 | 3.2M blogs 55 | 7.8M git 56 | 646M opencv 57 | 237M opencv_contrib 58 | 183M opencv_contrib.tar.gz 59 | 544M opencv.tar.gz 60 | 61 | 查看指定文件或文件夹大小 62 | 63 | # 指定文件 64 | $ du -sh opencv/CMakeLists.txt 65 | 68K opencv/CMakeLists.txt 66 | # 指定文件夹 67 | $ du -sh opencv 68 | 646M opencv 69 | 70 | 参数`-s`表示只显示每个参数总的大小 71 | 72 | -s, --summarize 73 | display only a total for each argument 74 | 75 | 参数`-h`表示打印人类可读大小 76 | 77 | -h, --human-readable 78 | with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G) 79 | 80 | ## 查看文件系统磁盘空间使用情况 81 | 82 | 命令`df`用于显示包含每个文件名参数的文件系统上可用的磁盘空间量,默认磁盘空间以`1K`块为最小单位。 83 | 84 | $ df -h 85 | 文件系统 容量 已用 可用 已用% 挂载点 86 | udev 413M 0 413M 0% /dev 87 | tmpfs 87M 9.3M 78M 11% /run 88 | /dev/vda1 50G 3.5G 44G 8% / 89 | tmpfs 433M 24K 433M 1% /dev/shm 90 | tmpfs 5.0M 0 5.0M 0% /run/lock 91 | tmpfs 433M 0 433M 0% /sys/fs/cgroup 92 | tmpfs 87M 0 87M 0% /run/user/500 93 | # 或 94 | $ df -H 95 | 文件系统 容量 已用 可用 已用% 挂载点 96 | udev 433M 0 433M 0% /dev 97 | tmpfs 91M 9.8M 81M 11% /run 98 | /dev/vda1 53G 3.8G 47G 8% / 99 | tmpfs 454M 25k 454M 1% /dev/shm 100 | tmpfs 5.3M 0 5.3M 0% /run/lock 101 | tmpfs 454M 0 454M 0% /sys/fs/cgroup 102 | tmpfs 91M 0 91M 0% /run/user/500 103 | 104 | 参数`-h`表示打印人类可读大小,以`1024`为单位 105 | 106 | -h, --human-readable 107 | print sizes in powers of 1024 (e.g., 1023M) 108 | 109 | 参数`-H`同样表示打印人类可读大小,以`1000`为单位 110 | 111 | -H, --si 112 | print sizes in powers of 1000 (e.g., 1.1G) 113 | -------------------------------------------------------------------------------- /docs/tool/rsync.md: -------------------------------------------------------------------------------- 1 | 2 | # [rsync]传输 3 | 4 | ## 断点续传 5 | 6 | 之前经常使用`scp`进行远程文件的传送,不过当传送大文件时,经常下载到一半多后就断掉了。在网上找到一个新的传送工具 - [Rsync](https://wiki.archlinux.org/index.php/Rsync) 7 | 8 | ``` 9 | $ rsync -P source destination 10 | ``` 11 | 12 | * `-P`是两个参数的集合 - `--partial --progress` 13 | * `--partial`:保留部分传输的文件,也就是实现断点续传功能 14 | * `--progress`:显示进度 15 | 16 | *默认使用`SSH`协议进行传输* 17 | 18 | ## 文件同步 19 | 20 | 文件传输的另一种理解就是文件同步了,对于文件/文件夹的同步,`rsync`非常有效 21 | 22 | ``` 23 | # 同步本地文件夹到远程 24 | $ rsync -av local_folder/ @:/path/to/remote_folder 25 | # 同步远程到本地 26 | $ rsync -av @:/path/to/remote_folder/ local_folder 27 | # 同步到远程的过程中删除在远程目录中本地不存在的文件 28 | $ rsync -av --delete @:/path/to/remote_folder/ local_folder 29 | ``` 30 | 31 | * `-a`:打包方式,等同于`-rlptgoD (no -H,-A,-X)` 32 | * `-v`:输出传输信息 33 | 34 | **注意:`/`很重要** 35 | 36 | ## Rsync chown/chgrp出错 37 | 38 | * 参考:[解决 Rsync chown/chgrp 错误](https://blog.csdn.net/weixin_34327223/article/details/93397587) 39 | 40 | ## 相关阅读 41 | 42 | * [As cp/mv alternative](https://wiki.archlinux.org/index.php/Rsync) 43 | * [rsync](https://en.wikipedia.org/wiki/Rsync) -------------------------------------------------------------------------------- /docs/tool/sed.md: -------------------------------------------------------------------------------- 1 | 2 | # [sed]文本替换 3 | 4 | >sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distinguishes it from other types of editors. 5 | 6 | `sed`是一个流编辑器。流编辑器用于对输入流(文件或管道输入)执行基本的文本转换。虽然在某些方面类似于允许脚本编辑的编辑器(如`ed`),但`sed`只通过一次传递输入来工作,因此效率更高。但是`sed`在管道中过滤文本的能力使它与其他类型的编辑器有着特别的区别 7 | 8 | ## 定义 9 | 10 | ``` 11 | sed [选项]... {脚本(如果没有其他脚本)} [输入文件]... 12 | ``` 13 | 14 | * `[选项]...`:可包含多个选项 15 | * `{脚本(如果没有其他脚本)}`:替换内容和原内容 16 | * `[输入文件]...`:可包含多个文件 17 | 18 | 常用的选项有: 19 | 20 | * `-i`:在原文件替换内容 21 | 22 | ### 脚本 23 | 24 | 常用的脚本有: 25 | 26 | * `s/regexp/replacement/flags`:替换内容 27 | 28 | 其中常用的`flags`有: 29 | 30 | * `g`:全局替换 31 | 32 | 对于斜杆`/`而言,使用反斜杆`\`进行转义,比如原先内容为`http://aaa.com`,那么实现如下: 33 | 34 | ``` 35 | 's/http:\/\/aaa.com/replacement/flags' 36 | ``` 37 | 38 | ## 示例 39 | 40 | 测试文件`input.txt`,其内容为 41 | 42 | ``` 43 | hello world 44 | 45 | hello zj 46 | 47 | hi world 48 | 49 | hi zj 50 | ``` 51 | 52 | ### 无选项使用 53 | 54 | 使用`hi`替换`hello` 55 | 56 | ``` 57 | $ sed 's/hello/hi/g' input.txt 58 | hi world 59 | 60 | hi zj 61 | 62 | hi world 63 | 64 | hi zj 65 | ``` 66 | 67 | **Note:默认操作结果不覆盖原文件** 68 | 69 | ### 覆盖原文件 70 | 71 | ``` 72 | $ sed -i 's/hello/hi/g' input.txt 73 | $ cat input.txt 74 | hi world 75 | 76 | hi zj 77 | 78 | hi world 79 | 80 | hi zj 81 | ``` 82 | 83 | ## 相关阅读 84 | 85 | * [sed, a stream editor](https://www.gnu.org/software/sed/manual/sed.html) -------------------------------------------------------------------------------- /docs/tool/split-cat.md: -------------------------------------------------------------------------------- 1 | 2 | # [split][cat]分块或合并大文件 3 | 4 | ## 分块大文件 5 | 6 | 使用`split`命令,可以指定字节数 7 | 8 | ``` 9 | split [-b <字节>] [要切割的文件] [输出文件名,也可以是目录] 10 | ``` 11 | 12 | 比如按`100MB`分割文件`DJI_0004.MOV`,输出到目录`DJIs`,同时指定文件前缀为`DJI` 13 | 14 | ``` 15 | $ split -b 100MB DJI_0004.MOV DJIs/DJI 16 | $ ls -al DJIs/ 17 | 总用量 668976 18 | drwxr-xr-x 2 zj zj 4096 3月 3 10:03 . 19 | drwxr-xr-x 16 zj zj 4096 3月 3 10:03 .. 20 | -rw-r--r-- 1 zj zj 100000000 3月 3 10:03 DJIaa 21 | -rw-r--r-- 1 zj zj 100000000 3月 3 10:03 DJIab 22 | -rw-r--r-- 1 zj zj 100000000 3月 3 10:03 DJIac 23 | -rw-r--r-- 1 zj zj 100000000 3月 3 10:03 DJIad 24 | -rw-r--r-- 1 zj zj 100000000 3月 3 10:03 DJIae 25 | -rw-r--r-- 1 zj zj 100000000 3月 3 10:03 DJIaf 26 | -rw-r--r-- 1 zj zj 84999932 3月 3 10:03 DJIag 27 | $ du -sh DJIs/ 28 | 654M DJIs/ 29 | (base) zj@zj-ThinkPad-T470p:~/work$ du -sh DJIs/* 30 | 96M DJIs/DJIaa 31 | 96M DJIs/DJIab 32 | 96M DJIs/DJIac 33 | 96M DJIs/DJIad 34 | 96M DJIs/DJIae 35 | 96M DJIs/DJIaf 36 | 82M DJIs/DJIag 37 | ``` 38 | 39 | ## 合并文件 40 | 41 | 使用`cat`命令将分块文件合并回大文件 42 | 43 | ``` 44 | $ cat DJIs/* > DJI_2.MOV 45 | ``` 46 | 47 | ## 参考 48 | 49 | * [Linux split命令](https://www.runoob.com/linux/linux-comm-split.html) 50 | * [linux split 命令 大文件 文件分块 文件分割](https://blog.csdn.net/whatday/article/details/105886325) 51 | * [Linux cat 命令](https://www.runoob.com/linux/linux-comm-cat.html) 52 | * [Linux之cat合并多个文件](https://www.cnblogs.com/mrdoghead/p/12010452.html) -------------------------------------------------------------------------------- /docs/tool/sshfs.md: -------------------------------------------------------------------------------- 1 | 2 | # [sshfs]挂载远程文件系统 3 | 4 | `sshfs`是一个连接到`SSH`服务器的的远程文件系统客户端,它利用`SFTP`将远程文件系统挂载到本地 5 | 6 | ## 安装 7 | 8 | ``` 9 | $ sudo apt-get install sshfs 10 | ``` 11 | 12 | ## 挂载 13 | 14 | 通用范式如下: 15 | 16 | ``` 17 | sshfs [user@]host:[dir] mountpoint [options] 18 | ``` 19 | 20 | * 参数`user`指定远程用户名,如果被忽略将使用本地用户名 21 | * 参数`dir`指定远程目录,如果被忽略将挂载远程`home`目录 22 | * 参数`mountpoint`指定本地挂载点 23 | 24 | ## 卸载 25 | 26 | 有两种方式 27 | 28 | ``` 29 | $ fusermount -u mountpoint 30 | # 或者 31 | $ umount mountpoint 32 | ``` 33 | 34 | ## 相关阅读 35 | 36 | * [libfuse/sshfs](https://github.com/libfuse/sshfs) -------------------------------------------------------------------------------- /docs/tool/tabby.md: -------------------------------------------------------------------------------- 1 | 2 | # Tabby 3 | 4 | 被同事热情推荐了[tabby](https://tabby.sh/) - 一个自定义终端 5 | 6 | ## 简介 7 | 8 | `tabby`是一个命令行终端,跨平台(`Win/macOS/Linux`),拥有非常多的自定义属性。吸引我的主要有几下两点: 9 | 10 | 1. 集成`SSH`,能够方便的登录远程服务器 11 | 2. 集成`SFTP`,能够方便的进行文件传输 12 | 13 | 其它的比如自定义注意,自定义快捷键,分体式窗格啥的都是基本操作了。 14 | 15 | 更多的信息可以查看:[Tabby 中文介绍](https://github.com/Eugeny/tabby/blob/master/README.zh-CN.md) 16 | 17 | ## 相关链接 18 | 19 | * [ Eugeny/tabby](https://github.com/Eugeny/tabby/blob/master/README.zh-CN.md) -------------------------------------------------------------------------------- /docs/tool/tar.md: -------------------------------------------------------------------------------- 1 | 2 | # [tar]解压缩文件和目录 3 | 4 | `tar`是`Linux`系统下的解压缩命令,常用压缩格式为`.tar / .tar.gz` 5 | 6 | ## 参数解析 7 | 8 | `tar`常用参数 9 | 10 | 1. `-z`:通过`gzip`压缩成档案文件 11 | 2. `-c`:创建一个新档案文件 12 | 3. `-v`:详细地列出处理的文件 13 | 4. `-f`:使用档案文件或`ARCHIVE`设备 14 | 5. `-x`:从档案文件中解压出文件 15 | 6. `-t`:列出归档内容 16 | 7. `-C`:改变至目录 `DIR` 17 | 18 | ## 压缩 19 | 20 | 压缩指定文件 21 | 22 | $ tar -zcvf file.tar.gz file1 file2 ... 23 | 24 | 压缩当前目录所有文件 25 | 26 | # 不包括隐藏文件 27 | $ tar -zcvf file.tar.gz * 28 | # 包括隐藏文件 29 | $ tar -zcvf file.tar.gz * .[!.]* 30 | 31 | 压缩文件夹 32 | 33 | $ tar -zcvf test.tar.gz test 34 | 35 | ## 列出压缩文件内容 36 | 37 | $ tar -tf test.tar.gz 38 | 39 | ## 解压 40 | 41 | ### .tar.gz 42 | 43 | # 解压到当前文件夹 44 | $ tar -zxvf file.tar.gz 45 | # 解压到指定文件夹,注意:des已存在 46 | $ tar -zxvf file.tar.gz -C des 47 | 48 | ### .tar.xz 49 | 50 | ``` 51 | # 解压.xz文件 52 | $ xz -d xxx.tar.xz 53 | # 解压.tar文件 54 | $ tar -xvf xxx.tar 55 | ``` 56 | 57 | ## 打包文件 58 | 59 | 只进行打包操作 60 | 61 | ``` 62 | # 打包 63 | $ tar cvf xxx.tar file1 file2 ... 64 | # 解开 65 | $ tar -xvf xxx.tar 66 | ``` -------------------------------------------------------------------------------- /docs/tool/tee.md: -------------------------------------------------------------------------------- 1 | 2 | # [tee]数据写入和输出 3 | 4 | `tee`命令用于读取标准输入(`stdin`)的数据,同时写入文件和输出到标准输出(`stdout`) 5 | 6 | ## 语法 7 | 8 | ``` 9 | tee [OPTION]... [FILE]... 10 | ``` 11 | 12 | * 默认将输入数据覆盖写入指定文件 13 | * 可以同时写入到多个文件 14 | * 使用参数`-a`表示以追加方式写入文件 15 | 16 | 通过管道方式将标准输入数据传输到`tee`,比如 17 | 18 | ``` 19 | $ cat tt.txt | tee a.txt 20 | ``` 21 | 22 | ## 示例 23 | 24 | 写入单个文件 25 | 26 | ``` 27 | $ echo "hello world" | tee hello.txt 28 | hello world 29 | $ cat hello.txt 30 | hello world 31 | ``` 32 | 33 | 写入多个文件 34 | 35 | ``` 36 | $ echo "hello world" | tee hello.txt hello2.txt 37 | ``` 38 | 39 | 以追加方式写入 40 | 41 | ``` 42 | $ echo "hello world" | tee -a hello.txt hello2.txt 43 | ``` 44 | 45 | 如果只想要写入文件而不输出到`stdout`,需要重定向到`/dev/null` 46 | 47 | ``` 48 | $ echo "hello world" | tee hello.txt >> /dev/null 49 | ``` 50 | 51 | ## 相关阅读 52 | 53 | * [Linux tee命令](https://www.runoob.com/linux/linux-comm-tee.html) -------------------------------------------------------------------------------- /docs/tool/thunar.md: -------------------------------------------------------------------------------- 1 | 2 | # [thunar]文件管理器 3 | 4 | ## 引言 5 | 6 | `Ubuntu 20.04`默认使用`Nautilus`作为文件管理器,操作上没有啥大问题,只是发现在放大图片的时候最大只能支持`133%`的缩放比例。 7 | 8 | 在网上找到另一个文件管理器`Thunar`,它能够支持`400%`的图像缩放,对于我的工作而言更加的合适。 9 | 10 | ## 操作 11 | 12 | 安装也很简单 13 | 14 | ``` 15 | $ sudo apt install thunar 16 | ``` 17 | 18 | 启动它只需要在命令行执行`thunar`即可 19 | 20 | ## 相关阅读 21 | 22 | * [Thunar](https://wiki.archlinux.org/title/thunar) -------------------------------------------------------------------------------- /docs/tool/tmux.md: -------------------------------------------------------------------------------- 1 | 2 | # tmux 3 | 4 | [tmux](https://github.com/tmux/tmux)是类似于[screen](https://www.runoob.com/linux/linux-comm-screen.html)命令的终端复用器(`terminal multiplexer`) 5 | 6 | ## 介绍 7 | 8 | >1.1 会话与进程 9 | > 10 | >命令行的典型使用方式是,打开一个终端窗口(terminal window,以下简称"窗口"),在里面输入命令。用户与计算机的这种临时的交互,称为一次"会话"(session) 。 11 | > 12 | >会话的一个重要特点是,窗口与其中启动的进程是连在一起的。打开窗口,会话开始;关闭窗口,会话结束,会话内部的进程也会随之终止,不管有没有运行完。 13 | > 14 | >一个典型的例子就是,SSH 登录远程计算机,打开一个远程窗口执行命令。这时,网络突然断线,再次登录的时候,是找不回上一次执行的命令的。因为上一次 SSH 会话已经终止了,里面的进程也随之消失了。 15 | > 16 | >为了解决这个问题,会话与窗口可以"解绑":窗口关闭时,会话并不终止,而是继续运行,等到以后需要的时候,再让会话"绑定"其他窗口。 17 | > 18 | >1.2 Tmux 的作用 19 | > 20 | >Tmux 就是会话与窗口的"解绑"工具,将它们彻底分离。 21 | 22 | ## 安装 23 | 24 | ``` 25 | sudo apt install tmux 26 | ``` 27 | 28 | ## 使用 29 | 30 | * 新建会话 31 | 32 | 打开一个窗口,输入 33 | 34 | ``` 35 | # 默认 36 | $ tmux 37 | # 设置会话名 38 | $ tmux new -s 39 | ``` 40 | 41 | * 分离会话 42 | 43 | 使用快捷键`Ctrl+b d` 44 | 45 | * 查询会话 46 | 47 | ``` 48 | $ tmux ls 49 | 0: 1 windows (created Wed Jun 2 19:31:03 2021) [80x23] 50 | abc: 1 windows (created Wed Jun 2 19:43:01 2021) [80x23] 51 | ``` 52 | 53 | 默认会话从`0`开始编号,如果显式设置会话名,则会显示会话名 54 | 55 | * 进入会话 56 | 57 | ``` 58 | $ tmux a<或者attach> -t <会话名> 59 | ``` 60 | 61 | * 杀死会话 62 | 63 | 先进入会话,然后显式结束该窗口(输入`exit`)即可杀死该会话;或者输入如下命令 64 | 65 | ``` 66 | $ tmux kill-session -t <会话名> 67 | ``` 68 | 69 | * 鼠标可滚动 70 | 71 | 先执行命令`ctrl+b`,然后输入 72 | 73 | ``` 74 | set -g mouse on 75 | ``` 76 | 77 | ## 相关阅读 78 | 79 | * [Tmux 使用教程](http://www.ruanyifeng.com/blog/2019/10/tmux.html) 80 | * [如何使tmux能够使用鼠标上下滚动?](https://www.cnblogs.com/dakewei/p/14185174.html) -------------------------------------------------------------------------------- /docs/tool/touch-mkdir.md: -------------------------------------------------------------------------------- 1 | 2 | # [touch][mkdir]创建文件、文件夹 3 | 4 | ## 创建文件 5 | 6 | 使用命令`touch` 7 | 8 | $ touch 文件名 9 | 10 | ## 创建文件夹 11 | 12 | 使用命令`mkdir` 13 | 14 | $ mkdir 目录名 15 | # 同时创建父目录 16 | $ mkdir -p mkdir -------------------------------------------------------------------------------- /docs/tool/unrar.md: -------------------------------------------------------------------------------- 1 | 2 | # [unrar]解压缩rar文件 3 | 4 | 今天需要解压`HMDB51_org.tar`文件,它是一个双重压缩文件,找了很多资料,记录一下 5 | 6 | *Note:参考中使用了rar,服务器上只安装了unrar,效果是一样的* 7 | 8 | ## 使用 9 | 10 | 先解压第一层 11 | 12 | ``` 13 | $ unrar x hmdb51_org.rar hmdb51_org/ 14 | ``` 15 | 16 | 将解压文件保存在`hmdb51_org`目录下,解压得到了`51`个`.rar`文件 17 | 18 | ``` 19 | $ ls hmdb51_org 20 | brush_hair.rar fencing.rar punch.rar somersault.rar 21 | cartwheel.rar flic_flac.rar push.rar stand.rar 22 | catch.rar golf.rar pushup.rar swing_baseball.rar 23 | chew.rar handstand.rar ride_bike.rar sword_exercise.rar 24 | clap.rar hit.rar ride_horse.rar sword.rar 25 | climb.rar hug.rar run.rar talk.rar 26 | climb_stairs.rar jump.rar shake_hands.rar throw.rar 27 | dive.rar kick_ball.rar shoot_ball.rar turn.rar 28 | draw_sword.rar kick.rar shoot_bow.rar walk 29 | dribble.rar kiss.rar shoot_gun.rar walk.rar 30 | drink.rar laugh.rar sit.rar wave.rar 31 | eat pick.rar situp.rar 32 | eat.rar pour.rar smile.rar 33 | fall_floor.rar pullup.rar smoke.rar 34 | ``` 35 | 36 | 再将剩下的文件解压 37 | 38 | ``` 39 | $ cd hmdb51_org/ 40 | $ ls *.rar | xargs -n1 urar x 41 | ``` 42 | 43 | ## 相关阅读 44 | 45 | * [UCF101和HMDB51数据集的处理 for Human Action Recognition](https://blog.csdn.net/Amazingren/article/details/105408049) -------------------------------------------------------------------------------- /docs/tool/watch.md: -------------------------------------------------------------------------------- 1 | 2 | # [watch]命令监测 3 | 4 | `watch`命令能够周期性的执行某一个命令,并将执行结果输出到窗口 5 | 6 | ## 定义 7 | 8 | ``` 9 | watch [options] command 10 | ``` 11 | 12 | 常用选项有: 13 | 14 | 1. `-n`:间隔多少秒执行 15 | 2. `-t`:关闭头文本 16 | 3. `-d`:高亮显示变化的地方 17 | 18 | ## 示例 19 | 20 | ``` 21 | # 间隔2秒打印一次内存变化 22 | $ watch -n 2 free -m 23 | ``` 24 | 25 | ![](./imgs/watch-free.gif) 26 | 27 | ``` 28 | # 间隔2秒打印一次内存变化,同时关闭头文本 29 | $ watch -t -n 2 free -m 30 | ``` 31 | 32 | ![](./imgs/watch-free-no-header.gif) 33 | 34 | ``` 35 | # 高亮显示变化 36 | $ watch -d -n 2 free -m 37 | ``` 38 | 39 | ![](./imgs/watch-free-diff.gif) 40 | 41 | ## 相关阅读 42 | 43 | * [linux命令大全:watch](http://www.cainiaoxueyuan.com/yunwei/9502.html?wpzmaction=add&postid=9502) -------------------------------------------------------------------------------- /docs/tool/wc.md: -------------------------------------------------------------------------------- 1 | 2 | # [wc]统计目录中文件个数 3 | 4 | 使用`ls`和`wc`命令可以统计目录中文件个数 5 | 6 | ## wc 7 | 8 | ``` 9 | # 打印文件行数 10 | $ wc -l 11 | ``` 12 | 13 | ## ls 14 | 15 | ``` 16 | # 打印所有文件+目录 17 | $ ls 18 | # 打印所有文件 19 | $ ls -l | grep '^-' 20 | # 打印所有目录 21 | $ ls -l | grep '^d' 22 | # 递归打印所有文件 23 | $ ls -lR | grep '^- 24 | # 递归打印所有目录 25 | $ ls -lR | grep '^d' 26 | ``` 27 | 28 | ## ls + wc 29 | 30 | 1. 查询当前目录下文件+文件夹个数 31 | 32 | ``` 33 | $ ls | wc -l 34 | ``` 35 | 36 | 2. 查询当前目录下文件个数 37 | 38 | ``` 39 | $ ls -l | grep '^-' | wc -l 40 | ``` 41 | 42 | 3. 查询当前目录下文件夹个数 43 | 44 | ``` 45 | $ ls -l | grep '^d' | wc -l 46 | ``` 47 | 48 | 4. 查询当前目录下文件及子目录下的文件个数 49 | 50 | ``` 51 | $ ls -lR | grep '^-' | wc -l 52 | ``` 53 | 54 | 5. 查询当前目录下文件夹及子目录下的文件夹个数 55 | 56 | ``` 57 | $ ls -lR | grep '^d' | wc -l 58 | ``` 59 | 60 | ## 相关阅读 61 | 62 | * [【Linux】Linux下统计当前文件夹下的文件个数、目录个数](https://www.cnblogs.com/zeze/p/6839230.html) -------------------------------------------------------------------------------- /docs/tool/wget.md: -------------------------------------------------------------------------------- 1 | 2 | # [wget]文件下载 3 | 4 | `wget`是最常用的`Linux`下载工具了。实践过程中发现有一些参数很有用,记录一下 5 | 6 | ## 参数 7 | 8 | * 断点续传 9 | 10 | ``` 11 | -c, --continue 断点续传下载文件 12 | ``` 13 | 14 | * 不需要验证服务器证书 15 | 16 | ``` 17 | --no-check-certificate 不要验证服务器的证书。 18 | ``` 19 | 20 | * 取出URL查询内容,保存相应的文件名 21 | 22 | ``` 23 | --content-disposition 24 | ``` 25 | 26 | 还有一个很有用的小技巧,就是用单引号把`URL`括起来,这样`wget`就能解析整个地址了 27 | 28 | ## 示例 29 | 30 | 以下载`Win10 ISO`为例,其下载链接如下 31 | 32 | ``` 33 | https://software-download.microsoft.com/sg/Win10_2004_English_x64.iso?t=b71d6df1-e4fa-4a15-96e0-a0227b70d96c&e=1592790767&h=e27462a825a47057d8a5fedac94f2126 34 | ``` 35 | 36 | 使用`wget`进行下载,添加断点续传和URL解析功能 37 | 38 | ``` 39 | $ wget -c --content-disposition 'https://software-download.microsoft.com/sg/Win10_2004_English_x64.iso?t=b71d6df1-e4fa-4a15-96e0-a0227b70d96c&e=1592790767&h=e27462a825a47057d8a5fedac94f2126' 40 | --2020-06-21 09:53:08-- https://software-download.microsoft.com/sg/Win10_2004_English_x64.iso?t=b71d6df1-e4fa-4a15-96e0-a0227b70d96c&e=1592790767&h=e27462a825a47057d8a5fedac94f2126 41 | 正在解析主机 software-download.microsoft.com (software-download.microsoft.com)... 117.18.232.200 42 | 正在连接 software-download.microsoft.com (software-download.microsoft.com)|117.18.232.200|:443... 已连接。 43 | 已发出 HTTP 请求,正在等待回应... 200 OK 44 | 长度: 5268953088 (4.9G) [application/octet-stream] 45 | --2020-06-21 09:53:09-- https://software-download.microsoft.com/sg/Win10_2004_English_x64.iso?t=b71d6df1-e4fa-4a15-96e0-a0227b70d96c&e=1592790767&h=e27462a825a47057d8a5fedac94f2126 46 | 再次使用存在的到 software-download.microsoft.com:443 的连接。 47 | 已发出 HTTP 请求,正在等待回应... 200 OK 48 | 长度: 5268953088 (4.9G) [application/octet-stream] 49 | 正在保存至: “Win10_2004_English_x64.iso” 50 | 51 | Win10_2004_English_x64.iso 1%[> ] 93.08M 12.8MB/s 剩余 6m 57s^ 52 | ``` 53 | 54 | ## 问题:段错误 55 | 56 | 快下载完`Win10 ISO`的是否出现了错误 57 | 58 | ``` 59 | 段错误(核心已转储) 60 | ``` 61 | 62 | ### 解决一 63 | 64 | 我又在官网上重新下载了一次,速度非常快,平均`10MB/s`,就没有上面这个问题了 ??? 65 | 66 | ### 解决二 67 | 68 | 参考: 69 | 70 | [“段错误 (核心已转储) ”一种可能原因及其解决方法](https://blog.csdn.net/dahailantian1/articl) 71 | 72 | [ubuntu段错误(核心已转储)(待测试继续)](https://www.jianshu.com/p/de078af80bd5) 73 | 74 | 扩大系统的堆栈空间 75 | 76 | ``` 77 | $ ulimit -a 78 | core file size (blocks, -c) 0 79 | data seg size (kbytes, -d) unlimited 80 | scheduling priority (-e) 0 81 | file size (blocks, -f) unlimited 82 | pending signals (-i) 62941 83 | max locked memory (kbytes, -l) 16384 84 | max memory size (kbytes, -m) unlimited 85 | open files (-n) 1024 86 | pipe size (512 bytes, -p) 8 87 | POSIX message queues (bytes, -q) 819200 88 | real-time priority (-r) 0 89 | stack size (kbytes, -s) 8192 # 这里 90 | cpu time (seconds, -t) unlimited 91 | max user processes (-u) 62941 92 | virtual memory (kbytes, -v) unlimited 93 | file locks (-x) unlimited 94 | ``` 95 | 96 | 从`8192`扩大为`102400` 97 | 98 | ``` 99 | $ ulimit -s 102400 100 | ``` 101 | 102 | *注意:需要在同一命令行窗口下执行`ulimit`和`wget`* 103 | 104 | ## 问题:错误 403 105 | 106 | 解析路径后出现如下错误: 107 | 108 | ``` 109 | ... 110 | 错误 403:Forbidden 111 | ``` 112 | 113 | ### 解析 114 | 115 | >使用wget或curl请求资源时被服务器拒绝了,为了防止爬虫等消耗服务器资源,服务器根据你的请求头进行了选择性屏蔽,因此需要修改wget和curl的代理User-Agent来进行伪装。 116 | 117 | ### 解决 118 | 119 | 登录`Chrome`,输入`chrome://version/`,寻找`用户代理`选项 120 | 121 | ``` 122 | Google Chrome 83.0.4103.61 (正式版本) (64 位) 123 | 修订版本 94f915a8d7c408b09cc7352161ad592299f384d2-refs/branch-heads/4103@{#561} 124 | 操作系统 Linux 125 | JavaScript V8 8.3.110.9 126 | Flash 32.0.0.387 /home/zj/.config/google-chrome/PepperFlash/32.0.0.387/libpepflashplayer.so 127 | 用户代理 Mozixx/5.0 (X11; Linux x86_64) xxxxt/537.36 (KHTML, like Gecko) Chrome/xxxx3.61 xxari/537.36 ------ 在这里 128 | 命令行 /usr/bin/google-chrome-stable --flag-switches-begin --flag-switches-end --disable-webrtc-apm-in-audio-service 129 | ``` 130 | 131 | 下载`wget`时使用`-U`参数 132 | 133 | ``` 134 | wget xxx.xxx.xxx -U "用户代理" 135 | ``` 136 | 137 | ## 相关阅读 138 | 139 | * [使用wget或curl时 error 403 forbidden](https://blog.csdn.net/BobYuan888/article/details/88949296) 140 | * [什么是UserAgent以及使用浏览器查看UserAgent的方法](https://blog.csdn.net/BobYuan888/article/details/88950275) -------------------------------------------------------------------------------- /docs/tool/zip.md: -------------------------------------------------------------------------------- 1 | 2 | # [zip]解压缩文件和目录 3 | 4 | `zip`是跨平台(`Windows/Linux`)的解压缩命令,压缩格式为`.zip` 5 | 6 | ## 参数解析 7 | 8 | `zip`常用参数: 9 | 10 | 1. `-r`:递归目录 11 | 12 | `unzip`常用参数 13 | 14 | 1. `-d`:解压到指定目录 15 | 16 | ## 压缩 17 | 18 | 压缩指定文件 19 | 20 | $ zip test.zip file1 file2 ... 21 | 22 | 压缩当前目录所有文件 23 | 24 | # 不包括隐藏文件 25 | $ zip test.zip * 26 | # 包括隐藏文件 27 | $ zip test.zip * .[!.]* 28 | 29 | 压缩文件夹 30 | 31 | $ zip -r test.zip te3 32 | 33 | ## 解压 34 | 35 | # 解压到当前文件夹 36 | $ unzip test.zip 37 | # 解压到指定文件夹,如果不存在则新建 38 | $ unzip test.zip -d des 39 | -------------------------------------------------------------------------------- /imgs/LinuxGuide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZJDoc/LinuxGuide/74839ca79aacf88189623196488d2c2983bb48ba/imgs/LinuxGuide.png -------------------------------------------------------------------------------- /imgs/LinuxGuide.svg: -------------------------------------------------------------------------------- 1 | LinuxGuideGenerated by logo.svg, https://github.com/bubkoo/logo.svg -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | # 站点名称 2 | site_name: 'LinuxGuide' 3 | # 仓库链接 4 | repo_url: https://github.com/ZJDoc/LinuxGuide 5 | # 作者 6 | site_author: 'zhujian' 7 | # 版权信息 8 | copyright: '2021, zhujian' 9 | # 源文件目录 10 | docs_dir: 'docs' 11 | # 生成静态文件目录 12 | site_dir: 'site' 13 | # 额外信息 14 | extra: 15 | # 版本号 16 | version: 0.1.0 17 | # 主题 18 | theme: 19 | # name: 'readthedocs' 20 | # name: 'mkdocs' 21 | name: 'material' 22 | # markdown扩展 23 | markdown_extensions: 24 | # 参考[MathJax](https://squidfunk.github.io/mkdocs-material/reference/mathjax/),支持数学公式渲染 25 | - pymdownx.arithmatex: 26 | generic: true 27 | # 参考[Icons + Emojis](https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/),执行Markdown Emoji 28 | - pymdownx.emoji: 29 | emoji_index: !!python/name:materialx.emoji.twemoji 30 | emoji_generator: !!python/name:materialx.emoji.to_svg 31 | 32 | # mathjax 33 | extra_javascript: 34 | - javascripts/config.js 35 | - https://polyfill.io/v3/polyfill.min.js?features=es6 36 | - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js 37 | 38 | # 导航 39 | nav: 40 | - Home: index.md 41 | - 系统配置: 42 | - 更换国内源: configure/更换国内源.md 43 | - '[Ubuntu]DEBIAN_FRONTEND': configure/ubuntu-DEBIAN_FRONTEND.md 44 | - '[LOCALE]字符集设置': configure/locale-字符集设置.md 45 | - 扩展命令行窗口滚动行数: configure/扩展命令行窗口滚动行数.md 46 | - '[localtime]设置时区': configure/localtime-设置时区.md 47 | - '[Ubuntu]中文乱码': configure/ubuntu-中文乱码.md 48 | - '切换home目录到新硬盘': configure/切换home目录到新硬盘.md 49 | - 制作桌面启动器: configure/制作桌面启动器.md 50 | - '应用查询、安装、卸载和清理': configure/应用查询-安装-卸载-清理.md 51 | - '[apt]升级操作': configure/apt-升级操作.md 52 | - 查询阻塞进程并杀死: configure/查询阻塞进程并杀死.md 53 | - 删除陈旧的APT仓库: configure/删除陈旧的APT仓库.md 54 | - 系统备份: configure/系统备份.md 55 | - '[控制台窗口][快捷键]复制和粘贴': configure/快捷键-复制和粘贴.md 56 | - '[WPS]中文字体': configure/wps-中文字体.md 57 | 58 | - 'Ubuntu 16.04': 59 | - '[Thinkpad T470p]安装Ubuntu 16.04单系统及Nvidia显卡驱动安装': 'configure/[Thinkpad T470p]安装Ubuntu 16.04单系统及Nvidia显卡驱动安装.md' 60 | - '[Thinkpad T470p][Ubuntu 16.04]双显卡配置': 'configure/[Thinkpad T470p][Ubuntu 16.04]双显卡配置.md' 61 | - '[Ubuntu 16.04]Cuda和Cudnn安装': 'configure/[Ubuntu 16.04]Cuda和Cudnn安装.md' 62 | - '[Ubuntu 16.04]桌面美化': 'configure/[Ubuntu 16.04]桌面美化.md' 63 | - '[Ubuntu 16.04]VMware安装': 'configure/[Ubuntu 16.04]VMware安装.md' 64 | - '[Ubuntu 16.04]开放热点': 'configure/[Ubuntu 16.04]开放热点.md' 65 | - '[Ubuntu 16.04]Thunderbird邮箱配置': 'configure/[Ubuntu 16.04]Thunderbird邮箱配置.md' 66 | - 'Ubuntu 18.04': 67 | - '[Ubuntu 18.04]PPA方式安装Nvidia驱动': 'configure/[Ubuntu 18.04]PPA方式安装Nvidia驱动.md' 68 | - '[Ubuntu 18.04]桌面美化': 'configure/[Ubuntu 18.04]桌面美化.md' 69 | - '[Ubuntu 18.04]VMware安装': 'configure/[Ubuntu 18.04]VMware安装.md' 70 | - '[Docker][Ubuntu 18.04]g++安装失败': 'configure/[Docker][Ubuntu 18.04]g++安装失败.md' 71 | - 问题解答: configure/troubleshooting.md 72 | - 工具使用: 73 | - CMake: tool/cmake.md 74 | - Java: tool/java.md 75 | - 'Apache Ant': tool/apache-ant.md 76 | - '[Indicator Stickynotes]桌面便签': tool/indicator-stickynotes.md 77 | - '[grep]文本搜索': tool/grep.md 78 | - '[sed]文本替换': tool/sed.md 79 | - '[grep][sed]替换目录下所有符合条件的内容': tool/grep-sed.md 80 | - '[cp]复制目录下排除某个文件或文件夹外的所有文件': tool/cp.md 81 | - '[rsync]断点续传': tool/rsync.md 82 | - '[sshfs]挂载远程文件系统': tool/sshfs.md 83 | - '[tar]解压缩文件和目录': tool/tar.md 84 | - '[zip]解压缩文件和目录': tool/zip.md 85 | - '[7zip]解压缩文件和目录': tool/7zip.md 86 | - '[unrar]解压缩rar文件': tool/unrar.md 87 | - '[tee]数据写入和输出': tool/tee.md 88 | - '[split][cat]分块或合并大文件': tool/split-cat.md 89 | - '[alias]命令别名设置': tool/alias.md 90 | - '[ls][df][du]查看文件、目录、文件系统大小': tool/ls-df-du.md 91 | - '[touch][mkdir]创建文件、文件夹': tool/touch-mkdir.md 92 | - '[free]内存使用查询': tool/free.md 93 | - '[ln]软链接和硬链接': tool/ln.md 94 | - '[watch]命令监测': tool/watch.md 95 | - '[wget]文件下载': tool/wget.md 96 | - '[curl]网页调试': tool/curl.md 97 | - '[wc]统计目录中文件个数': tool/wc.md 98 | - '[eog]命令行图像查看工具': tool/eog.md 99 | - '[tmux]终端复用器': tool/tmux.md 100 | - '[aria2]下载工具': tool/aria2.md 101 | - '[thunar]文件管理器': tool/thunar.md 102 | - '[tabby]命令行终端': tool/tabby.md 103 | - 常用操作: 104 | - 格式化移动硬盘: operation/格式化移动硬盘.md 105 | - 复制大量小文件: operation/复制大量小文件.md 106 | - 对目录下的每一个文件夹单独打包: operation/对目录下的每一个文件夹单独打包.md 107 | - 访问控制: 108 | - 分区和文件系统: access/分区和文件系统.md 109 | - 文件权限: access/文件权限.md 110 | - 目录权限: access/目录权限.md 111 | - sudo使用: access/sudo使用.md 112 | - '用户查询、创建和删除': access/用户查询-创建和删除.md 113 | - 用户权限调整: access/用户权限调整.md 114 | - '组查询、创建和删除': access/组查询-创建和删除.md 115 | - 组权限调整: access/组权限调整.md 116 | - 本地用户信息: access/本地用户信息.md 117 | - 本地组信息: access/本地组信息.md 118 | - 用户密码: access/用户密码.md 119 | - 脚本语法: 120 | - 'dash vs. bash': shell/dash-bash.md 121 | - set: shell/set.md 122 | - 变量: shell/变量.md 123 | - 参数传递: shell/参数传递.md 124 | - 流程控制: shell/流程控制.md 125 | - 基本运算符: shell/基本运算符.md 126 | - 条件表达式: shell/条件表达式.md 127 | - 函数: shell/函数.md 128 | - 输入和输出重定向: shell/输入和输出重定向.md 129 | - 字符串: shell/字符串.md 130 | - 问题解答: shell/troubleshooting.md -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Automatically generated by https://github.com/damnever/pigar. 2 | --------------------------------------------------------------------------------