remove(3)
β¨ remove(3) β the manual page bestie π
okay so literally, this is the remove(3) page from the Library Functions Manual, and it's giving "delete that name, queen" energy. buckle up π
πΈ NAME πΈ
remove β remove a file or directory β¨ (yes that's it, that's the whole job, and she does it flawlessly)
π LIBRARY π
Standard C library, aka libc, linked with -lc. iconic. classic. no cap π
π«Ά SYNOPSIS π«Ά
#include <stdio.h>
int remove(const char *path);
so you just hand her a path and she handles the rest. main character behavior, honestly π
π« DESCRIPTION π«
kay so real talk: remove() deletes a name from the filesystem. that's the vibe check. and the way she does it is smart β she calls unlink(2) for files and rmdir(2) for directories. she's literally doing the detective work for you so you don't have to figure out which one to use π΅οΈβοΈπ
now, the lore. if the name she removed was the last link to a file and no processes have that file open? boom. gone. deleted. and the space it was using gets made available for reuse. slay β¨
if the name was the last link to a file but some processes still have the file open, the file will remain in existence until the last file descriptor referring to it is closed. so she's patient, she's not gonna yank it out from under anybody π«Ά
if the name referred to a symbolic link, the link is removed. just the link, bestie. just the link.
and if the name referred to a socket, FIFO, or device? the name is removed, but processes that already have the object open may continue to use it. so the name dips, the object stays lowkey alive for whoever's holding it. it's giving "you can't sit with us but you can keep the memories" π
π RETURN VALUE π
- On success: zero is returned. β¨ perfection. no notes.
- On error:
-1is returned, anderrnois set to indicate the error. π
π₯ ERRORS π₯
the errors that occur are literally those for unlink(2) and rmdir(2). she's not reinventing anything, she's just delegating to the pros. go read those pages if you want the full list, bestie π
π¦ ATTRIBUTES π¦
for an explanation of the terms used in this section, see attributes(7).
remove()β Thread safety: MT-Safe. she's safe in multithreaded situations, periodt π
π STANDARDS π
C11, POSIX.1-2008. certified, official, standardized queen π
β HISTORY β
POSIX.1-2001, C89, 4.3BSD. she's been around. she's got history. she's an icon and she's not new here π
π BUGS π
Infelicities in the protocol underlying NFS can cause the unexpected disappearance of files which are still being used. π
so likeβ¦ yeah. NFS said "plot twist" and your still-in-use files can just ghost you. not her fault but you've been warned, bestie π
π SEE ALSO π
and that's the whole page, no crumbs left π this was remove(3) straight outta Linux man-pages 6.20, dated 2026-02-08 β go delete something responsibly, ily, bye π§π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1992, Drew Eckhardt <drew@cs.colorado.edu>
- Copyright 1993, Ian Jackson <iwj10@cus.cam.ac.uk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms