shell1

原创

程序员必知的LinuxShell命令

grep (Globle Regular Expression Print全局正则表达式)

命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来
    -c:只输出匹配行的计数。
    -I:不区分大 小写(只适用于单字符)。
    -h:查询多文件时不显示文件名。
    -l:查询多文件时只输出包含匹配字符的文件名。
    -n:显示匹配行及 行号。
    -s:不显示不存在或无匹配文本的错误信息。
    -v:显示不包含匹配文本的所有行。

    pattern正则表达式主要参数:
    \: 忽略正则表达式中特殊字符的原有含义。
    ^:匹配正则表达式的开始行。
    $: 匹配正则表达式的结束行。
    \<:从匹配正则表达 式的行开始。
    \>:到匹配正则表达式的行结束。
    [ ]:单个字符,如[A]即A符合要求 。
    [ - ]:范围,如[A-Z],即A、B、C一直到Z都符合要求 。
    。:所有的单个字符。
    * :有字符,长度可以为0。

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

* ps (process)

ps工具标识进程的5种状态码:
    D 不可中断 uninterruptible sleep (usually IO)
    R 运行 runnable (on run queue)
    S 中断 sleeping
    T 停止 traced or stopped
    Z 僵死 a defunct (”zombie”) process 
options
    (常用)
    -A 或 -e 列出所有的行程
    -w 显示加宽可以显示较多的资讯
    -au 显示较详细的资讯
    -aux 显示所有包含其他使用者的行程 
    (其他)
    1)ps a 显示现行终端机下的所有程序,包括其他用户的程序。
    2)ps -A 显示所有程序。
    3)ps c 列出程序时,显示每个程序真正的指令名称,而不包含路径,参数或常驻服务的标示。
    4)ps -e 此参数的效果和指定”A”参数相同。
    5)ps e 列出程序时,显示每个程序所使用的环境变量。
    6)ps f 用ASCII字符显示树状结构,表达程序间的相互关系。
    7)ps -H 显示树状结构,表示程序间的相互关系。
    8)ps -N 显示所有的程序,除了执行ps指令终端机下的程序之外。
    9)ps s 采用程序信号的格式显示程序状况。
    10)ps S 列出程序时,包括已中断的子程序资料。
    11)ps -t<终端机编号>
    指定终端机编号,并列出属于该终端机的程序的状况。
    12)ps u
    以用户为主的格式来显示程序状况。
    13)ps x
    显示所有程序,不以终端机来区分。

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

* crontab

crontab文件的含义:
1. 用户所建立的crontab文件中,每一行都代表一项任务,每行的每个字段代表一项设置,它的格式共分为六个字段,前五段是时间设定段,第六段是要执行的命令段,格式如下:
minute hour day month week command
其中:command:要执行的命令,可以是系统命令,也可以是自己编写的脚本文件。
2.option
-u user:用来设定某个用户的crontab服务,例如,“-u ixdba”表示设定ixdba用户的crontab服务,此参数一般有root用户来运行。
file:file是命令文件的名字,表示将file做为crontab的任务列表文件并载入crontab。如果在命令行中没有指定这个文件,crontab命令将接受标准输入(键盘)上键入的命令,并将它们载入crontab。
-e:编辑某个用户的crontab文件内容。如果不指定用户,则表示编辑当前用户的crontab文件。
-l:显示某个用户的crontab文件内容,如果不指定用户,则表示显示当前用户的crontab文件内容。
-r:从/var/spool/cron目录中删除某个用户的crontab文件,如果不指定用户,则默认删除当前用户的crontab文件。
-i:在删除用户的crontab文件时给确认提示。

* nohub不挂断地运行命令

要运行后台中的 nohup 命令,添加 & ( 表示“and”的符号)到命令的尾部。

 
 
  • 1

* uid: linux用户的user id pid: 进程的id号 ppid:进程的父进程的id号

文章最后发布于: 2016-01-12 09:04:40
        <!--打赏开始-->
                <div class="reward-user-box" style="margin-top: -12px;">
            <span class="reward-word" style="color:#B4B4B4 !important">有 <span class="num">0</span> 个人打赏</span>
                        </div>
            <!--打赏结束-->
    <div class="recommend-box"><div class="recommend-item-box type_blog clearfix" data-report-view="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/zhydream77/article/details/80079319&quot;,&quot;strategy&quot;:&quot;BlogCommendFromMachineLearnPai2&quot;,&quot;index&quot;:&quot;0&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/zhydream77/article/details/80079319&quot;,&quot;strategy&quot;:&quot;BlogCommendFromMachineLearnPai2&quot;,&quot;index&quot;:&quot;0&quot;}">
