<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LCTT &#8211; bhzhuOS爱好者(原StartOS爱好者)</title>
	<atom:link href="https://www.bhzhu203.com/tag/lctt/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bhzhu203.com</link>
	<description>QQ群号125732839</description>
	<lastBuildDate>Thu, 28 Apr 2016 07:53:00 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.7</generator>
	<item>
		<title>Linux有问必答：Linux上如何查看某个进程的线程</title>
		<link>https://www.bhzhu203.com/2016/04/28/linux%e6%9c%89%e9%97%ae%e5%bf%85%e7%ad%94%ef%bc%9alinux%e4%b8%8a%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e6%9f%90%e4%b8%aa%e8%bf%9b%e7%a8%8b%e7%9a%84%e7%ba%bf%e7%a8%8b/</link>
		
		<dc:creator><![CDATA[bhzhu203]]></dc:creator>
		<pubDate>Thu, 28 Apr 2016 07:53:00 +0000</pubDate>
				<category><![CDATA[linux知识]]></category>
		<category><![CDATA[LCTT]]></category>
		<guid isPermaLink="false">http://www.bhzhu203.com/?p=202</guid>

					<description><![CDATA[原文：http://ask.xmodulo.com/view-threads-p [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>原文：http://ask.xmodulo.com/view-threads-process-linux.html 作者： Dan Nanni<br />
译文：LCTT <a href="https://linux.cn/article-5633-1.html" target="_blank">https://linux.cn/article-5633-1.html</a> 译者： GOLinux</p>
<p>问题： 我的程序在其内部创建并执行了多个线程，我怎样才能在该程序创建线程后监控其中单个线程？我想要看到带有它们名称的单个线程详细情况（如，CPU/内存使用率）。</p>
<p>线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时，这些线程就会在它们之间共享特定的 资源（如，内存地址空间、打开的文件），以使叉分开销最小化，并避免大量高成本的IPC（进程间通信）通道。这些功能让线程在并发执行时成为一个高效的机 制。</p>
<p>在Linux中，程序中创建的线程（也称为轻量级进程，LWP）会具有和程序的PID相同的“线程组ID”。然后，各个线程会获得其自身的线程 ID（TID）。对于Linux内核调度器而言，线程不过是恰好共享特定资源的标准的进程而已。经典的命令行工具，如ps或top，都可以用来显示线程级 别的信息，只是默认情况下它们显示进程级别的信息。</p>
<p>这里提供了在Linux上显示某个进程的线程的几种方式。<br />
方法一：PS</p>
<p>在ps命令中，“-T”选项可以开启线程查看。下面的命令列出了由进程号为&lt;pid&gt;的进程创建的所有线程。</p>
<p>$ ps -T -p &lt;pid&gt;</p>
<p>“SID”栏表示线程ID，而“CMD”栏则显示了线程名称。<br />
方法二： Top</p>
<p>top命令可以实时显示各个线程情况。要在top输出中开启线程查看，请调用top命令的“-H”选项，该选项会列出所有Linux线程。在top运行时，你也可以通过按“H”键将线程查看模式切换为开或关。</p>
<p>$ top -H</p>
<p>要让top输出某个特定进程&lt;pid&gt;并检查该进程内运行的线程状况：</p>
<p>$ top -H -p &lt;pid&gt;</p>
<p>方法三： Htop</p>
<p>一个对用户更加友好的方式是，通过htop查看单个进程的线程，它是一个基于ncurses的交互进程查看器。该程序允许你在树状视图中监控单个独立线程。</p>
<p>要在htop中启用线程查看，请开启htop，然后按&lt;F2&gt;来进入htop的设置菜单。选择“设置”栏下面的“显示选项”，然后开启“树状视图”和“显示自定义线程名”选项。按&lt;F10&gt;退出设置。</p>
<p>现在，你就会看到下面这样单个进程的线程视图。</p>
<p>via: <a href="http://ask.xmodulo.com/view-threads-process-linux.html" target="_blank">http://ask.xmodulo.com/view-threads-process-linux.html</a></p>
<p>作者：Dan Nanni 译者：GOLinux 校对：wxy</p>
<p>本文由 LCTT 原创翻译，Linux中国 荣誉推出<br />
来源：https://linux.cn/article-5633-1.html</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>如何设置 Linux 上 SSH 登录的 Email 提醒</title>
		<link>https://www.bhzhu203.com/2016/04/28/%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae-linux-%e4%b8%8a-ssh-%e7%99%bb%e5%bd%95%e7%9a%84-email-%e6%8f%90%e9%86%92/</link>
		
		<dc:creator><![CDATA[bhzhu203]]></dc:creator>
		<pubDate>Thu, 28 Apr 2016 07:44:58 +0000</pubDate>
				<category><![CDATA[linux知识]]></category>
		<category><![CDATA[LCTT]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[SSH]]></category>
		<guid isPermaLink="false">http://www.bhzhu203.com/?p=186</guid>

					<description><![CDATA[2015-4-26 11:01&#124; 查看: 635&#124; 评论: 1&#124; 收藏: 6&#124;  [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>2015-4-26 11:01| 查看: 635| 评论: 1| 收藏: 6| 分享: 0</p>
<p>原文：http://www.ehowstuff.com/how-to-get-email-alerts-for-ssh-login-on-linux-server/ 作者： skytech<br />
译文：LCTT <a href="http://linux.cn/article-5334-1.html" target="_blank">http://linux.cn/article-5334-1.html</a> 译者： theo-l</p>
<p>虚拟私有服务器 （VPS）上启用 SSH 服务使得该服务器暴露到互联网中，为黑客攻击提供了机会，尤其是当 VPS 还允许root 直接访问时。VPS 应该为每次 SSH 登录成功尝试配置一个自动的 email 警告。 VPS 服务器的所有者会得到各种 SSH 服务器访问日志的通知，例如登录者、登录时间以及来源 IP 地址等信息。这是一个对于服务器拥有者来说，保护服务器避免未知登录尝试的重要安全关注点。这是因为如果黑客使用暴力破解方式通过 SSH 来登录到你的 VPS 的话，后果很严重。在本文中，我会解释如何在 CentOS 6、 CentOS 7、 RHEL 6 和 RHEL 7上为所有的 SSH 用户登录设置一个 email 警告。</p>
<p>使用root用户登录到你的服务器；</p>
<p>在全局源定义处配置警告（/etc/bashrc），这样就会对 root 用户以及普通用户都生效：</p>
<p>[root@vps ~]# vi /etc/bashrc</p>
<p>将下面的内容加入到上述文件的尾部。</p>
<p>echo &#8216;ALERT &#8211; Root Shell Access (vps.ehowstuff.com) on:&#8217; `date` `who` | mail -s &#8220;Alert: Root Access from `who | cut -d'(&#8216; -f2 | cut -d&#8217;)&#8217; -f1`&#8221; recipient@gmail.com</p>
<p>你也可以选择性地让警告只对 root 用户生效：</p>
<p>[root@vps ~]# vi .bashrc</p>
<p>将下面的内容添加到/root/.bashrc的尾部：</p>
<p>echo &#8216;ALERT &#8211; Root Shell Access (vps.ehowstuff.com) on:&#8217; `date` `who` | mail -s &#8220;Alert: Root Access from `who | cut -d'(&#8216; -f2 | cut -d&#8217;)&#8217; -f1`&#8221; recipient@gmail.com</p>
<p>整个配置文件样例：</p>
<p># .bashrc<br />
# User specific aliases and functions<br />
alias rm=&#8217;rm -i&#8217;<br />
alias cp=&#8217;cp -i&#8217;<br />
alias mv=&#8217;mv -i&#8217;<br />
# Source global definitions<br />
if [ -f /etc/bashrc ]; then<br />
. /etc/bashrc<br />
fi<br />
echo &#8216;ALERT &#8211; Root Shell Access (vps.ehowstuff.com) on:&#8217; `date` `who` | mail -s &#8220;Alert: Root Access from `who | cut -d'(&#8216; -f2 | cut -d&#8217;)&#8217; -f1`&#8221; recipient@gmail.com</p>
<p>你也可以选择性地让警告只对特定的普通用户生效（例如 skytech）：</p>
<p>[root@vps ~]# vi /home/skytech/.bashrc</p>
<p>将下面的内容加入到/home/skytech/.bashrc文件尾部：</p>
<p>echo &#8216;ALERT &#8211; Root Shell Access (vps.ehowstuff.com) on:&#8217; `date` `who` | mail -s &#8220;Alert: Root Access from `who | cut -d'(&#8216; -f2 | cut -d&#8217;)&#8217; -f1`&#8221; recipient@gmail.com</p>
<p>via: <a href="http://www.ehowstuff.com/how-to-get-email-alerts-for-ssh-login-on-linux-server/" target="_blank">http://www.ehowstuff.com/how-to-get-email-alerts-for-ssh-login-on-linux-server/</a></p>
<p>作者：skytech 译者：theo-l 校对：wxy</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
