HOME

TheInfoList



OR:

In
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems, unlink is a
system call In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, acc ...
and a
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
utility to delete files. The program directly interfaces the system call, which removes the file name and (but not on
GNU GNU () is an extensive collection of free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any ...
systems) directories like rm and rmdir. If the file name was the last
hard link In computing, a hard link is a directory entry (in a directory-based file system) that associates a name with a file. Thus, each file must have at least one hard link. Creating additional hard links for a file makes the contents of that file ac ...
to the file, the file itself is deleted as soon as no program has it open. It also appears in the
PHP PHP is a General-purpose programming language, general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementati ...
, Node.js, R,
Perl Perl is a family of two High-level programming language, high-level, General-purpose programming language, general-purpose, Interpreter (computing), interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it ...
and Python standard libraries in the form of the ''unlink()'' built-in function. Like the Unix utility, it is also used to delete files.


Example

To delete a file named ''foo'', one could type: % unlink foo In PHP, one could use the following function to do the same: unlink("foo"); The Perl syntax is identical to the PHP syntax, save for the parentheses: unlink "foo"; In Node.js it is almost the same as the others: fs.unlink("foo", callback); In R (with the S language compatibility): unlink("foo") #Comment: using the inside argument 'recursive = TRUE', directories can be deleted Similarly in Python: os.unlink("foo")


See also

*
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...
* link (Unix) *
ln (Unix) The command is a standard Unix command utility used to create a hard link or a symbolic link (symlink) to an existing file or directory. The use of a hard link allows multiple filenames to be associated with the same file since a hard link p ...


References

Unix SUS2008 utilities System calls {{storage-software-stub