代码拉取完成,页面将自动刷新
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Linux</title>
<link>https://hello-world-example.github.io/linux/</link>
<description>Recent content on Linux</description>
<generator>Hugo -- gohugo.io</generator>
<atom:link href="https://hello-world-example.github.io/linux/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>lsof ( List Open Files)</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/lsof/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/lsof/</guid>
<description>lsof ( List Open Files) FD cwd: current work dirctory,应用程序的当前工作目录 txt :进程程序代码 .u: 该文件被打开并处于 读/写 模式 .r: 该文件被打开并处于 只读模式 更多详见: man lsof
TYPE DIR:目录 REG:文件 IPv4:网际协议 (IP) 套接字 unix: UNIX 域套接字 KQUEUE: 内核时间队列 更多详见: man lsof
案例 网络相关 # 列出所有的网络连接 $ lsof -i # 查看端口占用 $ lsof -i :8080 # 所有 TCP 网络连接信息 $ lsof -i tcp # 所有 UDP 网络连接信息 $ lsof -i udp 文件占用 # 打开 lsof.</description>
</item>
<item>
<title>perf(CPU)</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/perf/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/perf/</guid>
<description>perf 子命令列表 # 会输出所有的子命令 $ perf -h 命令 作用 record 收集采样信息,并将其记录在数据文件中 report 读取 perf record 创建的数据文件,并给出热点分析结果 timechart 针对测试期间系统行为进行可视化的工具 evlist 列出数据文件 perf.data 中所有性能事件。 list 列出当前系统支持的所有性能事件。包括硬件性能事件、软件性能事件以及检查点 top 类似于 top 命令,对系统性能进行实时分析 annotate 解析perf record生成的perf.data文件,显示被注释的代码。 archive 根据数据文件记录的build-id,将所有被采样到的elf文件打包。利用此压缩包,可以再任何机器上分析数据文件中记录的采样数据。 bench perf中内置的benchmark,目前包括两套针对调度器和内存管理子系统的benchmark。 buildid-cache 管理perf的buildid缓存,每个elf文件都有一个独一无二的buildid。buildid被perf用来关联性能数据与elf文件。 buildid-list 列出数据文件中记录的所有buildid。 diff 对比两个数据文件的差异。能够给出每个符号(函数)在热点分析上的具体差异。 inject 该工具读取perf record工具记录的事件流,并将其定向到标准输出。在被分析代码中的任何一点,都可以向事件流中注入其它事件。 kmem 针对内核内存(slab)子系统进行追踪测量的工具 kvm 用来追踪测试运行在KVM虚拟机上的Guest OS。 lock 分析内核中的锁信息,包括锁的争用情况,等待延迟等。 mem 内存存取情况 sched 针对调度器子系统的分析工具。 stat 执行某个命令,收集特定进程的性能概况,包括CPI、Cache丢失率等。 test perf对当前软硬件平台进行健全性测试,可用此工具测试当前的软硬件平台是否能支持perf的所有功能。 trace 关于syscall的工具。 probe 用于定义动态检查点 record -a 记录所有 CPU 事件 -o 指定录取保存数据的文件名,如:cycle.</description>
</item>
<item>
<title>top</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/top/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/top/</guid>
<description>top 启动参数 -b 不启用交互模式,直接打印结果 -n &lt;次数&gt; 循环显示的次数(与-b配合会输出完成的进程列表) -i &lt;时间&gt; 设置间隔时间 -u &lt;用户名&gt; 指定用户名 -p &lt;进程号&gt; 指定进程 -H 显示线程 交互参数 h:[重要]帮助命令 &lt;Space&gt;:立即刷新 s:设置刷新时间间隔 c:显示命令完全模式 t::显示或隐藏进程和CPU状态信息 m:显示或隐藏内存状态信息 l:显示或隐藏uptime信息 f:增加或减少进程显示标志 S:累计模式,会把已完成或退出的子进程占用的CPU时间累计到父进程的MITE+ P:按%CPU使用率排行 T:按MITE+排行 M:按%MEM排行 H:显示线程 u:指定显示用户进程 r:修改进程renice值 k: kill:进程 i:只显示正在运行的进程 W:保存对top的设置到文件~/.toprc,下次启动将自动调用toprc文件的设置 q:退出 Read More Linux命令工具 top详解 Linux top命令详解和使用技巧 </description>
</item>
<item>
<title>htop</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/htop/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/htop/</guid>
<description>htop 安装 # 启用 EPEL Repository yum -y install epel-release yum -y update # 安装 htop yum -y install htop 输入 htop 即可使用,效果如下:
Read More 官网
Linux htop工具使用详解
</description>
</item>
<item>
<title>zsh</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/007.zsh/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/007.zsh/</guid>
<description>zsh 切换 zsh $ chsh -s /bin/zsh # 查看 zsh 版本 $ /bin/zsh --version zsh 5.3 (x86_64-apple-darwin17.0) # 切换回 bash $ chsh -s /bin/bash oh-my-zsh # clone 仓库 $ git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh # 拷贝一份 zsh 模板 $ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc 环境变量 .zshrc : zsh 的用户环境变量文件 .bash_profile : bash 的用户环境变量文件 zsh 继承 bash 的环境变量配置 echo 'source ~/.bash_profile' &gt;&gt; ~/.zshrc echo 'source /etc/profile' &gt;&gt; ~/.zshrc 使用 agnoster 主题 主题列表: https://github.</description>
</item>
<item>
<title>var 变量与参数</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/010.var/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/010.var/</guid>
<description>参数与变量 Shell 参数 #!/bin/bash # sh ~/test.sh p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p123 # sh test.sh p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p123 # 当前执行的文件名 或 文件绝对路径 # 【注意】根据调用方式的不同,该值可能会返回不同的结果 echo $0 # 第一个参数 echo $1 # 第 10 个参数 echo ${10} # 如果没有是 空字符串 echo ${123} # 获取参数个数(不包含当前文件名) echo $# # 所有参数,当成一个字符串 echo $* ########## 以下代码输出: $* Parameter 1=p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p123 count=1 for param in &#34;$*&#34; do echo &#34;\$* Parameter $count=$param&#34; count=$[ $count + 1 ] done # 所有参数,当独立的单词,可以遍历 echo $@ ########## 以下代码输出 ########## $@ Parameter 1=p1 ########## $@ Parameter 2=p2 ########## .</description>
</item>
<item>
<title>var 字符串处理</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/011.var_string/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/011.var_string/</guid>
<description>String 变量处理 速记 三个特殊符号在键盘上的位置 # $ % $ 用来取值 # 在 $ 的左边,删除字符串的左边的内容,需要配合 * ,如:${str#*/} ## 是贪婪匹配,从左往右,# 是匹配到第一个,## 是匹配到最后一个,如: ${str##*/} % 在 $ 的右边,删除字符串的右边的内容,需要配合 * ,如:${str%/*} %% 是贪婪匹配,从右往左,% 是匹配到倒数第一个,%% 是匹配到开头第一个,如: ${str%%/*} 字符串替换 ${VALUE/OLD/NEW} 替换第一个,如: ${str/\//.} ${VALUE//OLD/NEW} 替换所有,如: ${str//\//.} 字符串截取 ${VALUE:OFFSET:LENGTH} 从左开始向右截取,如:${str:1} 、 ${str:1:2} ${VALUE:0-OFFSET:LENGTH} 从右开始向由截取,如:${str:0-1} 、 ${str:0-3:2} 变量默认值替换 ${VALUE:-WORD}:当变量未定义或者值为空时,返回值为 WORD 的内容,否则返回变量的值 ${VALUE:=WORD}:当变量未定义或者值为空时,返回 WORD 的值的同时并将 WORD 赋值给 VALUE,否则返回变量的值 ${VALUE:+WORD}:当变量 已赋值 时,其值才用 WORD 替换,否则不进行任何替换 ${VALUE:?</description>
</item>
<item>
<title>date</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/~date/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/~date/</guid>
<description>date 时区设置 常用命令 # 当前时间 $ date # 【临时】设置时间 $ date -s &#39;2020-09-18 11:12:09&#39; # 显示文件的最后修改时间 $ date -r filename 日期计算 # 显示后一天的日期 date --date=&#34;+1 day&#34; # 显示前一天的日期 date --date=&#34;-1 day&#34; # 显示上一月的日期 date --date=&#34;-1 month&#34; # 显示前一年的日期 date --date=&#34;-1 year&#34; 格式化输出 # 查看完整帮助,包含【时间格式】 $ date --help $ date +&#39;Format&#39; # 2020-09-18 11:16:55 $ date +&#39;%F %T&#39; # 2020-09-18 11:16:55 $ date +&#39;%Y-%m-%d %H:%M:%S&#39; # 2020年09月18日 星期五 11时18分44秒 $ date +&#39;%c&#39; # 一年中的第几天 $ date +&#39;%j&#39; # 自UTC 时间 1970-01-01 00:00:00 以来所经过的秒数 $ date +&#39;%s&#39; # 纳秒 $ date +&#39;%N&#39; hwclock 硬件时间 # 显示硬件时间 $ hwclock --show # 将当前时间和日期写入硬件,避免重启后失效 $ hwclock -w Read More Linux date命令的用法 </description>
</item>
<item>
<title>rpm</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/rpm/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/rpm/</guid>
<description>rpm (Redhat Package Manager) 常用 # 查询过滤 $ rpm -qa | grep &lt;package&gt; # 查询软件包名,不包含版本 $ rpm -q &lt;package_no_version&gt; # 卸载 $ rpm -e &lt;package_full_name&gt; # 安装并显示进度 $ rpm -ivh &lt;package.rpm&gt; 案例 【查询】文件属于哪个包 $ rpm -qf /usr/bin/ls coreutils-8.22-24.el7.x86_64 $ rpm -qf /usr/sbin/ip iproute-4.11.0-25.el7.x86_64 【查询】已安装包 &ldquo;安装到何处&rdquo; $ rpm -ql coreutils-8.22-24.el7.x86_64 | grep /bin .. /usr/bin/cp /usr/bin/csplit /usr/bin/cut /usr/bin/date /usr/bin/dd /usr/bin/df .. 【查看】已安装软件 &ldquo;包信息 &quot; # rpm -qi coreutils $ rpm -qi coreutils-8.</description>
</item>
<item>
<title>useradd 创建账户</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/Useradd/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/Useradd/</guid>
<description>useradd 创建账户 useradd 是一个 linux 命令,但是它提供了很多参数在用户使用的时候根据自己的需要进行设置 adduser 是一个 perl 脚本,在使用的时候会出现类似 人机交互的界面,提供选项让用户填写和选择,常见在 Ubuntu 系统下 有时又是同一个命令: /usr/sbin/adduser -&gt; useradd ,即 adduser 会 链接到 useradd Quick Start 【注意】 以下操作需要在 root 账户权限下操作
# 创建 kail 用户,并 生成 /home/kail 工作目录 $ useradd -m kail # 为 kail 用户 设置密码 $ passwd kail # 删除 kail 用户,并同时删除 /home/kail 工作目录 $ userdel -r kail useradd -m (默认)自动建立工作目录 -M 不自动建立工作目录 -c 账户备注,默认空字符串,cat /etc/passwd | grep kail 查看备注 -e 指定账号的有效期限,缺省表示永久有效 -f 指定在密码过期后多少天即关闭该账号 -r:建立系统账号 userdel 无参数 只删除用户,不删除工作目录 -r, --remove 同时删除工作目录 -f, --force 强制删除,例如登陆中的用户 usermod 修改账户 usermod -l &lt;new_name&gt; &lt;old_name&gt; 修改用户名 usermod -d &lt;new_home&gt; &lt;user_name&gt; 修改工作路径 usermod –g &lt;group_name&gt; &lt;user_name&gt; 将用户添加到用户组 Read More Linux中添加、修改和删除用户和用户组 </description>
</item>
<item>
<title>vim</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/250_String/Vim/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/250_String/Vim/</guid>
<description>Normal Mode 开始编辑
i 光标前 a 光标后 I 行前 A 行后 o 下一行 O 上一行 跳跃
^ 行首 $ 行尾 指定行 &lt;行号&gt;gg 文首 gg 文尾 GG 编辑
u 撤销 Ctrl + r 取消撤销 删除单个字符 x 剪切当前行 dd 复制当前行 yy 粘贴行 p Command Mode 设置行号 :set nu 打开高亮 :set hls 关闭高亮 :set nohls 查找 :/&lt;string&gt; 向下查找 n 向上查找 N 替换 %s/&lt;old_str&gt;/&lt;new_str&gt;/g 窗口 :split 水平分割窗口 :vsplit 垂直分割窗口 :close 关闭创库 Ctrl + w 切换窗口 案例 命令帮助 :help :w 执行外部命令 :!</description>
</item>
<item>
<title>mtr</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/mtr/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/220_Troubleshooting/mtr/</guid>
<description>mtr 常用的 ping,tracert,nslookup 一般用来判断主机的网络连通性,其实 Linux 下有一个更好用的网络联通性判断工具,它可以结合 ping、tracert、nslookup 来判断网络的相关特性,这个命令就是 mtr。mtr 全称 my traceroute,是一个把 ping 和 traceroute 合并到一个程序的网络诊断工具。
traceroute 默认使用UDP数据包探测,而mtr默认使用ICMP报文探测,ICMP在某些路由节点的优先级要比其他数据包低,所以测试得到的数据可能低于实际情况。
常用命令 无参数(mtr &lt;host&gt;):会不停的发送 CMP报文 进行探测
-r | -report : 会向主机发送 10 个 ICMP 包,然后直接输出结果
一般情况下 mtr 前几跳都是本地 ISP,后几跳属于服务商比如 Google 数据中心,中间跳数则是中间节点,如果发现前几跳异常,需要联系本地 ISP 服务提供上,相反如果后几跳出现问题,则需要联系服务提供商,中间几跳出现问题,则两边无法完全解决问题
-c: -r 参数来生成报告,只会发送10个数据包 , 可以通过 -c 制定发送数据包的个数
-s:定ping数据包的大小 ,如果设置为负数,则数据包大小是随机数
统计项说明 Host:显示的是IP地址或本机域名 Loss% 到达此节点的数据包丢包率,显示的每个对应IP的丢包率(TODO) Snt 发送包的数量 Last 最后一包的返回延时 Avg 平均延时 Best 最低延时 Wrst 最差延时 StDev 方差(稳定性) Read More mtr 查看路由网络连通性 traviscross/mtr 工具: 在线 traceroute </description>
</item>
<item>
<title>ntp</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/~ntp/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/~ntp/</guid>
<description>NTP(Network Time Protocol) 相关 :date 命令 、 时区设置 简介 ntp :Network Time Protocol 网络时间协议 ntpdate :命令,断点更新,会造成时间的跳跃,单独使用时一般需要 配置 crontab 定时更新 ntpd :服务,逐渐调整时间,好于 ntpdate + cron 组合 ntpd 服务在时间差距过大(1000秒)的时候会同步失败 需要先使用 ntpdate 强制更新,再使用 ntpd 逐步调整 NTP 服务的通信端口为 UDP 123 CST :China Standard Time 时区 ntpdate 强制更新 $ ntpdate ntp.ntsc.ac.cn the NTP socket is in use, exiting ntpdate 和 ntpd 不能同时使用,会出现端口占用的情况,需要先关掉 ntpd
# 查看端口占用 $ lsof -i :123 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ntpd 4814 ntp 16u IPv4 72066131 0t0 UDP localhost:ntp # 先关闭 ntpd 服务 $ service ntpd stop # 同步时间 $ ntpdate ntp.</description>
</item>
<item>
<title>if 条件语句</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/020.if/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/020.if/</guid>
<description>条件语句 语法结构 # 【注意 1】语句块内并不能为空 # 【注意 2】不要吝啬空格(与变量的定义不同,变量等号前后不能有空格) if [ expr ]; then echo &#34;if&#34; elif [ expr ]; then echo &#34;elif&#34; else echo &#34;else&#34; fi 速记 test expr 和 [ expr ] 效果相同 是 Shell 命令,通过 whereis [ =》 /bin/[, man [ 可查看命令帮助 用于 判断文件、判断字符串 ,支持 == 、!= 判断整数时,使用 -eq 、 -gt 形式 逻辑组合使用 -a 、 -o [[ expr ]] 支持 模式匹配 == 精确匹配: [[ hello == &quot;hell?</description>
</item>
<item>
<title>ssh-keygen 免密登陆</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/Ssh-keygen/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/Ssh-keygen/</guid>
<description>ssh-keygen 免密登陆 相关文件 id_rsa : 私钥 id_rsa.pub : 公钥 authorized_keys : 保存已经授权的客户端公钥;A 到 B 免密登陆,需要 把 A 的 id_rsa.pub 公钥,追加到 B 的 authorized_keys 文件中 known_hosts:ssh 没有类似于 https 的证书,需要认为确认链接是否可信 A 访问 B 时,会把 B 的公钥记录在其中,当下次访问相同计算机时,会核对公钥,如果不同会发出警告 如需关闭检查需修改配置,~/.ssh/config (/etc/ssh/sshd_config ) StrictHostKeyChecking no UserKnownHostsFile /dev/null 如何配置 # 生成 公钥和私钥 # -t 加密算法 # -P 提供密码直接生成 # -f 文件名 $ ssh-keygen -t rsa -P &#34;&#34; -f ~/.ssh/id_rsa -C &#34;备注,一般设置为主机名和邮箱等&#34; $ ll .</description>
</item>
<item>
<title>yum</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/yum/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/yum/</guid>
<description>yum (Yellow dog Update Modifier) 自动化地 升级/安装/移除 rpm包,收集 rpm包 的相关信息,检查依赖性并自动提示用户解决 关键之处是要有可靠的 repository,可以是 HTTP、FTP、本地 站点 /etc/yum.conf 配置文件 /etc/yum.repos.d/ 仓库配置 常用命令 # 查看帮助 $ yum help # 查找软件包 $ yum list | grep &lt;package&gt; # 查找已安装的包 $ yum list installed # 安装 $ yum install &lt;package&gt; $ yum reinstall &lt;package&gt; # 卸载 $ yum remove &lt;package&gt; # 查看包信息 $ yum info &lt;package&gt; # 查看日志 $ tail -fn 400 /var/log/yum.log 更新 # 查看可用的更新 $ yum check-update #【慎用】更新所有 rpm 包,也升级系统内核 $ yum update # 指定更新 $ yum update bash.</description>
</item>
<item>
<title>dpkg</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/Dpkg/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/Dpkg/</guid>
<description>dpkg (Debian Package) 常用 # 查询过滤 $ dpkg -l | grep &lt;package&gt; # 卸载 $ dpkg -P package-name # 删除软件包(包括配置信息) -P --purge $ dpkg -r package-name # 删除软件包(保留配置信息) -r --remove # 安装 $ dpkg -i &lt;package-name.deb&gt; 案例 【查询】文件属于哪个包 -S 后面必须跟文件,不能跟 链接
$ dpkg -S /bin/ls coreutils: /bin/ls $ dpkg -S /bin/ip iproute2: /bin/ip 【查询】已安装包 “安装到何处” $ dpkg -L coreutils | grep bin /bin /bin/cat /bin/chgrp /bin/chmod /bin/chown /bin/cp /bin/date /bin/dd .</description>
</item>
<item>
<title>for 循环语句</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/030.for/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/030.for/</guid>
<description>while # while read line ; do echo $line ; done &lt; file.txt while read line do echo $line done &lt; file.txt # at file.txt | while read line ; do echo $line ; done cat file.txt | while read line do echo $line done for *遍历文件中的每一行 【注意】每一行中不能有空格,遍历的元素实际上是按照空格分割的
# for line in `cat file.txt`; do echo $line; done for line in `cat /tmp/file.txt` do echo $line done 遍历字符串 可能有兼容性问题</description>
</item>
<item>
<title>数组操作</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/035.array/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/035.array/</guid>
<description>数组操作 # 初始化 $ array=([1]=&#34;a&#34; [2]=&#34;b&#34;) $ array=(&#34;a&#34; &#34;b&#34;) # ❤ 打印 ❤ $ echo $array a b # 当做多个元素 $ echo $array[@] a b # 当做一个字符串 $ echo $array[*] a b # 添加修改元素【注意】下标从 1 开始 $ array[1]=&#34;aaa&#34; # ❤ 数组长度 ❤ $ echo ${#array} 2 $ echo ${#array[@]} 2 $ echo ${#array[*]} 2 # ❤❤ 追加元素 ❤❤ $ array[${#array}+1]=&#34;c&#34; $ array[${#array}+1]=&#34;d&#34; $ echo ${array[@]} aaa b c d $ echo ${#array[@]} 4 # 批量追加 $ array=(&#34;${array[@]}&#34; 111 222 333 444) $ echo ${array[@]} aaa b c d 111 222 333 444 # ❤❤❤ 遍历数组 ❤❤❤ for item in ${array[@]} do echo &#34;&gt;&gt;&gt; ${item};&#34; done &gt;&gt;&gt; aaa; &gt;&gt;&gt; b; &gt;&gt;&gt; c; &gt;&gt;&gt; d; &gt;&gt;&gt; 111; &gt;&gt;&gt; 222; &gt;&gt;&gt; 333; &gt;&gt;&gt; 444; Read More linux shell 数组添加元素 </description>
</item>
<item>
<title>apt</title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/Apt/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/270_Package/Apt/</guid>
<description>APT (Advanced Packaging Tool) apt = apt-get 、 apt-cache 、 apt-config 最常用命令选项的集合 aptitude 是一个带 UI 的管理工具,也可以非 UI 方式运行 常用命令 # 查看帮助 $ sudo apt help # 查找软件包 $ sudo apt list | grep &lt;package&gt; # 查找已安装的包 $ sudo apt list &lt;package&gt; # 安装 $ sudo apt install &lt;package&gt; $ sudo apt reinstall &lt;package&gt; # 卸载 $ sudo apt remove &lt;package&gt; # 删除未使用到的包 $ sudo apt autoremove # 查看包信息 $ sudo apt show -a &lt;package&gt; # 查看日志 $ tail -fn 200 /var/log/apt/history.</description>
</item>
<item>
<title>function 函数</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/050.function/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/050.function/</guid>
<description>function 函数 函数定义 #!/bin/bash function foo() { echo &#34;foo function&#34; } # function 可写可不写 bar() { echo &#34;bar function&#34; # 默认是最后一条命令的运行结果 # 只能返回数字,范围 0~255 return 255 } # 调用两个函数 foo # foo 函数的返回 code echo $? bar # bar 函数的返回 code echo $? 【输出】
foo function
0
bar function
255
函数参数 同 Shell 文件参数,@see 变量与参数
取值 取参 描述 $# 传递到脚本或函数的参数个数 $* 以一个单字符串显示所有向脚本传递的参数 $@ 每个参数,参数列表 $$ 脚本运行的当前进程ID号 $!</description>
</item>
<item>
<title>输出从定向</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/900.21/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/900.21/</guid>
<description>输出从定向 输入输出设备代码 代码 操作符 描述 默认 Java 中表示 0 &lt; 、 &lt;&lt; 标准输入 (stdin) System.in 1 &gt; 、 &gt;&gt; 、 1&gt; 、 1&gt;&gt; 标准输出 (stdout),可省略数字 屏幕 System.out 2 2&gt; 、 2&gt;&gt; 标准错误输出 (stderr) 屏幕 System.err $ ll /dev/std* ... /dev/stdin -&gt; fd/0 ... /dev/stdout -&gt; fd/1 ... /dev/stderr -&gt; fd/2 执行测试代码 NohupMain.java import java.text.SimpleDateFormat; import java.</description>
</item>
<item>
<title>后台运行</title>
<link>https://hello-world-example.github.io/linux/docs/100_Shell/901.nohup/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/100_Shell/901.nohup/</guid>
<description>后台运行 概述 command &amp; 后台执行【关闭 当前 Session,任务会停止】 jobs 查看当前 Session 后台任务 fg %jobId 转为前台运行 Ctrl + C 发送 SIGINT(2) 中断前台任务 Ctrl + Z 前台任务转到后台,并暂停 bg %jobId 启动后台暂停的任务 nohup command 忽略所有挂断 SIGHUP(1) 信号 kill 默认发送 SIGTERM(15) 信号 Kill -9 为 SIGKILL(9) 信号 nohup 和 &amp; nohup 的作用的是 忽略挂断 SIGHUP(1) 信号 SIGHUP(1) 信号在关闭当前 Session 的时候产生,即关闭终端 一般需要配合 &amp; 后台运行命令(同时免疫 SIGINT 和 SIGHUP 信号),否则默认仍在在 前台执行,当执行 Ctrl + C 或 关闭终端 时 仍然会停止 nohup 执行的 Command 程序 如果没有重定向输出,默认输出到 当前目录的 nohup.</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/_sidebar/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/_sidebar/</guid>
<description> 故障排查 进程 ps pstree top htop 网络 mtr tcpdump nslookup route 监控 sysstat 常用命令 ls du df curl lsof kill pkill killall 权限 chmod chown chgrp chattr lsattr 字符串操作 grep *grep tr 小工具 date time 网络 ssh SSH 隧道 ssh-keygen 系统管理 service chkconfig systemd /etc /sysconfig /network-scripts ifcfg-eth0 /proc cpuinfo </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/_watch/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/_watch/</guid>
<description></description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/kill/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/kill/</guid>
<description>kill kill命令用来删除执行中的程序或工作。 将指定的信号送至程序。 默认的信息为SIGTERM(15),可将指定程序终止。 若仍无法终止该程序,可使用 SIGKILL(9) 强制删除程序。
选项 -l &lt;信息编号&gt;:若不加&lt;信息编号&gt;选项,则-l参数会列出全部的信息名称; -s &lt;信息名称或编号&gt;:指定要送出的信息; -a:当处理当前进程时,不限制命令名和进程号的对应关系; -p:指定kill 命令只打印相关进程的进程号,而不发送任何信号; -u:指定用户。 示例 $ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAX 只有SIGKILL(9)才可以无条件终止进程,其他信号进程都有权利忽略,下面是常用的信号:</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/killall/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/killall/</guid>
<description>killall http://man.linuxde.net/killall
完全配置进程名</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/ls/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/ls/</guid>
<description>ls -R:递归处理,显示目录下的所有文件及子目录 -r:以文件名反序排列并输出目录内容列表; -t:用文件和目录的更改时间排序; -a:显示所有档案及目录 -A:显示除影藏文件.和..以外的所有文件列表 -C:多列显示输出结果。这是默认选项; -l:与-C选项功能相反,所有输出信息用单列格式输出,不输出为多列; -h:可阅读的方式显示文件大小 -k:以KB(千字节)为单位显示文件大小; -m:用“,”号区隔每个文件和目录的名称; -L:如果遇到性质为符号链接的文件或目录,直接列出该链接所指向的原始文件或目录; -F:在每个输出项后追加文件的类型标识符 * 表示具有可执行权限的普通文件, / 表示目录,“@”表示符号链接, | 表示命令管道FIFO,“=”表示sockets套接字。 -b:将文件中的不可输出的字符以反斜线“”加字符编码的方式输出; &ndash;full-time:列出完整的日期与时间; &ndash;color[=WHEN]:使用不同的颜色高亮显示不同类型的。 </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/pkill/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/pkill/</guid>
<description>pkill http://man.linuxde.net/pkill
模糊配置进程名</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/ps/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/ps/</guid>
<description>ps 显示系统中所有进程信息 ps -ef 查看进程资源使用情况 ps aux USER : 用户名 %CPU : 进程占用的CPU百分比 %MEM : 占用内存的百分比 VSZ : 该进程使用的虚拟內存量(KB) RSS : 该进程占用的固定內存量(KB)(驻留中页的数量) STAT : 进程的状态 START : 该进程被触发启动时间 TIME : 该进程实际使用CPU运行的时间 其中STAT状态位常见的状态字符有 D : 无法中断的休眠状态(通常 IO 的进程); R : 正在运行可中在队列中可过行的; S : 处于休眠状态; T : 停止或被追踪; W : 进入内存交换 (从内核2.6开始无效); X : 死掉的进程 (基本很少见); Z : 僵尸进程; &lt; : 优先级高的进程 N : 优先级较低的进程 L : 有些页被锁进内存; s : 进程的领导者(在它之下有子进程); l : 多线程,克隆线程(使用 CLONE_THREAD, 类似 NPTL pthreads); : 位于后台的进程组; Linux下ps -ef和ps aux的区别及格式详解</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/pstree/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/pstree/</guid>
<description>pstree pstree命令以树状图的方式展现进程之间的派生关系,显示效果比较直观。
pstree -p 显示进程和线程关系的树状结构 pstree -p &lt;pid&gt; 显示指定进程和线程关系的树状结构 用法: pstree [ -a ] [ -c ] [ -h | -H 进程号 ] [ -l ] [ -n ] [ -p ] [ -u ] [ -A | -G | -U ] [ 进程号 | 用户 ] pstree -V 显示进程树。 `-a` 显示命令行参数 -A 使用 ASCII 画线符 -c 不压缩雷同的子树 -h 高亮显示当前进程及其祖先 -H 进程号 高亮显示 &#34;进程号&#34; 指定的进程当及其祖先 -G 使用 VT100 划线符 -l 不截断长行 -n 输出按进程号排序 -p 显示进程号;隐含 -c -u 显示用户名变换 -U 使用 UTF-8 (Unicode) 划线符 -V 显示版本信息 -Z 显示 SELinux 安全环境 进程号 从 &#34;进程号&#34; 开始,缺省是1(init) 用户 仅显示从该 &#34;用户&#34; 的进程开始的进程树 </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/stress/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/stress/</guid>
<description>stress stress 是一个 Linux 系统压力测试工具,常用作模拟异常进程导致平均负载升高的场景。</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/time/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/210_Common/time/</guid>
<description>在执行的命令前加上 time,显示命令执行时间
time command </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/230_Network/ssh/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/230_Network/ssh/</guid>
<description>SSH -1:强制使用ssh协议版本1 -2:强制使用ssh协议版本2 -4:强制使用IPv4地址 -6:强制使用IPv6地址 -A:开启认证代理连接转发功能 -a:关闭认证代理连接转发功能 -b:使用本机指定地址作为对应连接的源ip地址 -C:请求压缩所有数据 -F:指定ssh指令的配置文件 -f:后台执行ssh指令 -g:允许远程主机连接主机的转发端口 -i:指定身份文件 -l:指定连接远程服务器登录用户名 -N:不执行远程指令 -o:指定配置选项 -p:指定远程服务器上的端口 -q:静默模式 -X:开启X11转发功能 -x:关闭X11转发功能 -y:开启信任X11转发功能。 </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/230_Network/ssh/turnnel/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/230_Network/ssh/turnnel/</guid>
<description>[TOC]
SSH 隧道 公共参数 # Fork into background after authentication. # 后台认证用户/密码,通常和-N连用,不用登录到远程主机 -f # Enable compression. # 压缩数据传输。 -C # Do not execute a shell or command. # 不执行脚本或命令,通常与-f连用。 -N # Allow remote hosts to connect to forwarded ports. # 允许远程主机连接到建立的转发的端口 -g 本地端口转发 -L 将 本地/跳板机 的某个端口通过跳板机转发到远端指定机器的指定端口。
格式 :(本机/跳板机) ssh -Nfg -L &lt;执行的机器port&gt;:&lt;受限机IP&gt;:&lt;受限机port&gt; &lt;跳板机IP&gt;
**访问方式 :(本机)**&lt;执行的机器IP&gt;:&lt;执行的机器port&gt; &ndash;&gt; &lt;受限机IP&gt;:&lt;受限机port&gt;
动态端口转发 -D 动态端口允许通过配置一个本地端口,把通过隧道的数据转发到远端的所有地址。相当于一个 socks5 代理
格式 :(本机/代理机) ssh -Nfg -D [bind_address]:&lt;代理端口&gt; &lt;username&gt;@&lt;跳板机IP/提供代理服务的机器IP&gt; 访问方式 :(随便一台机器) curl --socks5 &lt;跳板机IP/提供代理服务的机器IP&gt;:&lt;代理端口&gt; http://www.</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/230_Network/tcpdump/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/230_Network/tcpdump/</guid>
<description>tcpdump 常用参数 tcpdump -D 查看可以监听的接口列表
-i &lt;eth0&gt; 指定网卡,可通过 tcpdump -D 查看
-c &lt;n&gt; 专区指定个数的包之后退出
-w &lt;file.pcap&gt; 数据写入到磁盘,可用 Wireshark 打开进行分析
-s &lt;snaplen&gt; 默认 64字节,设置为 0 会自动选择合适的长度来抓取数据包
-v | -vv | -vvv 输出更加详细的信息
特定协议 tcpdump tcp tcpdump udp 特定 IP 或 主机 tcpdump host &lt;ip&gt; tcpdump host &lt;ip1&gt; and &lt;ip2&gt; 抓取 ip1 和 ip2 之间的流量 tcpdump dst [host] &lt;ip&gt; 抓取出站信息(只有请求没有响应) tcpdump src [host] &lt;ip&gt; 抓取入站信息(只有响应没有请求) 特定端口 tcpdump port &lt;port&gt;</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/240_Disk/df/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/240_Disk/df/</guid>
<description>df 显示磁盘分区上的可使用的磁盘空间,默认显示单位为KB
-h或--human-readable:以可读性较高的方式来显示信息; -H:与-h参数相同,但在计算是以1000Bytes为换算单位而非1024Bytes; -l或&ndash;local:仅显示本地端的文件系统; -a | &ndash;all:包含全部的文件系统; 来自: http://man.linuxde.net/df</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/240_Disk/du/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/240_Disk/du/</guid>
<description>du -h 以可读的方式显示 -s 显示目录占用的磁盘空间大小,不要显示其下子目录和文件占用的磁盘空间大小 -d 深度(&ndash;max-depth=) -a 显示目录占用的磁盘空间大小,还要显示其下目录和文件占用磁盘空间的大小 -c 显示几个目录或文件占用的磁盘空间大小,还要统计它们的总和 # 当前目录占用磁盘的大小,而不单独列出各子项占用的容量 du -sh # 指定文件夹 folder 占用磁盘的大小 du -sh folder # 当前目录所有文件的大小 du -h -d 1 </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/250_String/grep/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/250_String/grep/</guid>
<description>*grep ngrep 搜索数据包和显示工具 egrep 在文件搜索文字字符串,与 grep -E 类似 fgrep 在文件搜索文字字符串 pgrep 搜索进程 </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/250_String/tr/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/250_String/tr/</guid>
<description>tr 从标准输入中替换、缩减和/或删除字符,并将结果写到标准输出,用法 tr [选项]... SET1 [SET2]
选项 -d, --delete 删除匹配SET1 的内容,并不作替换 -t, --truncate-set1 先将SET1 的长度截为和SET2 相等 -c 不对SET1进行操作 -s, --squeeze-repeats 如果匹配于SET1 的字符在输入序列中存在连续的重复,在替换时会被统一缩为一个字符的长度 SET 是一组字符串,一般都可按照字面含义理解。解析序列如下: \NNN 八进制值为NNN 的字符(1 至3 个数位) \\ 反斜杠 \a 终端鸣响 \b 退格 \f 换页 \n 换行 \r 回车 \t 水平制表符 \v 垂直制表符 字符1-字符2 从字符1 到字符2 的升序递增过程中经历的所有字符 [字符*] 在SET2 中适用,指定字符会被连续复制直到吻合设置1 的长度 [字符*次数] 对字符执行指定次数的复制,若次数以 0 开头则被视为八进制数 [:alnum:] 所有的字母和数字 [:alpha:] 所有的字母 [:blank:] 所有呈水平排列的空白字符 [:cntrl:] 所有的控制字符 [:digit:] 所有的数字 [:graph:] 所有的可打印字符,不包括空格 [:lower:] 所有的小写字母 [:print:] 所有的可打印字符,包括空格 [:punct:] 所有的标点字符 [:space:] 所有呈水平或垂直排列的空白字符 [:upper:] 所有的大写字母 [:xdigit:] 所有的十六进制数 [=字符=] 所有和指定字符相等的字符 常见用法 构建classpath java -classpath $(echo lib/*.</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chattr/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chattr/</guid>
<description>chattr chattr命令用来改变文件属性。这项指令可改变存放在ext2文件系统上的文件或目录属性,这些属性共有以下8种模式:
属性 a:让文件或目录仅供追加用途; b:不更新文件或目录的最后存取时间; c:将文件或目录压缩后存放; d:将文件或目录排除在倾倒操作之外; i:不得任意更动文件或目录; s:保密性删除文件或目录,磁盘空间会被收回; S:即时更新文件或目录; u:预防意外删除,与s相反,删除后,数据内容还在磁盘上 选项 -R:递归处理,将指令目录下的所有文件及子目录一并处理; -v&lt;版本编号&gt;:设置文件或目录版本; -V:显示指令执行过程; +&lt;属性&gt;:开启文件或目录的该项属性; -&lt;属性&gt;:关闭文件或目录的该项属性; =&lt;属性&gt;:指定文件或目录的该项属性。 实例 禁止修改文件 chattr +i /etc/fstab 然后试一下rm、mv、rename等命令操作于该文件,都是得到Operation not permitted的结果。
只能追加不能删除 chattr +a /data1/user_act.log Read More chattr 命令 Linux的chattr与lsattr命令详解
</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chgrp/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chgrp/</guid>
<description>chgrp chgrp命令用来改变文件或目录所属的用户组 组名可以是用户组的id,也可以是用户组的组名 文件名可以 是由空格分开的要改变属组的文件列表,也可以是由通配符描述的文件集合 如果用户不是该文件的文件主或超级用户(root),则不能改变该文件的组 在UNIX系统家族里,文件或目录权限的掌控以拥有者及所属群组来管理 # 将目录 /usr/kail 及其下面的所有文件、子目录的 用户组 改成 yang: chgrp -R yang /usr/kail Read More chgrp命令
</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chmod/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chmod/</guid>
<description>chmod chmod命令用来变更文件或目录的权限。
在UNIX系统家族里,文件或目录权限的控制分别以读取、写入、执行3种一般权限来区分,另有3种特殊权限可供运用。
用户可以使用chmod指令去变更文件与目录的权限,设置方式采用文字或数字代号皆可。
符号连接的权限无法变更,如果用户对符号连接修改权限,其改变会作用在被连接的原始文件。
权限范围 u User,即文件或目录的拥有者; g Group,即文件或目录的所属群组; o Other,除了文件或目录拥有者或所属群组之外,其他用户皆属于这个范围; a All,即全部的用户,包含拥有者,所属群组以及其他用户; r 读取权限,数字代号为&rdquo;4&quot;; w 写入权限,数字代号为&rdquo;2&quot;; x 执行或切换权限,数字代号为&rdquo;1&quot;; - 不具任何权限,数字代号为&rdquo;0&quot;; s 特殊功能说明:变更文件或目录的权限。 选项 -R或--recursive:递归处理,将指令目录下的所有文件及子目录一并处理; -c或--changes:效果类似“-v”参数,但仅回报更改的部分; -v或--verbose:显示指令执行过程; -f或--quiet或--silent:不显示错误信息; --reference=&lt;参考文件或目录&gt;:把指定文件或目录的所属群组全部设成和参考文件或目录的所属群组相同; &lt;权限范围&gt;+&lt;权限设置&gt;:开启权限范围的文件或目录的该选项权限设置; &lt;权限范围&gt;-&lt;权限设置&gt;:关闭权限范围的文件或目录的该选项权限设置; &lt;权限范围&gt;=&lt;权限设置&gt;:指定权限范围的文件或目录的该选项权限设置; 示例 # 设置自己可以执行,组员可以写入的权限 chmod u+x,g+w file # 拥有者设置读写可执行;组设置读写权限;其它用户只读 chmod u=rwx,g=rw,o=r file # 拥有者设置读写可执行(4+2+1);组设置读写权限(4+2);其它用户只读(4) chmod 764 file # 所有用户设置可执行权限 chmod a+x file 特殊权限 sticky bit 只对目录有效,使目录下的文件,只有文件拥有者才能删除 如果他不属于owner,仅属于group或者other,就算他有w权限,也不能删除 加sticky bit的方法:
chmod o+t dir chmod 1777 dir 用ls -l,可以看到有类似这样的权限:-rwxrwxrwt,t就代表已经加上了sticky bit,而且生效了;如果显示的是-rwxrwxrwT,说明也已经加上了sticky bit,但没有生效。</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chown/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/chown/</guid>
<description>chown chown 命令改变某个文件或目录的所有者和所属的组 该命令可以向某个用户授权,使该用户变成指定文件的所有者或者改变文件所属的组 用户可以是用户或者是用户D,用户组可以是组名或组id 文件名可以使由空格分开的文件列表,在文件名中可以包含通配符 只有文件主和超级用户才可以使用用该命令 # 把文件 dir 给uesr,添加到market组 `ll -d dir` 查看目录 dir 的属性 chown user:market dir # 将目录 /usr/kail 及其下面的所有文件、子目录的文件主改成 yang: chown -R yang /usr/kail </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/lsattr/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/260_Auth/lsattr/</guid>
<description>lsattr lsattr命令用于查看chattr设置的文件系统属性。
参数 -E:可显示设备属性的当前值,但这个当前值是从用户设备数据库中获得的,而不是从设备直接获得的。 -D:显示属性的名称,属性的默认值,描述和用户是否可以修改属性值的标志。 -R:递归的操作方式; -V:显示指令的版本信息; -a:列出目录中的所有文件,包括隐藏文件。 lsattr经常使用的几个选项-D,-E,-R这三个选项不可以一起使用,它们是互斥的。</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/280_System/_sysstat/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/280_System/_sysstat/</guid>
<description>systat 工具集 安装 sudo apt install sysstat
包含的命令
iostat : mpstat : pidstat : tapestat cifsiostat Read More Github 仓库 :https://github.com/sysstat/sysstat 官方文档:http://sebastien.godard.pagesperso-orange.fr/documentation.html </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/280_System/service/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/280_System/service/</guid>
<description>service &lt;name&gt; reload service &lt;name&gt; start service &lt;name&gt; stop service &lt;name&gt; restart service &lt;name&gt; status </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/280_System/systemd/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/280_System/systemd/</guid>
<description>Read More systemctl 命令完全指南
Systemd 入门教程:命令篇
Systemd 入门教程:实战篇
systemctl vs chkconfig
systemctl service /etc/init.d 区别
chkconfig 和 systemctl 区别 &amp; 对比
</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/290_Compression/gzip/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/290_Compression/gzip/</guid>
<description></description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/290_Compression/tar/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/290_Compression/tar/</guid>
<description></description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/200_Command/290_Compression/zip/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/200_Command/290_Compression/zip/</guid>
<description>zip zip是个使用广泛的压缩程序,文件经它压缩后会另外产生具 有&rdquo;.zip&quot;扩展名的压缩文件
语法 zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$] [-b &lt;工 作目录&gt;] [-ll] [-n &lt;字 尾字符串&gt;] [-t &lt;日 期时间&gt;] [-&lt;压 缩效率&gt;] [压 缩文件] [文件...] [-i &lt;范本样式&gt;] [-x &lt;范本样式&gt;] 参数 -A 调整可执行的自动解压缩文件。 -b&lt;工作目录&gt; 指定暂时存放文件的目录。 -c 替每个被压缩的文件加上注释。 -d 从压缩文件内删除指定的文件。 ## -D 压缩文件内不建立目录名称。 -f 此参数的效果和指定&quot;-u&quot;参 数类似,但不仅更新既有文件,如果某些文件原本不存在于压缩文件内,使用本参数会一并将其加入压缩文件中。 -F 尝试修复已损坏的压缩文件。 -g 将 文件压缩后附加在既有的压缩文件之后,而非另行建立新的压缩文件。 -h 帮助。 -i&lt;范本样式&gt; 只压缩符合条件的文件。 -j 只保存文件名称及其内容,而不存放任何目录名称。 ## -J 删除压缩文件前面不必要的数据。 -k 使用MS-DOS兼容格式的文件名称。 -l 压缩文件时,把LF字符 置换成LF+CR字 符。 -ll 压缩文件时,把LF+CR字 符置换成LF字符。 -L 显示版权信息。 -m 将文件压缩并加入压缩文件后,删除原始文件,即把文件移到压缩文件中。 -n&lt;字尾字符串&gt; 不压缩具有特定字尾字符串的文件。 -o 以压缩文件内拥有最新更改时间的文件为准,将压缩文件的更改时间设成和该文件相同。 -q 不显示指令执行过程 ## -r 递归处理,将指定目录下的所有文件和子目录一并处理 ## -S 包含系统和隐藏文件。 -t&lt;日期时间&gt; 把 压缩文件的日期设成指定的日期。 ## -T 检查备份文件内的每个文件是否正确无误。 -u 更换较新的文件到压缩文件内。 -v 显示指令执行过程或显示版本信息。 -V 保存VMS操作系统的文 件属性。 -w 在文件名称里假如版本编号,本参数仅在VMS操 作系统下有效。 -x&lt;范本样式&gt; 压缩时排除符合条件的文件。 -X 不保存额外的文件属性。 -y 直接保存符号连接,而非该连接所指向的文件,本参数仅在UNIX之类的系统下有效。 -z 替压缩文件加上注释。 -$ 保存第一个被压缩文件所在磁盘的卷册名称。 -&lt;压缩效率&gt; 压缩效率是一个介于1-9的数值。 例子 压缩test.</description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/900_FAQ/Change-Hostname/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/900_FAQ/Change-Hostname/</guid>
<description>修改主机名 临时修改 # 当前主机名 $ hostname # 临时修改 $ hostname kail.pc CentOS 永久修改 # 1. 新增或修改 HOSTNAME $ vim /etc/sysconfig/network HOSTNAME=kail.pc # 2. hosts 映射 $ vim /etc/hosts 127.0.0.1 kail.pc Ubuntu 永久修改 $ vim /etc/hostname kail.pc # 重启后查看 $ reboot </description>
</item>
<item>
<title></title>
<link>https://hello-world-example.github.io/linux/docs/900_FAQ/System-Version/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/900_FAQ/System-Version/</guid>
<description>查看系统版本 CentOS $ cat /etc/centos-release CentOS release 6.7 (Final) Ubuntu $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION=&#34;Ubuntu 20.04.1 LTS&#34; Common $ cat /proc/version Linux version 2.6.32-431.29.2.el6.x86_64 (root@xxx) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Sep 16 11:10:09 CST 2015 # 内核版本 $ uname -r 2.6.32-431.29.2.el6.x86_64 # 架构 $ uname -i x86_64 $ uname -a Linux localhost 2.6.32-431.29.2.el6.x86_64 #1 SMP Wed Sep 16 11:10:09 CST 2015 x86_64 x86_64 x86_64 GNU/Linux </description>
</item>
<item>
<title>/cpuinfo</title>
<link>https://hello-world-example.github.io/linux/docs/300_Configuration/proc/cpuinfo/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/300_Configuration/proc/cpuinfo/</guid>
<description>/proc/cpuinfo 查看逻辑 CPU 个数</description>
</item>
<item>
<title>ifcfg-eth0</title>
<link>https://hello-world-example.github.io/linux/docs/300_Configuration/etc/sysconfig/network-scripts/ifcfg-eth0/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://hello-world-example.github.io/linux/docs/300_Configuration/etc/sysconfig/network-scripts/ifcfg-eth0/</guid>
<description>网络接口配置文件 ifcfg-eth0 配置参数说明 TYPE:配置文件接口类型。在/etc/sysconfig/network-scripts/目录有多种网络配置文件,有Ethernet 、IPsec等类型,网络接口类型为Ethernet。 DEVICE:网络接口名称 BOOTPROTO:系统启动地址协议 none:不使用启动地址协议 bootp:BOOTP协议 dhcp:DHCP动态地址协议 static:静态地址协议 ONBOOT:系统启动时是否激活 yes:系统启动时激活该网络接口 no:系统启动时不激活该网络接口 IPADDR:IP地址 NETMASK:子网掩码 GATEWAY:网关地址 BROADCAST:广播地址 HWADDR/MACADDR:MAC地址。只需设置其中一个,同时设置时不能相互冲突。 PEERDNS:是否指定DNS。如果使用DHCP协议,默认为yes。 yes:如果DNS设置,修改/etc/resolv.conf中的DNS no:不修改/etc/resolv.conf中的DNS DNS{1, 2}:DNS地址。当PEERDNS为yes时会被写入/etc/resolv.conf中。 NM_CONTROLLED:是否由Network Manager控制该网络接口。修改保存后立即生效,无需重启。被其坑过几次,建议一般设为no。 yes:由Network Manager控制 no:不由Network Manager控制 USERCTL:用户权限控制 yes:非root用户允许控制该网络接口 no:非root用户不运行控制该网络接口 IPV6INIT:是否执行IPv6 yes:支持IPv6 no:不支持IPv6 IPV6ADDR:IPv6地址/前缀长度 静态IP 配置 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.31.6 GATEWAY=192.168.31.1 NETMASK=255.255.255.0 配置生效 service network restart Read More Linux网络接口配置文件ifcfg-eth0解析 </description>
</item>
</channel>
</rss>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。