<div class="content" style="width: 712px;">
	<a href="https://blog.csdn.net/zhydream77/article/details/80079319" target="_blank" rel="noopener" title="什么是Linux Shell?">
	<h4 class="text-truncate oneline" style="width: 552px;">
			什么是Linux Shell?		</h4>
	<div class="info-box d-flex align-content-center">
		<p class="date-and-readNum oneline">
			<span class="date hover-show">04-25</span>
			<span class="read-num hover-hide">
				阅读数 
				1629</span>
			</p>
		</div>
	</a>
	<p class="content" style="width: 712px;">
		<a href="https://blog.csdn.net/zhydream77/article/details/80079319" target="_blank" rel="noopener" title="什么是Linux Shell?">
			<span class="desc oneline">什么是LinuxShell?概念:Shell是系统的用户界面,提供了用户与内核进行交互操作的一种接口。它接收用户输入的命令并把它送入内核去执行。是在Linux内核与用户之间的解释器程序,现在Linux...</span>
		</a>
		<span class="blog_title_box oneline ">
								<span class="type-show type-show-blog type-show-after">博文</span>
										<a target="_blank" rel="noopener" href="https://blog.csdn.net/zhydream77">来自:	<span class="blog_title"> 朱海燕的博客日记</span></a>
											</span>
	</p>
</div>
</div>
还能输入1000个字符
<div class="comment-list-container">
	<a id="comments"></a>
	<div class="comment-list-box">
	</div>
	<div id="commentPage" class="pagination-box d-none"></div>
	<div class="opt-box text-center">
		<div class="btn btn-sm btn-link-blue" id="btnMoreComment"></div>
	</div>
</div>
几个不错的Shell脚本

03-05 阅读数 5442

几个Shell脚本的例子 博文 来自: 杰瑞的专栏

Linux 中执行Shell 脚本的方式(三种方法)

07-30 阅读数 9万+

Linux中Shell脚本的执行(三种方法) 博文 来自: timchen525的专栏

程序员会linux基础识下载
09-01

linux常用命令,如基础命令,用户管理,进程管理,软件包管理,shell编程,等等 相关下载链接://download.csdn.net/download/hanqunfeng/6854411?ut 论坛

1.2 linux使用技巧快速入门 - 王小雷-多面手 - CSDN博客

5-16

sh/bash/csh/Tcsh/ksh/pdksh等shell本质区别 - 王小雷-多面手 - ...

8-28

		<div class="recommend-item-box blog-expert-recommend-box" style="display: block;">
		<div class="d-flex">
			<div class="blog-expert-recommend">
				<div class="blog-expert">
					<div class="blog-expert-flexbox" data-report-view="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/zhydream77" target="_blank"><img src="https://avatar.csdn.net/C/6/8/3_zhydream77.jpg" username="zhydream77" alt="zhy-dream" title="zhy-dream"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="zhydream77" data-nick="zhy-dream">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/zhydream77" target="_blank"><h5 class="oneline" title="zhy-dream">zhy-dream</h5></a></span>  <p></p><p class="article-num" title="245篇文章"> 245篇文章</p><p class="article-num" title="排名:千里之外"> 排名:千里之外</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/Jerry_1126" target="_blank"><img src="https://avatar.csdn.net/A/2/0/3_jerry_1126.jpg" username="Jerry_1126" alt="杰瑞26" title="杰瑞26"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="Jerry_1126" data-nick="杰瑞26">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/Jerry_1126" target="_blank"><h5 class="oneline" title="杰瑞26">杰瑞26</h5></a></span>  <p></p><p class="article-num" title="622篇文章"> 622篇文章</p><p class="article-num" title="排名:709"> 排名:709</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/ai2000ai" target="_blank"><img src="https://avatar.csdn.net/6/D/B/3_ai2000ai.jpg" username="ai2000ai" alt="幽雨雨幽" title="幽雨雨幽"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="ai2000ai" data-nick="幽雨雨幽">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/ai2000ai" target="_blank"><h5 class="oneline" title="幽雨雨幽">幽雨雨幽</h5></a></span>  <p></p><p class="article-num" title="685篇文章"> 685篇文章</p><p class="article-num" title="排名:4000+"> 排名:4000+</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/yifan850399167" target="_blank"><img src="https://avatar.csdn.net/7/5/2/3_yifan850399167.jpg" username="yifan850399167" alt="sun_true" title="sun_true"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="yifan850399167" data-nick="sun_true">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/50501604&quot;}"><a href="https://blog.csdn.net/yifan850399167" target="_blank"><h5 class="oneline" title="sun_true">sun_true</h5></a></span>  <p></p><p class="article-num" title="77篇文章"> 77篇文章</p><p class="article-num" title="排名:千里之外"> 排名:千里之外</p><p></p></div></div></div></div>
				</div>
			</div>
		</div>
	</div><div class="recommend-item-box baiduSearch recommend-box-ident" data-report-view="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_41157969/article/details/84392005&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;6&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_41157969/article/details/84392005&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;6&quot;}" data-track-view="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_41157969/article/details/84392005&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:2,&quot;extend1&quot;:&quot;_&quot;}" data-track-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_41157969/article/details/84392005&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:2,&quot;extend1&quot;:&quot;_&quot;}" data-flg="true">                <a href="https://blog.csdn.net/weixin_41157969/article/details/84392005" target="_blank">              		<h4 class="text-truncate oneline" style="width: 633px;">用Shell<em>命令</em>看看你是一个什么样的<em>程序员</em> - weixin_4115..._CSDN博客</h4>                  <div class="info-box d-flex align-content-center">                    <p>                      <span class="date">1-28</span>                    </p>                  </div>                </a>            	</div><div class="recommend-item-box baiduSearch recommend-box-ident" data-report-view="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/51935530&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;9&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/51935530&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;9&quot;}" data-track-view="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/51935530&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:3,&quot;extend1&quot;:&quot;_&quot;}" data-track-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/dream_an/article/details/51935530&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:3,&quot;extend1&quot;:&quot;_&quot;}" data-flg="true">                <a href="https://blog.csdn.net/dream_an/article/details/51935530" target="_blank">              		<h4 class="text-truncate oneline" style="width: 626px;">spark编程python实例 - 王小雷-多面手 - CSDN博客</h4>                  <div class="info-box d-flex align-content-center">                    <p>                      <span class="date">10-17</span>                    </p>                  </div>                </a>            	</div>
