国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

linux文本處理工具及正則表達式集錦

2019-10-26 18:52:21
字體:
來源:轉載
供稿:網友

cat命令:查看文本內容

         cat [選項]... [文件]...

         -E    顯示行結束符

         -n    顯示文本內容時顯示行號

         -A    顯示所以控制符

         -b    非空行編號

         -s     壓縮連續的空行成一行

[root@bogon ~]# cat -n /etc/issue > test.txt    ##查看文件內容并顯示行號,重定向到test.txt文件中[root@bogon ~]# cat test.txt   1 /S  2 Kernel /r on an /m  3 [root@bogon ~]# cat > file <<EOF    ##創建file文件,輸入內容以EOF結束> kernel /r on an /m> EOF[root@bogon ~]# cat file kernel /r on an /m

more       分頁顯示

         more [OPTIONS...] FILE...

less  分頁顯示,是man命令使用的分頁器

[root@bogon ~]# less /etc/httpd.conf
[root@bogon ~]# cat /etc/httpd.conf |more

head命令 :

         head [OPTION]... [FILE]...

    -n  顯示文件前n行,默認顯示前10行

    -c # 顯示文件前#個字節內容

    -q  不顯示包含給定文件名的文件頭

[root@bogon ~]# head -5 /etc/fstab     ##顯示文件前5行## /etc/fstab# Created by anaconda on Mon May 1 04:49:06 2017#[root@bogon ~]# head -q -n 5 /etc/fstab /etc/issue    ##顯示多個文件前5行,并且不顯示文件頭## /etc/fstab# Created by anaconda on Mon May 1 04:49:06 2017#/SKernel /r on an /m  

tail命令:

tail [OPTION]... [FILE]...

         -f   實時查看,常用監控日志文件

   -c #   顯示后#字節

   -n #  顯示后#行,默認顯示行10行

[root@bogon ~]# tail -2 /etc/passwd    ##顯示文件后2行sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologinapache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin[root@bogon ~]# tail -f /var/log/messages    ##不停地去讀最新的內容,有實時監視的效果,用Ctrl+c來終止May 2 02:46:26 localhost systemd: Configuration file /usr/lib/systemd/system/wpa_supplicant.service is marked executable. Please remove executable permission bits. Proceeding anyway. May 2 02:46:26 localhost yum[16325]: Installed: httpd-2.4.6-45.el7.centos.4.x86_64 May 2 03:01:01 localhost systemd: Started Session 10 of user root. May 2 03:01:01 localhost systemd: Starting Session 10 of user root. May 2 03:45:49 localhost systemd-logind: Removed session 4. May 2 03:46:20 localhost systemd: Started Session 11 of user root. May 2 03:46:20 localhost systemd-logind: New session 11 of user root. May 2 03:46:20 localhost systemd: Starting Session 11 of user root. May 2 04:01:01 localhost systemd: Started Session 12 of user root. May 2 04:01:01 localhost systemd: Starting Session 12 of user root.            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 隆回县| 涿鹿县| 安图县| 迭部县| 芜湖县| 尉氏县| 新密市| 贺州市| 门头沟区| 荆州市| 马边| 抚松县| 霍山县| 钟祥市| 遂昌县| 安新县| 阳西县| 星子县| 襄垣县| 开平市| 平阳县| 布尔津县| 普格县| 鄂伦春自治旗| 夹江县| 青浦区| 石首市| 花垣县| 密云县| 塘沽区| 六安市| 大同县| 正蓝旗| 嵩明县| 武城县| 永宁县| 桦川县| 得荣县| 腾冲县| 台南县| 五大连池市|