sed與vim

sed工具

簡介

?Stream EDitor, 行編輯器

?sed是一種流編輯器,它一次處理一行內容。處理時,把當前處理的行存儲在臨時緩沖區中,稱為“模式空間”(pattern space),接著用sed命令處理緩沖區中的內容,處理完成后,把緩沖區的內容送往屏幕。接著處理下一行,這樣不斷重復,直到文件末尾。文件內容并沒有改變,除非你使用重定向存儲輸出。Sed主要用來自動編輯一個或多個文件,簡化對文件的反復操作,編寫轉換程序等

用法:

sed[option]… 'script' inputfile…

常用選項:

-n:一般情況下,所有來自STDIN的數據都會顯示到屏幕上,加上-n后,則只有經過sed特殊處理的哪一行才被列出來。

-e: 多點編輯

-f /PATH/TO/SCRIPT_FILE: 從指定文件中讀取編輯腳本

-r: 支持使用擴展正則表達式

-i: 原處編輯,慎用,危險

地址命令script:

地址定界:(1) 不給地址:對全文進行處理

(2) 單地址:#: 指定的行

[root@localhost ~]# sed -n 2p f2

apple is my favorite food.!

/pattern/:被此處模式所能夠匹配到的每一行

[root@localhost ~]# sed -n /this/p f2

this dress doesn't fit me.!

However, this dress is about $ 3183 dollars.!

 (3) 地址范圍:#,#

[root@localhost ~]# sed -n 2,3p f2

apple is my favorite food.!

Football game is not use feet only.!

#,+#

[root@localhost ~]# sed -n 2,+3p f2

apple is my favorite food.!

Football game is not use feet only.!

this dress doesn't fit me.!

However, this dress is about $ 3183 dollars.!

/pat1/,/pat2/

[root@localhost ~]# sed -n '/feet/,/clear/p' f2

Football game is not use feet only.!

this dress doesn't fit me.!

However, this dress is about $ 3183 dollars.!

GNU is free air not free beer.!

Her hair is very beauty.!

I can't finish the test.!

Oh! The soup taste good.!

motorcycle is cheap than car.!

This window is clear.!

#,/pat1/

[root@localhost ~]# sed -n '3,/clear/p' f2

Football game is not use feet only.!

this dress doesn't fit me.!

However, this dress is about $ 3183 dollars.!

GNU is free air not free beer.!

Her hair is very beauty.!

I can't finish the test.!

Oh! The soup taste good.!

motorcycle is cheap than car.!

This window is clear.!

(4) ~:步進1~2 奇數行

[root@localhost ~]# nl f1 |sed -n '1~2p'

     1      "Open Source" is a good mechanism to develop programs.

     3      Football game is not use feet only.

     5      However, this dress is about $ 3183 dollars.

     7      Her hair is very beauty.

     9      Oh! The soup taste good.

    11      This window is clear.

    13      Oh! My god!

    15      You are the best is mean you are the no. 1.

    17      I like dog.

    19      goooooogle yes!

    21      # I am VBird

2~2 偶數行

[root@localhost ~]# nl f1 |sed -n '2~2p'

     2       apple is my favorite food.

     4       this dress doesn't fit me.

     6       GNU is free air not free beer.

     8       I can't finish the test.

    10       motorcycle is cheap than car.

    12       the symbol '*' is represented as start.

    14       The gd software is a library for drafting programs.

    16       The world <Happy> is the same with "glad".

    18       google is the best tools for search keyword.

    20       go! go! Let's go.

編輯命令:

d: 刪除模式空間匹配的行

[root@localhost ~]# sed  '/^a/d' f2

"Open Source" is a good mechanism to develop programs.!

Football game is not use feet only.!

p: 顯示模式空間中的內容

[root@localhost ~]# sed  '/^a/!d' f2

apple is my favorite food.!

[root@localhost ~]# sed -n  '/^a/p' f2

apple is my favorite food.!

