Delete a file whose file name contains special characters

Source: Internet
Author: User
Delete a file whose file name contains special characters-general Linux technology-Linux technology and application information. For more information, see the following section. Today, I want to delete a file named "-link" (due to misoperations). I directly rm-link the file under the terminal and the result failed. So I deleted it directly in gnome, later, google made the following achievements:

Rm--link
Rm./-link

Use ls-I to find the inode Number of the file. Assume that the inode number is 12345, and then use find.-inume 12345-OK rm '{}' \ to delete the file.

Knowledge Extension: Linux File Names

The Linux system is case sensitive to English characters. For example, myfile, Myfile, and myFILE indicate three different files. Similarly, user passwords and logon names must be case sensitive (the naming rules for Unix and C languages are used here ). The naming directory and naming file rules are the same. Unless for a special reason, the names of the files and directories created by the user must be in lowercase. Most Linux commands also use lower-case characters.

In Linux, the file name can contain a maximum of 256 characters. Generally, characters in a file name include letters, numbers, periods, underscores (_), and hyphens ). Linux allows other symbols except the above symbol to be used in file names, but it is not recommended that you do so. Some Conversion characters (that is, these characters are borrowed by the system to indicate some special meanings) have special meanings in the Linux COMMAND Interpreter (shell is similar to the COMMAND processor COMMAND in DOS. COM ). Such Conversion characters include: "?" (Question mark), "*" (asterisk), "" (Space), "$" (currency character), "&", and "extension. Avoid using these characters in the file name. The file name can contain "" (Space), but we recommend that you use "_" (underline) instead. "/" Can represent both the root of the directory tree and can be used as a separator in the path name (similar to "\" in DOS), so "/" cannot appear in the file name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.