Linux command
unlink 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Remove a regular file
unlink [file]
Remove a symbolic link (removes the link, not the target)
unlink [symlink]
Display version information
unlink --version
说明
unlink calls the unlink(2) system call to remove the directory entry for a single file. It accepts exactly one operand and has no options for recursion, interactive prompting, or force behavior. When the last link to a file is removed and no process still has it open, the underlying inode and data blocks are freed. For files with multiple hard links, only the named link is removed; data remains accessible through the remaining links. Removing a symbolic link deletes the link itself, not the target. Unlike rm, unlink cannot operate on directories, cannot accept multiple operands, and does not expand shell globs specially. This minimalism makes it predictable for scripts that need to remove exactly one path with no risk of accidentally matching additional files.
参数
- --help
- Display a brief help message and exit.
- --version
- Output version information and exit.
FAQ
What is the unlink command used for?
unlink calls the unlink(2) system call to remove the directory entry for a single file. It accepts exactly one operand and has no options for recursion, interactive prompting, or force behavior. When the last link to a file is removed and no process still has it open, the underlying inode and data blocks are freed. For files with multiple hard links, only the named link is removed; data remains accessible through the remaining links. Removing a symbolic link deletes the link itself, not the target. Unlike rm, unlink cannot operate on directories, cannot accept multiple operands, and does not expand shell globs specially. This minimalism makes it predictable for scripts that need to remove exactly one path with no risk of accidentally matching additional files.
How do I run a basic unlink example?
Run `unlink [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --help do in unlink?
Display a brief help message and exit.