2a\字符串:在第2行后面追加文本;支持使用\n實現多行追加

[root@localhost ~]# sed  '2a\xxx' f2

"Open Source" is a good mechanism to develop programs.!

apple is my favorite food.!

xxx

Football game is not use feet only.!

 

[root@localhost ~]# sed  '/^a/a\xxx' f2

"Open Source" is a good mechanism to develop programs.!

apple is my favorite food.!

xxx

Football game is not use feet only.!

2i \字符串:在第2行前面插入文本;支持使用\n實現多行插入

[root@localhost ~]# sed  '/^a/i\xxx' f2

"Open Source" is a good mechanism to develop programs.!

xxx

apple is my favorite food.!

 

[root@localhost ~]# sed  '2i\xxx' f2

"Open Source" is a good mechanism to develop programs.!

xxx

apple is my favorite food.!

2c \字符串:替換第2行為單行或多行文本

[root@localhost ~]# sed  '/^a/c\xxx' f2

"Open Source" is a good mechanism to develop programs.!

xxx

Football game is not use feet only.!

 

[root@localhost ~]# sed  '2c\xxx' f2

"Open Source" is a good mechanism to develop programs.!

xxx

Football game is not use feet only.!

w /path/to/somefile: 保存模式匹配的行至指定文件

[root@localhost ~]# sed  '/^a/w /testdir/love.txt' f2

[root@localhost ~]# cat /testdir/love.txt

apple is my favorite food.!

r /path/from/somefile:讀取指定文件的文本至模式空間中匹配到的行后

[root@localhost ~]# sed  '/^a/r /etc/issue' f2

"Open Source" is a good mechanism to develop programs.!

apple is my favorite food.!

CentOS release 7.8 (Final)

Kernel \r on an \m

Mage Education Learning Services

http://www.magedu.com

Football game is not use feet only.!

=: 為模式空間中的行打印行號

[root@localhost ~]# sed  '/^a/=' f2

"Open Source" is a good mechanism to develop programs.!

2

apple is my favorite food.!

Football game is not use feet only.!

!: 模式空間中匹配行取反處理

 [root@localhost ~]# sed  '/^a/!a\s' f2

"Open Source" is a good mechanism to develop programs.!

s

apple is my favorite food.!

Football game is not use feet only.!

s

s/string1/string2/查找替換,支持使用其它分隔符,s@@@,s###

[root@localhost ~]# sed  's/apple/APPLE/' f2

"Open Source" is a good mechanism to develop programs.!

APPLE is my favorite food.!

Football game is not use feet only.!

 

[root@localhost ~]# sed 's/[[:upper:]]\+/jagger/' f2

[root@localhost ~]# sed -r 's/[[:upper:]]+/jagger/' f2

"jaggerpen Source" is a good mechanism to develop programs.!

apple is my favorite food.!

jaggerootball game is not use feet only.!

this dress doesn't fit me.!

jaggerowever, this dress is about $ 3183 dollars.!

jagger is free air not free beer.!

jaggerer hair is very beauty.!

jagger can't finish the test.!

jaggerh! The soup taste good.!

motorcycle is cheap than car.!

jaggerhis window is clear.!

the symbol '*' is represented as start.!

jaggerh!      My god!

jaggerhe gd software is a library for drafting programs.!

jaggerou are the best is mean you are the no. 1.!

jaggerhe world <Happy> is the same with "glad".!

jagger like dog.!

google is the best tools for search keyword.!

goooooogle yes!

go! go! jaggeret's go.!

# jagger am VBird

替換標記:

g: 行內全局替換

[root@localhost ~]# sed -r 's/[[:upper:]]+/jagger/g' f2

"jaggerpen jaggerource" is a good mechanism to develop programs.!

apple is my favorite food.!

jaggerootball game is not use feet only.!

this dress doesn't fit me.!

jaggerowever, this dress is about $ 3183 dollars.!

jagger is free air not free beer.!

jaggerer hair is very beauty.!