<div class="recommend-item-box recommend-box-ident recommend-download-box clearfix" data-report-view="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_27289001/9915003&quot;,&quot;strategy&quot;:&quot;BlogCommendFromBaidu&quot;,&quot;index&quot;:&quot;13&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_27289001/9915003&quot;,&quot;strategy&quot;:&quot;BlogCommendFromBaidu&quot;,&quot;index&quot;:&quot;13&quot;}">
	<a href="https://download.csdn.net/download/qq_27289001/9915003" rel="noopener" target="_blank">
		<div class="content clearfix">
			<div class="">
				<h4 class="text-truncate oneline clearfix">
					<em>程序员</em>开发的一些shell脚本					</h4>
				<span class="data float-right">07-29</span>
			</div>
			<div class="desc oneline">
					shell脚本				</div>
			<span class="type-show type-show-download">下载</span>
		</div>
	</a>
</div>
            <div class="recommend-item-box type_hot_word">
                            <div class="content clearfix" style="width: 712px;">
                <div class="float-left">
                                    <span>
                    <a href="https://www.csdn.net/gather_13/MtTaEgysMS1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c#部门请假管理系统</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_13/MtTaEgysMi1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c#服务器socket</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_12/MtTaEgysMy1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c# 默认的访问修饰符</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_1c/MtTaEgysNC1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c#拖动文件</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_1c/MtTaEgysNS1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c# 截取指定窗口屏幕</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_1f/MtTaEgysNi1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c# html对象传后台</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_16/MtTaEgysNy1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c# 判断域名还是ip</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_23/MtTaEgysOC1ibG9n.html" target="_blank">
                    c#遮罩层</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_16/MtTaEgysOS1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c# 取字符串中的数字</a>
                </span>
                                    <span>
                    <a href="https://www.csdn.net/gather_14/MtTaEgzsMC1kb3dubG9hZAO0O0OO0O0O.html" target="_blank">
                    c# 网站高并发测试</a>
                </span>
                                    </div>
            </div>
                            </div>
                        <div class="recommend-loading-box">
            <img src="https://csdnimg.cn/release/phoenix/images/feedLoading.gif">
        </div>
        <div class="recommend-end-box">
            <p class="text-center">没有更多推荐了,<a href="https://blog.csdn.net/" class="c-blue c-blue-hover c-blue-focus">返回首页</a></p>
        </div>
    </div>
                <div class="template-box">
            <span>©️2019 CSDN</span><span class="point"></span>
        <span>皮肤主题: 大白</span>
        <span> 设计师:
                                CSDN官方博客                            </span>
        </div>
        </main>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值