无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Linux文件操作

2023-09-07 18:37 作者:wbnyua  | 我要投稿

[toc]

### 1.文件操作

#### 1.1 創(chuàng)建文件

``` shell

# touch+文件名

# 例子:

# 創(chuàng)建一個文件

touch hello.c

# 創(chuàng)建多個文件

touch hello.c hi.c

```

#### 1.2 刪除文件

``` shell

# rm+文件名

# 例子:

# 刪除一個文件

rm hello.c

# 刪除多個文件

rm hello.c hi.c

```


#### 1.3 壓縮文件

``` shell

# tar -czvf [壓縮后文件名.tar] [需要壓縮的文件或需要壓縮的文件夾]

# -czvf中的“-”,可省略

# 例子(壓縮成.tar文件):

# 壓縮一個文件

tar -czvf source.tar hello.c

# 壓縮多個文件

tar -czvf source.tar hello.c hi.c


# 例子(壓縮成.tar.gz文件):

# 壓縮一個文件

tar -czvf source.tar.gz hello.c

# 壓縮多個文件

tar -czvf source.tar.gz hello.c hi.c


# 例子(壓縮成.tar文件):

# 壓縮文件夾

tar -czvf source.tar.gz hello

# 壓縮多個文件夾

tar -czvf source.tar.gz hello hi

```


#### 1.4 解壓文件

``` shell

# tar -xzvf [名稱.tar]

# 例子:

# 解壓.tar文件

tar -xzvf source.tar

# 解壓.tar.gz文件

tar -xzvf source.tar.gz

```


### 2.0 文件權(quán)限

#### 2.1 查看文件權(quán)限

``` shell

ls -l hello.c

```


#### 2.2 賦予文件權(quán)限

``` shell

# 給當(dāng)前用戶賦予hello.c文件的可執(zhí)行權(quán)限

chmod u+x hello.c

# 或者(給當(dāng)前用戶賦予hello.c文件的可執(zhí)行權(quán)限)

chmod +0100 hello.c


# 給當(dāng)前用戶組內(nèi)其他成員賦予hello.c文件的可執(zhí)行權(quán)限

chmod g+x hello.c

# 或者(給當(dāng)前用戶組內(nèi)其他成員賦予hello.c文件的可執(zhí)行權(quán)限)

chmod +0010 hello.c


# 給其他用戶賦予hello.c文件的可執(zhí)行權(quán)限

chmod o+x hello.c

# 或者(給其他用戶賦予hello.c文件的可執(zhí)行權(quán)限)

chmod +0001 hello.c


# 給所有用戶都賦予對hello.c文件的所有權(quán)限

chmod +0777 hello.c


# 其他權(quán)限

# 賦予當(dāng)前用戶hello.c的讀取權(quán)限

chmod u+r hello.c

# 或者

chmod +0400 hello.c


# 賦予當(dāng)前用戶hello.c的寫入權(quán)限

chmod u+w hello.c

# 或者

chmod +0200 hello.c

```


#### 2.3 去除文件權(quán)限

``` shell

# 去除當(dāng)前用戶hello.c文件的可執(zhí)行權(quán)限

chmod u-x hello.c

# 或者(去除當(dāng)前用戶hello.c文件的可執(zhí)行權(quán)限)

chmod -0100 hello.c


# 去除當(dāng)前用戶組內(nèi)其他成員hello.c文件的可執(zhí)行權(quán)限

chmod g-x hello.c

# 或者(去除當(dāng)前用戶組內(nèi)其他成員hello.c文件的可執(zhí)行權(quán)限)

chmod -0010 hello.c


# 去除其他用戶hello.c文件的可執(zhí)行權(quán)限

chmod o-x hello.c

# 或者(去除其他用戶hello.c文件的可執(zhí)行權(quán)限)

chmod -0001 hello.c


# 去除所有用戶對hello.c文件的所有權(quán)限

chmod -0777 hello.c


# 其他權(quán)限

# 去除當(dāng)前用戶hello.c的讀取權(quán)限

chmod u-r hello.c

# 或者

chmod -0400 hello.c


# 去除當(dāng)前用戶hello.c的寫入權(quán)限

chmod u-w hello.c

# 或者

chmod -0200 hello.c

```


Linux文件操作的評論 (共 條)

分享到微博請遵守國家法律
永年县| 沁源县| 互助| 奉贤区| 灌南县| 获嘉县| 隆安县| 蕉岭县| 淄博市| 香河县| 台湾省| 会东县| 宜昌市| 巴林左旗| 三江| 东兴市| 湘潭市| 汤原县| 湟源县| 黄梅县| 昌图县| 泸西县| 彭泽县| 盐池县| 监利县| 屏边| 宜昌市| 青神县| 宝清县| 略阳县| 江阴市| 西林县| 平山县| 三门峡市| 涿鹿县| 福州市| 高州市| 湟中县| 石林| 三原县| 肃北|