日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

第二关练习题总结完结

發(fā)布時間:2025/3/20 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 第二关练习题总结完结 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

第1章 裝完系統(tǒng)后,希望讓網(wǎng)絡(luò)文件共享服務(wù)NFS(iptables),僅在3級別上開機自啟動,該如何做?解答:什么是開機自啟動,殺毒軟件大家都知道吧,例如:360等每次開機都會自動起來對吧,我們就需要360這樣,在Linux下軟件服務(wù)跟隨系統(tǒng)啟動而啟動的配置。

chkconfig iptables on/off

?

?

/etc/rc.local

/etc/init.d/iptables staet

?

chkconfig 管理開機自啟動

?

level 指定運行級別的意思

--list 顯示一個列表

1.1 僅在3級別上開機自啟動:

[root@oldboyedu-40-nb ~]# chkconfig |grep ipt

iptables?????? 0:off????? 1:off????? 2:off????? 3:off????? 4:off????? 5:off????? 6:off

[root@oldboyedu-40-nb ~]# chkconfig --level 3 iptables on

[root@oldboyedu-40-nb ~]# chkconfig |grep ipt

iptables?????? 0:off????? 1:off????? 2:off????? 3:on?????? 4:off????? 5:off????? 6:off

[root@oldboyedu-40-nb ~]# chkconfig --level 2345 iptables on

[root@oldboyedu-40-nb ~]# chkconfig |grep ipt

iptables?????? 0:off????? 1:off????? 2:on?????? 3:on?????? 4:on?????? 5:on?????? 6:off

?

[root@oldboyedu-40-nb ~]# chkconfig iptables off

[root@oldboyedu-40-nb ~]# chkconfig |grep ipt

iptables?????? 0:off????? 1:off????? 2:off????? 3:off????? 4:off????? 5:off????? 6:off

?

?

[root@oldboyedu-40-nb ~]# chkconfig --list iptables

iptables?????? 0:off????? 1:off????? 2:off????? 3:off????? 4:off????? 5:off????? 6:off

[root@oldboyedu-40-nb ~]# chkconfig --list iptable

error reading information on service iptable: No such file or directory

0:off??? 1:off??? 2:off??? 3:off??? 4:of5:off??? 6:off 這個0到6就是運行級別

平時都是用? 3是工作中默認的運行級別 完全的多用戶模式? 命令行模式 命令模式

1.2 如何徹底關(guān)閉iptables?

1./etc/init.d/iptables stop 臨時 關(guān)閉正在運行的防火墻

2.chkconfig iptables off? 永久 讓iptables不會在開機的時候自啟動

3.檢查

chkconfig |grep ipt

/etc/init.d/iptables status

第2章 /etc/目錄為linux系統(tǒng)的默認的配置文件及服務(wù)啟動命令的目錄

請用tar打包/etc整個目錄(打包及壓縮)

請用tar打包/etc整個目錄(打包及壓縮,但需要排除/etc/services文件)

請把a點命令的壓縮包,解壓到/tmp指定目錄下(最好只用tar命令實現(xiàn))

解答:

windows壓縮-----linux 打包(蘋果放入到筐中) 壓縮(節(jié)約空間 地方)

打包:

注意打包的內(nèi)容和包的先后順序。

  • 創(chuàng)建壓縮包
  • tar zcvf? [路徑 位置]/筐 ?[相對路徑 位置]一堆蘋果

    打包 壓縮===>兩個步驟

    打包(tar命令默認是打包)

    壓縮====>z====>gzip====>etc。tar.gz

    linux 打包(把這個文件放在筐里)及壓縮(把這個筐擠碎了)

    tar? zcvf? (壓縮包的名字)? 蘋果? 目錄蘋果? 蘋果 .....?? 你要壓縮的東西

    tar zcvf /tmp/etc.tar.gz? /etc/

    z------壓縮工具--gzip 通過gzip軟件進行壓縮?? 在壓縮包的尾巴加上.tar.gz

    最長一種壓縮之后我們一般給壓縮包命名為xxxx.tar.gz

    c------創(chuàng)建??? create

    v------顯示創(chuàng)建/解壓過程

    平時一般不會加v 都是zcf

    f------指定壓縮包的位置和名字

    t-------list---顯示列表

    x--------extract解壓

    簡單來說壓縮:

    tar 壓zcf 后面跟壓縮位置 要壓縮的文件位置

    例子:

    [root@- ~]# tar zcf /tmp/etc.tar.gz /etc/

    [root@- ~]# tar zcvf /oldgirl/etc.tar.gz /etc/

    查看壓縮包里的內(nèi)容:

    tf就可以

    [root@- ~]# tar ztf /tmp/etc.tar.gz

    解壓:

    默認解壓到當前目錄,需要先進入一個目錄,當然也可以自己指

    tar 解zwvf 原文件所在地址? -C 后面跟上要解壓的目錄

    例子:

    解壓自定義目錄:tar zxvf /tmp/etc.tar.gz -C /oldg

    1.1 a.請用tar打包/etc整個目錄

    [root@oldboyedu-40-nb ~]# ls -l /tmp/

    total 9512

    -rw-r--r-- 1 root root 9738690 May 20 02:43 etc.tar.gz

    [root@oldboyedu-40-nb ~]# tar zcf /tmp/etc.tar.gz? /etc/

    tar: Removing leading `/' from member names

    tar: Removing leading `/' from hard link targets

    1.2 請用tar打包/etc整個目錄(打包及壓縮,但需要排除/etc/services文件)

    [root@oldboyedu-40-nb /]#? tar zcf /tmp/etc-paichu.tar.gz? /etc/? --exclude=etc/services

    tar: Removing leading `/' from member names

    tar: Removing leading `/' from hard link targets

    [root@oldboyedu-40-nb /]# tar tf /tmp/etc-paichu.tar.gz |grep "services"

    etc/init/readahead-disable-services.conf

    [root@oldboyedu-40-nb /]# tar tf /tmp/etc.tar.gz |grep "services"

    etc/init/readahead-disable-services.conf

    etc/services

    1.3 請把a點命令的壓縮包,解壓到/tmp指定目錄下(最好只用tar命令實現(xiàn))

    [root@oldboyedu-40-nb tmp]# ls -l

    total 9640

    -rw-r--r-- 1 root root 9738690 May 20 03:10 etc.tar.gz

    -rw-r--r-- 1 root root? 127314 May 20 03:34 ser.tar.gz

    [root@oldboyedu-40-nb tmp]# cd /tmp/

    [root@oldboyedu-40-nb tmp]# tar xf /tmp/ser.tar.gz

    [root@oldboyedu-40-nb tmp]# ls

    etc? etc.tar.gz? ser.tar.gz

    [root@oldboyedu-40-nb tmp]# tree

    .

    ├── etc

    │?? └── services

    ├── etc.tar.gz

    └── ser.tar.gz

    ?

    1 directory, 3 files

    1.4 附加 :把 /tmp/etc.tar.gz 解壓到 /mnt

    [root@oldboyedu-40-nb tmp]# ls -l /mnt/

    total 0

    -rw-r--r--. 1 root root 0 Aug 17? 2017 test.txt

    [root@oldboyedu-40-nb tmp]# tar xf /tmp/etc.tar.gz -C /mnt/

    1.5 擴展:創(chuàng)建一個壓縮包的時候 提示

    ?

    Removing leading `/' from member names

    ?

    [root@oldboyedu-40-nb tmp]#

    [root@oldboyedu-40-nb tmp]# tar zcf /tmp/ser.tar.gz? /etc/services

    tar: Removing leading `/' from member names

    tar: 刪除???? 開頭的? /斜線? 從 蘋果中(文件名字中)

    1.5.1 現(xiàn)象:

    ???? 把你壓縮包中的文件最前面的斜線刪除? 根? /etc/services? =======> etc/services???? 絕對路徑??????? >>>>>?? 相對路徑

    1.5.2 原因

    創(chuàng)建壓縮包 絕對路徑

    ???? /etc/services

    壓縮包里面的內(nèi)容

    ???? etc/services

    ?

    解壓的時候 按照壓縮包里面位置 進行解壓的

    ??? 根下面 etc 下面的services??? 會把/etc/services 文件覆蓋? ===危險

    ???

    ?

    1.5.3 解決方法:

    ?? 如果你創(chuàng)建了一個壓縮包 壓縮包里面的內(nèi)容(蘋果) 你使用的是絕對路徑

    ?? 處于安全考慮? 把絕對路徑---去掉最前面的/----->相對路徑

    ??

    tar命令為了安全 把你使用的絕對路徑 變化為了 相對路徑???

    ??

    [root@oldboyedu-40-nb tmp]# tar zcf /tmp/ser.tar.gz? /etc/services

    tar: Removing leading `/' from member names

    [root@oldboyedu-40-nb tmp]# tar tf /tmp/ser.tar.gz

    etc/services

    ?

    ?

    打包壓縮 用相對路徑

    [root@oldboyedu-40-nb tmp]# cd /

    [root@oldboyedu-40-nb /]# tar zcf /tmp/ser.tar.gz? etc/services

    ?

    ?

    cd / &&? tar zcf /tmp/ser.tar.gz? etc/services?

    ???

    ???

    1.6 附加·把/etc目錄打包壓縮到 /tmp/

    ?

    cd / &&? tar zcf /tmp/etc2.tar.gz? etc

    ?

    第2章 已知如下命令及結(jié)果:

    mkdir /oldboy ; echo "I am oldboy,myqq is 31333741">/oldboy/oldboy.txt

    ?

    [root@oldboyedu-40-nb oldboy]# cat oldboy.txt

    I am oldboy,myqq is 31333741

    2.1 現(xiàn)在要從文件中過濾出“oldboy”和“31333741”字符串,請給出命令

    2.1.1 方法1-sed + sed

    [root@oldboyedu-40-nb oldboy]# sed 's#I am ##g' oldboy.txt

    oldboy,myqq is 31333741

    [root@oldboyedu-40-nb oldboy]# sed 's#I am ##g' oldboy.txt |sed 's#,myqq is##g'

    oldboy 31333741

    ?

    2.1.2 方法2-sed+awk

    [root@oldboyedu-40-nb oldboy]# cat oldboy.txt

    I am oldboy,myqq is 31333741

    [root@oldboyedu-40-nb oldboy]# awk '{print $1}' oldboy.txt

    I

    [root@oldboyedu-40-nb oldboy]# awk '{print $2}' oldboy.txt

    am

    [root@oldboyedu-40-nb oldboy]# awk '{print $1,$2}' oldboy.txt

    I am

    [root@oldboyedu-40-nb oldboy]# awk '{print $3}' oldboy.txt

    oldboy,myqq

    [root@oldboyedu-40-nb oldboy]#

    ?

    ?

    [root@oldboyedu-40-nb oldboy]# sed 's#,# #g' oldboy.txt

    I am oldboy myqq is 31333741

    [root@oldboyedu-40-nb oldboy]# sed 's#,# #g' oldboy.txt |awk '{print $3,$6}'

    oldboy 31333741

    [root@oldboyedu-40-nb oldboy]# sed 's#,# #g' oldboy.txt |awk '{print $3,$NF}'

    oldboy 31333741

    ?

    ?

    2.1.3 方法3-awk

    菜刀====分隔符(表示每一列的結(jié)束)

    ?

    ####第一里程碑-指定一個新的菜刀

    [root@oldboyedu-40-nb oldboy]# cat oldboy.txt

    I am oldboy,myqq is 31333741

    [root@oldboyedu-40-nb oldboy]# awk '{print $2}' oldboy.txt

    am

    [root@oldboyedu-40-nb oldboy]# awk -F "," '{print $1}' oldboy.txt

    I am oldboy

    [root@oldboyedu-40-nb oldboy]# awk -F "," '{print $1,$2}' oldboy.txt

    I am oldboy myqq is 31333741

    ?

    ####第二個里程碑-指定多把菜刀

    [root@oldboyedu-40-nb oldboy]# cat oldboy.txt

    I am oldboy,myqq is 31333741

    [root@oldboyedu-40-nb oldboy]# awk -F "[, ]" '{print $3,$NF}' oldboy.txt

    oldboy 31333741

    ?

    2.1.4 方法4-sed+cut

    [root@oldboyedu-40-nb oldboy]# cut -d " " -f1 oldboy.txt

    I

    [root@oldboyedu-40-nb oldboy]# cut -d " " -f2 oldboy.txt

    am

    [root@oldboyedu-40-nb oldboy]# cut -d " " -f3 oldboy.txt

    oldboy,myqq

    [root@oldboyedu-40-nb oldboy]# sed 's#,# #g' oldboy.txt

    I am oldboy myqq is 31333741

    [root@oldboyedu-40-nb oldboy]# sed 's#,# #g' oldboy.txt |cut -d " " -f3,6

    oldboy 31333741

    第二種awk中 想取一個幾百列文件 中間的怎么取

    1.確定好目標

    2.看看選擇什么菜刀

    2.2 如果需要從文件中過濾出“oldboy,31333714”字符串,請在給出命令??

    [root@oldboyedu-40-nb oldboy]# awk -F "[ ,]"???????????? '{print $3,$NF}' oldboy.txt

    oldboy 31333741

    [root@oldboyedu-40-nb oldboy]# awk -F "[ ,]"???????????? '{print $3","$NF}' oldboy.txt

    oldboy,31333741

    第3章 如何查看/etc/services文件的有多少行?

    [root@oldboy40 ~]# wc -l /etc/services

    10774 /etc/services

    1.1 屌絲去洗浴中心之路

    1.路通不通

    ping

    2.是否有人打劫

    iptable selinux

    3.查看是否有人提供服務(wù)

    telnet 10.0.0.200 22?? ##查看22端口是否開啟(提供服務(wù))

    22端口 對應(yīng)的 sshd服務(wù)(遠程連接)

    ?

    1.2 如何查看sshd 進程是否在運行?

    ?ps -ef |grep "sshd"

    ?#ps? process

    ?#ps -ef 顯示出系統(tǒng)中正在運行的進程

    ?

    [root@oldboyedu-40-nb oldboy]# ps -ef |grep "sshd"

    root?????? 1522????? 1? 0 Aug28 ???????? 00:00:00 /usr/sbin/sshd

    root?????? 3594?? 1522? 0 Aug28 ???????? 00:00:01 sshd: root@pts/1

    root?????? 3596?? 1522? 0 Aug28 ???????? 00:00:00 sshd: root@pts/2

    root?????? 3955?? 1522? 0 02:06 ???????? 00:00:00 sshd: root@pts/0

    root?????? 3974?? 3598? 0 02:06 pts/1??? 00:00:00 grep sshd

    ?

    [root@oldboyedu-40-nb oldboy]# ps -ef |grep "/sshd"

    root?????? 1522????? 1? 0 Aug28 ???????? 00:00:00 /usr/sbin/sshd

    root?????? 3976?? 3598? 0 02:07 pts/1??? 00:00:00 grep /sshd

    ?

    [root@oldboyedu-40-nb oldboy]# ps -ef |grep "/sshd"|wc -l

    2

    第2章 過濾出/etc/services 文件包含3306或1521兩數(shù)字所在的行的內(nèi)容。

    [root@oldboyedu-40-nb oldboy]# egrep "3306|1521" /etc/services

    mysql?????????? 3306/tcp????????????????? ??????# MySQL

    mysql?????????? 3306/udp??????????????????????? # MySQL

    ncube-lm??????? 1521/tcp??????????????? # nCube License Manager

    ncube-lm??????? 1521/udp??????????????? # nCube License Manager

    [root@oldboyedu-40-nb oldboy]# #egrep ===== grep -E

    ?

    第3章 命令行及shell中加單引號和加雙引號的區(qū)別

    ?

    3.1 單引號: 所見即所得 吃啥吐啥 單引號里面的內(nèi)容會原封不動的顯示出來

    ?

    [root@oldboyedu-40-nb oldboy]# echo '$LANG $(hostname)'

    $LANG $(hostname)

    3.2 雙引號: 雙引號會解析(運行)里面的特殊的符號? $LANG $(hostname)

    [root@oldboyedu-40-nb oldboy]# echo "$LANG $(hostname)?? "

    en_US.UTF-8 oldboyedu-40-nb

    ?

    轉(zhuǎn)載于:https://www.cnblogs.com/Arlen723/p/7846018.html

    總結(jié)

    以上是生活随笔為你收集整理的第二关练习题总结完结的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 久久亚洲少妇 | 色网站入口 | 99热| 一级片a级片 | 久久福利视频导航 | 日韩欧美中文字幕在线播放 | 日韩成人精品在线 | 亚洲爆爽av | 在线观看中文字幕一区二区 | 日韩不卡在线播放 | 久久只有这里有精品 | 成人精品视频 | 中文字幕一区二区三区视频 | 成人不卡在线 | 97公开免费视频 | 今天最新中文字幕mv高清 | 亚洲一区中文 | 干爹你真棒插曲免费 | 欧美夜夜夜 | 五月激情片| 天天操中文字幕 | 啪啪小视频 | 偷自拍| 亚洲风情av | 91麻豆一区二区三区 | 我想看一级黄色片 | 日本a∨视频 | 在线观看黄色国产 | 99久久精品国产一区二区三区 | 色屁屁一区二区 | 成人性生交大片免费看中文 | 大尺度av | 中国老太婆性做爰 | 成人啪啪18免费游戏链接 | 欧美色视频在线 | 麻豆精品一区二区三区 | 二级黄色片 | 国产www色 | 日韩毛片在线播放 | 91亚色视频 | 美女免费视频网站 | 黄色网址在线免费播放 | 欧美激情国产日韩精品一区18 | 欧美十大老熟艳星 | 国产综合精品视频 | 四虎黄色影视 | 少妇又色又紧又爽又刺激视频 | 综合爱爱网 | 欧美区视频 | 欧美另类日韩 | 色无极亚洲影院 | 日韩性生活大片 | 天天干天天干天天操 | 成人激情在线观看 | 欧美色图亚洲自拍 | 中国少妇无码专区 | 懂色av一区 | 精品98| 久久国产乱子伦免费精品 | 国产一区二区久久久 | 黄色男人的天堂 | 在线成人 | 亚洲第一页中文字幕 | 午夜性刺激免费视频 | 99视频热 | 日韩福利一区二区 | 成人综合在线视频 | 四虎看黄 | 最新中文字幕第一页 | 男人日女人免费视频 | 羽月希奶水一区二区三区 | 亚洲婷婷网 | 亚洲乱色熟女一区二区三区 | 男女视频在线观看免费 | 国产一区二区黑人欧美xxxx | 国产精品久久久久久网站 | 国产喷水福利在线视频 | 国产露脸无套对白在线播放 | 在线成人欧美 | 日本少妇一级片 | 中文字幕丰满乱子伦无码专区 | 超碰狠狠操 | 在线视频中文 | 亚洲天堂网站 | 日韩av影片| 人妻在客厅被c的呻吟 | 穿情趣内衣被c到高潮视频 欧美性猛交xxxx黑人猛交 | 日本精品一二三 | 日本黄色高清 | 亚洲一区二区三区高清 | 一道本在线播放 | 国精品无码人妻一区二区三区 | 午夜黄色av | 欧美激情在线免费观看 | 男女草比视频 | 对白超刺激精彩粗话av | 91影院在线| 香蕉视频官网在线观看 | 91免费精品 |