jagger can't finish the test.!

jaggerh! jaggerhe soup taste good.!

motorcycle is cheap than car.!

jaggerhis window is clear.!

the symbol '*' is represented as start.!

jaggerh!       jaggery god!

jaggerhe gd software is a library for drafting programs.!

jaggerou are the best is mean you are the no. 1.!

jaggerhe world <jaggerappy> is the same with "glad".!

jagger like dog.!

google is the best tools for search keyword.!

goooooogle yes!

go! go! jaggeret's go.!

# jagger am jaggerird

p: 顯示替換成功的行

w /PATH/TO/SOMEFILE:將替換成功的行保存至文件中

sed示例

?sed‘2p’ /etc/passwd顯示文件"passwd"中的內容,并打印第二行,因此第二行多顯示一次

?sed–n ‘2p’ /etc/passwd僅顯示第二行

?sed–n ‘1,4p’ /etc/passwd僅顯示第一到第四行

?sed–n ‘/root/p’ /etc/passwd僅顯示匹配到的字符串‘/root/’的行

?sed–n ‘2,/root/p’ /etc/passwd2行開始匹配字符串‘/root/’的行,并僅顯示匹配到的行

?sed-n ‘/^$/=’ file僅顯示空行行號并打印行號

?sed–n –e ‘/^$/p’ –e ‘/^$/=’ file僅顯示文件"file"中的空行,并打印行號

?sed‘/root/a\superman’ /etc/passwd行后。在匹配字符串‘/root/’的行后面追加內容"superman"

?sed‘/root/i\superman’ /etc/passwd行前。在匹配字符串‘/root/’的行前面追加內容"superman"

?sed‘/root/c\superman’ /etc/passwd代替行。將匹配字符串‘/root/’替換成superman

?sed‘/^$/d’ file刪除文件"file"中的空行

?sed‘1,10d’ file刪除文件"file"中的1到10行

?nl/etc/passwd| sed‘2,5d’ 顯示文件"passwd"中的第2到第5行;(nl相當于cat -b)

?nl/etc/passwd| sed‘2a tea’2a后面有空格就不用加/在文件"passwd"中的第2后面追加內容"tea"

?sed's/test/mytest/g' example將匹配到的字符串"test"替換成"mytest" (g:為全局替換)

?sed–n‘s/root/&superman/p’ /etc/passwd單詞后。將匹配到的字符串"root"替換成"rootsuperman",并僅顯示匹配到的行 (&:引用被替換的內容)

?sed–n‘s/root/superman&/p’ /etc/passwd單詞前。將匹配到的字符串"root"替換成"supermanroot",并僅顯示匹配到的行

?sed-e ‘s/dog/cat/’ -e ‘s/hi/lo/’ pets將匹配到的字符串"dog"替換成"cat",將匹配到的字符串"hi"替換成"lo"

?sed–i.bak ‘s/dog/cat/g’ pets(-i.bak備份)將匹配到的字符串"dog"替換成"cat",并在替換之前將文件備份成pets.bak

練習

?1、刪除/etc/grub2.conf文件中所有以空白開頭的行行首的空白字符

[root@localhost ~]# sed 's@^[[:space:]]\+@@g' /etc/grub2.cfg

?2、刪除/etc/fstab文件中所有以#開頭,后面至少跟一個空白字符的行的行首的#和空白字符.

[root@localhost ~]# sed 's@^#[[:space:]]\+@@p' /etc/fstab

?3、在/root/install.log每一行行首增加#

sed ‘s/^/#/g'  /root/install.log

?4、在/etc/fstab文件中不以#開頭的行的行首增加#

sed s'/^[^#]/#/g'  /etc/fstab

?5、處理/etc/sysconfig路徑,使用sed命令取出其目錄名和基名

取目錄名:

[root@centos7 ~]# echo "/etc/fst/sd/" |sed -r 's#[^/] +/?$##'

     :該種方法是從取基名的方法,衍生而來。“取出“基名,就可以得到目錄名了。這里將基名用空替換。錨定行尾($),有"/"或者無"/"(/?),前面第一個"/"之后([^/])的內容(+)

取基名:

[root@centos7 ~]# echo "/etc/fst/sd/" | sed -r 's#^.*\<##'

 

取基名

[root@centos7 ~]# echo "/etc/fst/sd/" | sed -r 's@(.*)/([^/]+/?)@\2@'

取目錄名——將該方法的\2,修改為\1

[root@centos7 ~]# echo "/etc/fst/sd/" | sed -r 's@(.*)/([^/]+/?)@\1@'

:將目錄名部分和基名部分(基名表示方法,同方法1中的普通表示方法),分別分組表示。除了基名,其他部分,就都是目錄名了。(.*)

?6、利用sed 取出ifconfig命令中本機的IPv4地址

[root@centos7 ~]#ifconfig | sed -n "2p"| sed -e "s/.*inet//" -e "s/netmask.*//"

?7、統計centos安裝光盤中Package目錄下的所有rpm文件的以.分隔倒數第二個字段的重復次數

[root@centos6 Packages]#ls /media/CentOS_6.8_Final/Packages/*.rpm | sed -r 's#.*\.(.*)\.rpm#\1#'|sort | uniq -c | sort -n

高級編輯命令:

h: 式空間中的內容覆蓋至持空間中

H:把模式空間中的內容追加至保持空間中

g: 持空間取出數據覆蓋至式空間

G:從保持空間取出內容追加至模式空間

x: 把模式空間中的內容與保持空間中的內容進行互換

n: 讀取匹配到的行的下一行覆蓋至模式空間

N:讀取匹配到的行的下一行追加至模式空間

d: 刪除模式空間中的行

D:刪除當前模式空間開端至\n的內容(不在傳至標準輸出),放棄之后的命令,但是對剩余模式空間重新執行sed

sed示例 

?sed -n 'n;p' FILE顯示偶數行

?sed '1!G;h;$!d' FILE逆向顯示文件內容

?sed '$!N;$!D' FILE取出文件后兩行;

?sed '$!d' FILE取出文件最后一行;

?sed ‘G’ FILE每行后面添加一行空白行

?sed ‘g’ FILE 全是空行

?sed ‘/^$/d;G’ FILE將空白行去重,僅顯示一行

?sed 'n;d' FILE顯示奇數行

?sed -n '1!G;h;$p' FILE逆向顯示文件中的每一行

vim編輯器

1.簡介

vi: Visual Interface,文本編輯器

文本:ASCII, Unicode

文本編輯種類:

行編輯器: sed

全屏編輯器:nano, vi

Vim=Vi Improved

其他編輯器:

gedit一個簡單的圖形編輯器

gvim一個Vim編輯器的圖形版本

2.打開文件

# vim [OPTION]… FILE…

+#: 打開文件后,直接讓光標處于第#行的行首

+/PATTERN:打開文件后,直接讓光標處于第一個被PATTERN匹配到的行的行首

vim + file 直接打開file,光標在最后一行

vim b file 二進制方式打開文件

vim d file1 file2 比較多個文件

vim -m file 只讀打開文件

?    ex file vim –e 直接進入ex模式

?如果該文件存在,文件被打開并顯示內容

如果該文件不存在,當編輯后第一次存盤時創建它

3.vim編輯器模式

?擊鍵行為是依賴于vim的的“模式”

?三種主要模式

命令模式(默認):移動光標,剪切/粘貼文本

插入(編輯)模式:修改文本

擴展命令模式:保存,退出等

?Esc鍵退出當前模式

?EscEsc鍵總是返回到命令模式

4.模式轉換

1).命令模式–> 插入模式

i: insert, 在光標所在處輸入

I:在當前光標所在行的行首輸入

a: append, 在光標所在處后面輸入

A:在當前光標所在行的行尾輸入

o: 在當前光標所在行的下方打開一個新行

