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: -1 is returned, and errno is 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms