Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

remove(3) [linux man page]

REMOVE(3)						     Linux Programmer's Manual							 REMOVE(3)

NAME
remove - remove a file or directory SYNOPSIS
#include <stdio.h> int remove(const char *pathname); DESCRIPTION
remove() deletes a name from the file system. 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). CONFORMING TO
C89, C99, 4.3BSD, POSIX.1-2001. NOTES
Under libc4 and libc5, remove() was an alias for unlink(2) (and hence would not remove directories). 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 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2008-12-03 REMOVE(3)

Check Out this Related Man Page

REMOVE(3)						     Linux Programmer's Manual							 REMOVE(3)

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.15 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/. GNU
2017-09-15 REMOVE(3)
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

remove application

hi all, I have a newbie question. I don't seem to find a program that simulate ADD/REMOVE program on WINxx. Is there any rule or typical way of how application is removed? Thanks in advance. (1 Reply)
Discussion started by: andrec
1 Replies

2. AIX

How to REMOVE USER that display error --> "Name is too long"

I wish to remove a user from the system... but an error occurr... I try to remove via SMITTY and try to remove via command line with rmuser -p (name of user) and does not works.... The system display that the "Name is too long" There another way to remove a user... or... (1 Reply)
Discussion started by: mgonzal
1 Replies

3. Programming

What does unlink"tmep.log" do?

Hi, I saw this C program on Unix with unlink("tmp.log"); unlink("time.log"); at the end of the file. What's the purpose of doing this? Thanks a lot! (1 Reply)
Discussion started by: whatisthis
1 Replies

4. Post Here to Contact Site Administrators and Moderators

Sorry for duplicating posts

SORRY FOR DUPLICATING POSTS, COULD U JUST REMOVE THE FIRST ONE. Thank u. (1 Reply)
Discussion started by: vrguha
1 Replies

5. UNIX for Dummies Questions & Answers

FIND and REMOVE HELP NEEDED!!!

Hello, I am aware of that Find command finds certain files and remove command removes certain files. However, is there a way to Find certain DIRECTORY and remove that DIRECTORY? thank you (3 Replies)
Discussion started by: scooter17
3 Replies

6. Solaris

close open files before remove

Hi I have a script to remove log files when it reaches %70 usage in order to descending order of dates. But sometimes it happens to remove open - being processes files , so makes them unlinked from the directors and results them disappeared. How can I solve this problem , simple scenario I... (9 Replies)
Discussion started by: xramm
9 Replies

7. Solaris

Accidentally did a unlink inet

I was trying to remove a symbolic link of /etc/hosts to /etc/inet/hosts well i forgot the command and in the /etc directory i did unlink inet and now i can not get into inet and it does not exist in /etc 1) what do i do to fix the inet directory 2) how do i link /etc/hosts to... (1 Reply)
Discussion started by: deaconf19
1 Replies

8. Programming

Recursive remove directory.

What is the best way to completely remove dir with it's content ??? rmdir deletes only EMPTY dirs as i know. The man page of remove function says "remove() deletes a name from the file system." Can it remove any dir recursively ??? :rolleyes: (7 Replies)
Discussion started by: Trump
7 Replies

9. UNIX for Advanced & Expert Users

how to remove the files along with its link files

How to remove the files along with its link files either hardlink or softlink? (1 Reply)
Discussion started by: Ramesh_srk
1 Replies

10. UNIX for Dummies Questions & Answers

Grep

removed the link and i got the information i needed (6 Replies)
Discussion started by: Amit Sura
6 Replies

11. Shell Programming and Scripting

[Solved] remove file extension

Hi, I have some files with some extension e.g. abc.xml.REMOVE,xyz.xml,efg.xml.REMOVE . I have to remove the .REMOVE extension. I can display it using the below script but cannot rename it. ls -l|sed 's/\.REMOVE//' How can I rename this? Thanks in advance (7 Replies)
Discussion started by: babom
7 Replies

12. AIX

How to remove ISMP files when the directories have been deleted?

Hello all, I've been asked to help with some cleanup on a couple of systems that were running some Websphere apps. I need to remove the following filesets: mqsi61.cfgmgrc 6.1.0.2 COMMITTED Config. Manager Component mqsi61.cfgmgrf 6.1.0.2 COMMITTED Config.... (4 Replies)
Discussion started by: ZekesGarage
4 Replies

13. Shell Programming and Scripting

Unlink multiple files

I wish to unlink multiple links, but man pages shows unlink - call the unlink function to remove the specified file let's linked are in number sequence and I'm doing unlink `echo {1..500}` This fails.. Is their any other command to execute it or I need to call the unlink function that... (1 Reply)
Discussion started by: posix
1 Replies

14. Post Here to Contact Site Administrators and Moderators

Urgent : please remove the names from the post

Hi Sir, There is an escalation going on this and could you please remove the words from the following link . this is really critical. https://www.unix.com/shell-programming-and-scripting/196647-remove-headings.html please remove following terms fiappl17dev fiappl18dev ... (1 Reply)
Discussion started by: ptappeta
1 Replies