O:在當前光標所在行的上方打開一個新行

2).插入模式—-> 命令模式

ESC

3).命令模式—-> 擴展命令模式

:

4).擴展命令模式—-> 命令模式

ESC

5).鎖定和解鎖:CTRL+s,Ctrl+q

5.命令模式

1.光標跳轉

1).字符間跳轉:

h: l: j: k:

#COMMAND:跳轉由#指定的個數的字符;

40h  30j  20k  10l

2).單詞間跳轉:

w:下一個單詞的詞首

e:當前或下一單詞的詞尾

b:當前或前一個單詞的詞首

#COMMAND:由#指定一次跳轉的單詞數

3).當前頁跳轉:

H:頁首head

M:頁中間行middle

L:  頁底low

4).行首行尾跳轉:

^: 跳轉至行首的第一個非空白字符;

0: 跳轉至行首

$: 跳轉至行尾

5).行間移動:

#G或者擴展模式下:# :跳轉至由#指定行

G:最后一行

1G或者gg: 第一行

6).句間移動:

):下一句 (:上一句

7).段落間移動:

}:下一段 {:上一段

2.翻屏操作

?Ctrl+f: 向文件尾部翻一屏

?Ctrl+b: 向文件首部翻一屏

?Ctrl+d: 向文件尾部翻半屏

?Ctrl+u:向文件首部翻半屏

3.關閉命令模式:

ZZ: 保存退出

ZQ:不保存退出

4.編輯操作

1).字符編輯:

x: 刪除光標處的字符;

#x: 刪除光標處起始的#個字符

xp: 交換光標所在處的字符及其后面字符的位置

~:轉換大小寫

2).替換命令(r, replace)

r: 替換光標所在處的字符

R:切換成REPLACE模式,替換字符

3).刪除命令:

d: 刪除命令,可結合光標跳轉字符,實現范圍刪除;

d$: 刪除到行尾

d^:刪除到非空行首

d0:刪除到行首

dw:刪除單詞,刪除光標處到單詞結尾的字符

de: 刪除單詞,刪除光標處到單詞結尾的字符

db: 刪除單詞,刪除光標處到單詞詞首的字符

#COMMAND

?dd: 刪除光標所在的行

#dd:多行刪除

?D:從當前光標位置一直刪除到行尾,留空行,等同于d$

4).復制命令(y, yank)

y: 復制,行為相似于d命令

y$:復制行尾

y0:復制到行首

y^:復制到非空行首

ye

yw

yb

#COMMAND

?yy:復制整行

#yy: 復制多行

?Y: 復制整行

5).粘貼命令(p, paste)

p:緩沖區存的如果為整行,則粘貼當前光標所在行的下方;否則,則粘貼至當前光標所在處的后面

P:緩沖區存的如果為整行,則粘貼當前光標所在行的上方;否則,則粘貼至當前光標所在處的前面

6).改變命令(c, change)

c: 修改后切換成插入模式

c$

c^

c0

cb

ce

cw

#COMMAND

?cc:刪除當前行并輸入新內容

#cc:

?C:刪除當前光標到行尾,并切換成插入模式

                                              sed與vim

7)其他命令

100iwang [ESC] 粘貼“wang”100

 

<start position><command><end position>

Command:y 復制、d 刪除、gU變大寫、gu變小寫

例如0y$ 命令意味著: 0 →先到行頭

y →從這里開始拷貝

$ →拷貝到本行最后一個字符

ye 從當前位置拷貝到本單詞的最后一個字符

5.撤消更改

?u:撤銷最近的更改

?#u:撤銷之前多次更改

?U:撤消光標落在這行后所有此行的更改,按Ctrl-r重做最后的“撤消”更改

?. :重復前一個操作

?n.:重復前一個操作n

6.擴展命令模式

按“:”進入拓展命令模式,創建一個命令提示符:,處于底部的屏幕左側

1).命令:

:w寫(存)磁盤文件

   w  /root/ff   當前狀態可以存盤到ff文件里。

