Home>Article>Operation and Maintenance> What to do if the Linux server cannot delete files

What to do if the Linux server cannot delete files

WBOY
WBOY Original
2022-07-19 14:48:16 5100browse

Solution: 1. Use the lsattr command to view the additional attributes of the file. You can check whether the file is assigned the a and i attributes. If the file contains these two attributes, it cannot be deleted. The syntax is "lsattr [- adlRvV][file or directory...]"; 2. Use the chattr command to change the additional attributes of the file. Just remove the a and i attributes of the file. The syntax is "chattr -i file path".

What to do if the Linux server cannot delete files

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What to do if the Linux server cannot delete the file

1. Use the lsattr command to view the additional attributes of the file.

Check whether the file is given the a and i attributes. If it contains these two attributes, the file cannot be deleted.

Linux lsattr command is used to display file attributes.

Use chattr to change the attributes of a file or directory. You can execute the lsattr command to query its attributes.

Syntax

lsattr [-adlRvV][文件或目录...]
  • a: Let the file or directory be used only for additional purposes;

  • b: Do not update the file or directory The last access time;

  • c: compress the file or directory and store it;

  • d: exclude the file or directory from the dumping operation Except;

  • i: No changes to files or directories are allowed;

  • s: Confidential deletion of files or directories;

  • S: Update files or directories instantly;

  • u: Prevent accidental deletion.

#2. Use chattr to change the additional attributes of the file, remove the a, i attributes, and the file can be deleted.

Linux chattr command is used to change file attributes.

chattr -i 文件路径

The strength is as follows:

What to do if the Linux server cannot delete files

Recommended learning:Linux video tutorial

The above is the detailed content of What to do if the Linux server cannot delete files. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn