How to delete a file in the Linux terminal?

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3681
    Santhosh Kumar D
    Keymaster
    @santhosh

    Learning how to delete a file in the Linux terminal makes it easy to manage files. To delete a file, you need to use the rm command followed by the file name that you want to delete.

    To delete a single file, use the rm command followed by the file name.

    rm filename

    And to delete multiple files, use the rm command followed by file names separated by a space.

    rm filename1 filename2 filename3

    Note: Please be careful when deleting files or directories, because once deleted, it is not easy to recover them.

    Learn more Linux commands.

    #3697
    Santhosh Kumar D
    Keymaster
    @santhosh

    If a file is write-protected, you will be prompted to confirm the deletion. To force delete a file without being prompted, you need to use the rm -f command followed by the file name.

    rm -f filename
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.