1REMOVE(3)                  Linux Programmer's Manual                 REMOVE(3)
2
3
4

NAME

6       remove - remove a file or directory
7

SYNOPSIS

9       #include <stdio.h>
10
11       int remove(const char *pathname);
12

DESCRIPTION

14       remove()  deletes  a  name from the filesystem.  It calls unlink(2) for
15       files, and rmdir(2) for directories.
16
17       If the removed name was the last link to a file and no  processes  have
18       the  file  open, the file is deleted and the space it was using is made
19       available for reuse.
20
21       If the name was the last link to a file, but any processes  still  have
22       the  file  open,  the file will remain in existence until the last file
23       descriptor referring to it is closed.
24
25       If the name referred to a symbolic link, the link is removed.
26
27       If the name referred to a socket, FIFO, or device, the name is removed,
28       but processes which have the object open may continue to use it.
29

RETURN VALUE

31       On  success,  zero is returned.  On error, -1 is returned, and errno is
32       set to indicate the error.
33

ERRORS

35       The errors that occur are those for unlink(2) and rmdir(2).
36

ATTRIBUTES

38       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
39       tributes(7).
40
41       ┌────────────────────────────────────────────┬───────────────┬─────────┐
42Interface                                   Attribute     Value   
43       ├────────────────────────────────────────────┼───────────────┼─────────┤
44remove()                                    │ Thread safety │ MT-Safe │
45       └────────────────────────────────────────────┴───────────────┴─────────┘
46

CONFORMING TO

48       POSIX.1-2001, POSIX.1-2008, C89, C99, 4.3BSD.
49

BUGS

51       Infelicities  in  the  protocol underlying NFS can cause the unexpected
52       disappearance of files which are still being used.
53

SEE ALSO

55       rm(1), unlink(1), link(2), mknod(2), open(2), rename(2), rmdir(2),  un‐
56       link(2), mkfifo(3), symlink(7)
57

COLOPHON

59       This  page  is  part of release 5.13 of the Linux man-pages project.  A
60       description of the project, information about reporting bugs,  and  the
61       latest     version     of     this    page,    can    be    found    at
62       https://www.kernel.org/doc/man-pages/.
63
64
65
66GNU                               2021-03-22                         REMOVE(3)
Impressum