:wq寫入并退出

:x 寫入并退出

:q 退出

:q!強制退出,不存盤退出,即使更改都將丟失

:r filename 讀文件內容到當前文件中,即將“filename”這個文件內容加載到光標所在行后面。

:w filename 將當前文件內容寫入另一個文件

:!command 暫時離開vi到拓展命令模式下執行command的顯示結果

例如::!ls/home 即可在vi當中查看/home下面以歷史輸出的文件信息。

r!command 讀命令結果加載到光標行后面

r!ls /root

2).地址定界

:start_pos, end_pos

#: 具體第#行,例如2表示第2行;

#,#: 從左側#表示行起始,到右側#表示行結尾

#,+#: 從左側#表示的行起始,加上右側#表示的行數:2,+3 表示25

.: 當前行

$: 最后一行

.,$-1 當前行到倒數第二行

%全文, 相當于1,$

/pat1/,/pat2/從第一次被pat1模式匹配到的開始,一直到第一次被pat2匹配到的結束

#,/pat/從第#行到第一次被pat匹配到的行結束

/pat/,$從第一次被pat匹配的行到第#行結束

使用方式:后跟一個編輯命令

d刪除

y復制

w file: 將范圍內的行另存至指定文件中

r file:在指定位置插入指定文件中的所有內容

3).查找并替換

/PATTERN:從當前光標所在處向文件尾部查找

?PATTERN:從當前光標所在處向文件首部查找

n:與命令同方向

N:與命令反方向

s: 在擴展模式下完成查找替換操作

格式:s/要查找的內容/替換為的內容/修飾符

要查找的內容:可使用模式

替換為的內容:不能使用模式,但可以使用\1, \2, …等后向引用符號;還可以使用“&”引用前面查找時查找到的整個內容

修飾符i: 忽略大小寫

g: 全局替換;默認情況下,每一行只替換第一次出現

gc:全局替換,每次替換前詢問

查找替換中的分隔符/可替換為其它字符,例如s@/etc@/var@g或者s#/boot#/#i

練習

?1、復制/etc/profile/tmp/目錄,用查找替換命令刪除/tmp/profile文件中的行首的空白字符

:%s/^ \+//g

?2、復制/etc/rc.d/init.d/functions文件至/tmp目錄,用查找替換命令為/tmp/functions的每行開頭為空白字符的行的行首添加一個#號,原有空白字符保留。

:%s/^ /# /g

Vim寄存器

1.簡介

?26個命名寄存器和1個無命名寄存器,常存放不同的剪貼版內容,可以不同會話間共享。

?a,b,…,z加上表示寄存器,放在數字和命令之間

如:3"tyy 表示復制3行到t寄存器中

"tp 表示將t寄存器內容粘貼

?未指定寄存器的,將使用無命名寄存器

?10個數字寄存器,用01,…,9表示,0存放最近復制內容,1存放最近刪除內容。當新的文本變更和刪除時,1轉存到2,2轉存到3,以此類推。數字寄存器不能在不同會話間共享

 

2.編輯二進制文件

?1)以二進制方式打開文件

vim –b binaryfile

?2)擴展命令模式下,利用xxd命令轉換為可讀的十六進制

:%!xxd

?3)編輯二進制文件

?4)擴展命令模式下,利用xxd命令轉換回二進制

:%!xxd –r

?5)保存退出

3.可視化模式

?允許選擇的文本塊:

v面向字符

V面向行

ctrl-v 面向塊

?可視化鍵可用于與移動鍵結合使用:

w,),},箭頭等

?突出顯示的文字可以被刪除,復制,變更,過濾,搜索/替換等

4.多文件模式

vim FILE1 FILE2 FILE3 …

:next 下一個

:prev前一個

:first 第一個

:last 最后一個

:wall 保存所有

:qall退出所有

:wqall

5.使用多個“窗口”

?多文件分割

vim -o|-O FILE1 FILE2 …

-o: 水平分割

-O: 垂直分割

在窗口間切換:Ctrl+w松手, Arrow

?單文件窗口分割:

Ctrl+w,s: split, 垂直分割

Ctrl+w,v: vertical, 水平分割

ctrl+w,q:取消相鄰窗口

ctrl+w,o:取消全部窗口

wqall退出

6.定制vim的工作特性

配置文件:永久有效

全局:/etc/vimrc

個人:~/.vimrc

?擴展模式:當前vim進程有效

?(1) 行號

顯示:set number, 簡寫為set  nu

取消顯示:set nonumber, 簡寫為set  nonu

?(2) 括號成對匹配

匹配:set showmatch, 簡寫為set sm

取消:set nosm

?(3) 自動縮進

啟用:set ai

禁用:set noai

?(4) 高亮搜索

啟用:set hlsearch

禁用:set nohlsearch

?(5) 語法高亮

啟用:syntax on

禁用:syntax off

?(6) 忽略字符的大小寫

啟用:set ic

不忽略:set noic

?(7) 文件格式

啟用:fileformat=unix

不忽略:fileformat=dos

?(8) 設置文本寬度

:set textwidth=65 (vimonly)

:set wrapmargin=15

(9) : help option-list

(10):setor : set all

7.了解更多

?vi/vim內置幫助:help

:helptopic

Use:qto exit help

? Vimtutorvim說明書

練習

?1、如何設置tab縮進為4個字符?

vi /etc/vim/vimrc 將一個tab改為4個字符縮進set tabstop=4

 

?2、復制/etc/rc.d/init.d/functions文件至/tmp目錄;替換/tmp/functions文件中的/etc/sysconfig/init/var/log;

cp /etc/rc.d/init.d/functions /tmp

cat /tmp/functions|tr '/etc/sysconfig/init' 'var/log'

?3、刪除/tmp/functions文件中所有以#開頭,且#后面至少有一個空白字符的行的行首的#號;

[root@localhost ~]# sed 's@^#[[:space:]]\+@@p' /tmp/functions

 

原創文章,作者:Jagger,如若轉載,請注明出處:http://www.www58058.com/33760

(0)
JaggerJagger
上一篇 2016-08-15
下一篇 2016-08-15

相關推薦

  • Linux硬鏈接和軟鏈接

    標簽:    inode    軟鏈接    硬鏈接 一、ionde及inode編號   在計算機中,信息一般以扇區(sectors)的形式存儲在硬盤上,而每個扇區包括512個字節的數據和一些其他信息(即一個扇區包括兩個主要部分:存儲數據地點的標識符和存儲數據的數據段)。操作系統…

    Linux干貨 2016-10-20
  • 第二周作業

    作業

    Linux干貨 2018-03-20
  • N25期—第四周作業

    1、 復制/etc/skel目錄為/home/tuser1,要求/home/tuser1及其內部文件的屬組和其它用戶均沒有任何訪問權限。 cp –rf /etc/skel /home/tuser1 chmod -R go= /home/tuser1 2、 編輯/etc/group文件,添加組hado…

    Linux干貨 2016-12-26
  • 馬哥教育網絡班22期+第13周課程練習

    1、建立samba共享,共享目錄為/data,要求:(描述完整的過程)   1)共享名為shared,工作組為magedu;   2)添加組develop,添加用戶gentoo,centos和ubuntu,其中gentoo和centos以develop為附加組,ubuntu不屬于develop組;密碼均為用戶名; &n…

    Linux干貨 2016-12-05
  • 高級變量-有類型變量

    一.高級變量用法– 有類型變量   Shell 變量一般是無類型的,但是bash Shell 提供了declare和 typeset 兩個命令用于指定變量的類型,兩個命令是等價的 declare [ 選項]  變量名 -r  將變量設置為只讀屬性 -i  將變量定義為整型數 -a  將變量定義為數…

    Linux干貨 2016-11-24
欧美性久久久久