NAME
remove - remove a file or directory
SYNOPSIS
#include <stdio.h> int remove(const char *pathname);
DESCRIPTION
remove() deletes a name from the filesystem. It calls unlink(2) for files, and rmdir(2) for directories. If the removed name was the last link to a file and no processes have the file open, the file is deleted and the space it was using is made available for reuse. If the name was the last link to a file, but any processes still have the file open, the file will remain in existence until the last file descriptor referring to it is closed. If the name referred to a symbolic link, the link is removed. If the name referred to a socket, FIFO, or device, the name is removed, but processes which have the object open may continue to use it.
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
The errors that occur are those for unlink(2) and rmdir(2).
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). Interface Attribute Value remove() Thread safety MT-Safe
CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C89, C99, 4.3BSD.
BUGS
Infelicities in the protocol underlying NFS can cause the unexpected disappearance of files which are still being used.
SEE ALSO
rm(1), unlink(1), link(2), mknod(2), open(2), rename(2), rmdir(2), unlink(2), mkfifo(3), symlink(7)
COLOPHON
This page is part of release 4.09 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
More Linux Commands
manpages/xdr_authunix_parms.3.html
xdr_authunix_parms(3) - library routines for remote procedur
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s
manpages/gluNurbsSurface.3gl.html
gluNurbsSurface(3gl) - define the shape of a NURBS surface
Use gluNurbsSurface within a NURBS (Non-Uniform Rational B-Spline) surface definition to describe the shape of a NURBS surface (before any trimming). To mark th
manpages/sane-gt68xx.5.html
sane-gt68xx(5) - SANE backend for GT-68XX based USB flatbed
The sane-gt68xx library implements a SANE (Scanner Access Now Easy) backend that provides access to USB flatbed scanners based on the Grandtech GT-6801 and GT-6
manpages/systemd-hostnamed.service.8.html
systemd-hostnamed.service(8) Host name bus mechanism........
systemd-hostnamed is a system service that may be used as a mechanism to change the systems hostname. systemd-hostnamed is automatically activated on request an
manpages/menu_request_name.3menu.html
menu_request_name(3menu) - handle printable menu request nam
The function menu_request_name returns the printable name of a menu request code. The function menu_request_by_name searches in the name-table for a request wit
manpages/XSelectionRequestEvent.3.html
XSelectionRequestEvent(3) - SelectionRequest event structure
The structure for SelectionRequest events contains: typedef struct { int type; /* SelectionRequest */ unsigned long serial; /* # of last request processed by se
manpages/iwgetid.8.html
iwgetid(8) - Report ESSID, NWID or AP/Cell Address of wirele
iwgetid is used to find out the NWID, ESSID or AP/Cell Address of the wireless network that is currently used. The information reported is the same as the one s
manpages/CPU_AND_S.3.html
CPU_AND_S(3) - macros for manipulating CPU sets (Man Page)
The cpu_set_t data structure represents a set of CPUs. CPU sets are used by sched_setaffinity(2) and similar interfaces. The cpu_set_t data type is implemented
manpages/curl_formadd.3.html
curl_formadd(3) - add a section to a multipart/formdata HTTP
curl_formadd() is used to append sections when building a multipart/formdata HTTP POST (sometimes referred to as RFC2388-style posts). Append one section at a t
manpages/gnutls_certificate_get_issuer.3.html
gnutls_certificate_get_issuer(3) - API function (Man Page)
This function will return the issuer of a given certificate. RETURNS On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. SINCE 3.0.0
manpages/asn1_parser2array.3.html
asn1_parser2array(3) - function that generates a C structure
Function that generates a C structure from an ASN1 file. Creates a file containing a C vector to use to manage the definitions included in inputFileName file. I
manpages/nexttoward.3.html
nexttoward(3) - floating-point number manipulation (ManPage)
The nextafter(), nextafterf(), and nextafterl() functions return the next representable floating-point value following x in the direction of y. If y is less tha
