Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

unlink (Unix)

From Wikipedia, the free encyclopedia
This article is about the Unix system call. For the mathematical concept, seeunlink.
unlink
Operating systemUnix andUnix-like
PlatformCross-platform
TypeCommand

InUnix-like operating systems,unlink is asystem call and acommand line utility to delete files. The program directly interfaces the system call, which removes the file name and (but not onGNU systems) directories likerm andrmdir.[1] If the file name was the lasthard link to the file, the file itself is deleted as soon as no program has it open.[2]

Unlike therm utility, theunlink utility only accepts one argument, which can be desirable to guard against accidental multi-deletions.[3]

It also appears in thePHP,Node.js,R,Perl andPython standard libraries in the form of theunlink() built-in function. Like the Unix utility, it is also used to delete files.[4][5][6][7]

Examples

[edit]

To delete a file namedfoo, one could type:

%unlinkfoo

InPHP, one could use the following function to do the same:

unlink("foo");

ThePerl syntax is identical to the PHP syntax, save for the parentheses:

unlink"foo";

InNode.js it is almost the same as the others:

fs.unlink("foo",callback);

InR (with theS language compatibility):

unlink("foo")#Comment: using the inside argument 'recursive = TRUE', directories can be deleted

Similarly in Python:

os.unlink("foo")

See also

[edit]

References

[edit]
  1. ^"GNU Coreutils: unlink invocation".www.gnu.org.
  2. ^"unlink".pubs.opengroup.org.
  3. ^"Differences Between rm and unlink Commands | Baeldung on Linux". Archived from the original on 2024-12-18. Retrieved2025-03-10.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  4. ^"PHP: unlink - Manual".php.net.
  5. ^"unlink - perldoc.perl.org".perldoc.perl.org.
  6. ^"File System - Node.js v13.0.1 Documentation".nodejs.org.
  7. ^"os — Miscellaneous operating system interfaces — Python 3.8.0 documentation".python.org.
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
File system
Text utilities
Shell utilities
Retrieved from "https://en.wikipedia.org/w/index.php?title=Unlink_(Unix)&oldid=1305727108"
Categories:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp