欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux命令學(xué)習(xí)總結(jié)之rm命令

 更新時(shí)間:2016年01月20日 11:07:09   作者:瀟湘隱者  
rm命令用來(lái)刪除Linux系統(tǒng)中的文件或目錄。通常情況下rm不會(huì)刪除目錄,你必須通過(guò)指定參數(shù)-r或-R來(lái)刪除目錄。接下來(lái)通過(guò)本文給大家分享Linux命令學(xué)習(xí)總結(jié)之rm命令,對(duì)linux rm命令相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧

命令簡(jiǎn)介:

rm命令用來(lái)刪除Linux系統(tǒng)中的文件或目錄。通常情況下rm不會(huì)刪除目錄,你必須通過(guò)指定參數(shù)-r或-R來(lái)刪除目錄。另外rm通??梢詫⒃撐募蚰夸浕謴?fù)(注意,rm刪除文件其實(shí)只是將指向數(shù)據(jù)塊的索引點(diǎn)(information nodes)釋放,只要不被覆蓋,數(shù)據(jù)其實(shí)還在硬盤(pán)上。如果想要保證文件的內(nèi)容無(wú)法復(fù)原,可以使用命令shred 。 另外一般還是要慎用rm -rf *這樣的命令。

執(zhí)行權(quán)限 :All User

指令所在路徑:/bin/rm

命令語(yǔ)法:

rm [OPTION]... FILE...

命令參數(shù):

參數(shù)

長(zhǎng)參數(shù)

描敘

-f

--force

強(qiáng)制刪除,忽略不存在的文件,從不給出提示。

-i

--interactive

交互模式刪除文件,刪除文件前給出提示。

-r

--recursive

遞歸的刪除目錄下面文件以及子目錄下文件。

-R

--recursive

遞歸的刪除目錄下面文件以及子目錄下文件。

-v

--verbose

顯示運(yùn)行時(shí)詳細(xì)信息

--help

顯示命令在線幫助

--version

顯示命令版本信息

使用示例:

1:查看獲取rm命令的幫助信息。

[root@DB-Server kerry]# man rmRM(1) User Commands RM(1) NAME rm - remove files or directories SYNOPSIS rm [OPTION]... FILE... DESCRIPTION This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped. OPTIONS Remove (unlink) the FILE(s). -f, --force ignore nonexistent files, never prompt -i, --interactive prompt before any removal --no-preserve-root do not treat 鈥?鈥?specially (the default) --preserve-root fail to operate recursively on 鈥?鈥? -r, -R, --recursive remove directories and their contents recursively -v, --verbose explain what is being done --help display this help and exit --version output version information and exit By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents. To remove a file whose name starts with a 鈥?鈥? for example 鈥?foo鈥? use one of these commands: rm -- -foo rm ./-foo Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using shred. AUTHOR Written by Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering. REPORTING BUGS Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT Copyright 漏 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law. SEE ALSO chattr(1), shred(1) The full documentation for rm is maintained as a Texinfo manual. If the info and rm programs are properly installed at your site, the command info rm should give you access to the complete manual. rm 5.97 June 2011 RM(1)

[root@DB-Server kerry]# rm --helpUsage: rm [OPTION]... FILE...Remove (unlink) the FILE(s). -f, --force ignore nonexistent files, never prompt -i, --interactive prompt before any removal --no-preserve-root do not treat `/' specially (the default) --preserve-root fail to operate recursively on `/' -r, -R, --recursive remove directories and their contents recursively -v, --verbose explain what is being done --help display this help and exit --version output version information and exit By default, rm does not remove directories. Use the --recursive (-r or -R)option to remove each listed directory, too, along with all of its contents. To remove a file whose name starts with a `-', for example `-foo',use one of these commands: rm -- -foo rm ./-foo Note that if you use rm to remove a file, it is usually possible to recoverthe contents of that file. If you want more assurance that the contents aretruly unrecoverable, consider using shred. Report bugs to bug-coreutils@gnu.org.

2:刪除指定文件

如下所示,該目錄下有20個(gè)文件,刪除指定文件后,只剩下19個(gè)文件了。

[oracle@DB-Server bdump]$ ls -lrt | wc -l 20 [oracle@DB-Server bdump]$ rm gsp_lgwr_7826.trc [oracle@DB-Server bdump]$ ls -lrt | wc -l 19

3:刪除文件顯示運(yùn)行時(shí)詳細(xì)信息

[oracle@DB-Server bdump]$ rm -v gsp_lgwr_4617.trc removed `gsp_lgwr_4617.trc'

4:交互模式下刪除文件

如下所示,輸入y后就會(huì)刪除文件,不想刪除則數(shù)據(jù)n

[oracle@DB-Server bdump]$ rm -iv gsp_lgwr_5005.trc rm: remove regular file `gsp_lgwr_5005.trc'? y removed `gsp_lgwr_5005.trc' [oracle@DB-Server bdump]$ rm -iv gsp_lgwr_7826.trc rm: remove regular file `gsp_lgwr_7826.trc'? n

5: 遞歸刪除某個(gè)目錄下文件以及子目錄

如下所示,kerry目錄下有test1.txt、 test2.txt 文件,以及子目錄tmp, 而子目錄下又有文件file1、file2.

[root@DB-Server ~]# tree kerrykerry|-- test1.txt|-- test2.txt`-- tmp |-- file1 `-- file2 1 directory, 4 files[root@DB-Server ~]# rm -rf kerry/

6: 刪除空目錄

[root@DB-Server ~]# mkdir kerry [root@DB-Server ~]# rm -r kerry/ rm: remove directory `kerry/'? y

7:刪除目錄bdump下的所有trc文件類型的文件。

[oracle@DB-Server bdump]$ lsalert_GSP.log gsp_lgwr_20025.trc gsp_lgwr_5023.trc gsp_p000_4637.trc gsp_p000_4718.trc gsp_p000_5025.trc gsp_p001_4639.trc gsp_p001_4720.trc gsp_p001_5027.trcgsp_lgwr_19915.trc gsp_lgwr_4719.trc gsp_lgwr_5089.trc gsp_p000_4682.trc gsp_p000_4739.trc gsp_p000_5043.trc gsp_p001_4684.trc gsp_p001_4741.trc gsp_p001_5045.trc[oracle@DB-Server bdump]$ rm -v *.trcremoved `gsp_lgwr_19915.trc'removed `gsp_lgwr_20025.trc'removed `gsp_lgwr_4719.trc'removed `gsp_lgwr_5023.trc'removed `gsp_lgwr_5089.trc'removed `gsp_p000_4637.trc'removed `gsp_p000_4682.trc'removed `gsp_p000_4718.trc'removed `gsp_p000_4739.trc'removed `gsp_p000_5025.trc'removed `gsp_p000_5043.trc'removed `gsp_p001_4639.trc'removed `gsp_p001_4684.trc'removed `gsp_p001_4720.trc'removed `gsp_p001_4741.trc'removed `gsp_p001_5027.trc'removed `gsp_p001_5045.trc'

以上所述是本文給大家介紹的Linux命令學(xué)習(xí)總結(jié)之rm命令,希望對(duì)大家有所幫助。

相關(guān)文章

  • 詳解ubuntu14.04如何設(shè)置靜態(tài)IP的方法

    詳解ubuntu14.04如何設(shè)置靜態(tài)IP的方法

    本篇文章主要介紹了ubuntu14.04如何設(shè)置靜態(tài)IP的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-07-07
  • 解決linux遠(yuǎn)程拷貝報(bào)錯(cuò)not?a?regular?file問(wèn)題

    解決linux遠(yuǎn)程拷貝報(bào)錯(cuò)not?a?regular?file問(wèn)題

    這篇文章主要介紹了解決linux遠(yuǎn)程拷貝報(bào)錯(cuò)not?a?regular?file問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • 淺析linux環(huán)境變量export命令詳解

    淺析linux環(huán)境變量export命令詳解

    這篇文章主要介紹了淺析linux環(huán)境變量export命令詳解 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2016-11-11
  • 解決安裝apache時(shí)端口號(hào)被占用的問(wèn)題

    解決安裝apache時(shí)端口號(hào)被占用的問(wèn)題

    下面小編就為大家?guī)?lái)一篇解決安裝apache時(shí)端口號(hào)被占用的問(wèn)題。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-09-09
  • ubuntu臨時(shí)或永久修改hostname的方法

    ubuntu臨時(shí)或永久修改hostname的方法

    這篇文章主要介紹了ubuntu臨時(shí)或永久修改hostname的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-06-06
  • CentOS6.5安裝glibc-2.14后locale出現(xiàn)No?such?file?or?directory解決辦法

    CentOS6.5安裝glibc-2.14后locale出現(xiàn)No?such?file?or?directory解

    大家好,本篇文章主要講了CentOS6.5安裝glibc-2.14后locale出現(xiàn)No?such?file?or?directory解決辦法,感興趣的同學(xué)趕快來(lái)看看吧,希望對(duì)你有幫助
    2021-11-11
  • 基于Centos7 部署Varnish緩存代理服務(wù)器

    基于Centos7 部署Varnish緩存代理服務(wù)器

    這篇文章主要介紹了基于Centos7 部署Varnish緩存代理服務(wù)器,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)

    Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)

    這篇文章主要介紹了Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • Vim 強(qiáng)制保存只讀類型文件的方法

    Vim 強(qiáng)制保存只讀類型文件的方法

    你是否會(huì)和我一樣經(jīng)常碰到這樣的情景:在VIM中編輯了一個(gè)系統(tǒng)配置文件,當(dāng)需要保存時(shí)才發(fā)現(xiàn)當(dāng)前的用戶對(duì)該文件沒(méi)有寫(xiě)入的權(quán)限。這個(gè)時(shí)候就需要強(qiáng)制保存只讀類型文件的方法了,這篇文章就介紹了Vim強(qiáng)制保存只讀類型文件的方法,需要的朋友可以參考借鑒,下面來(lái)一起看看吧。
    2017-01-01
  • 如何監(jiān)控 Linux 服務(wù)器狀態(tài)的方法

    如何監(jiān)控 Linux 服務(wù)器狀態(tài)的方法

    這篇文章主要介紹了如何監(jiān)控 Linux 服務(wù)器狀態(tài)的方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-06-06

最新評(píng)論