unlink - Removes a directory entry

Format

unlink file

Description

unlink removes a directory entry.

Following the format, file specifies the entry to be removed, which can refer to a path name, a hard link, or a symbolic link. If file refers to a symbolic link, unlink removes the symbolic link but not any file or directory named by the contents of the symbolic link. If the entry that is unlinked is the last one associated with a file, then the file itself is deleted.

unlink is implemented as a shell built-in.

Localization

unlink uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_COLLATE
  • LC_CTYPE
  • LC_MESSAGES
  • LC_SYNTAX
  • NLSPATH

Exit values

0
Successful completion.
1
Failure due to any of the following reasons:
  • No write permission for the directory that contains the link to be removed.
  • Attempting to unlink a file that does not exist.
  • Path name specified is a directory.
2
Failure due to incorrect number of arguments specified.

Related information

mv, rm, rmdir