raw snippet

Opening a file increments the counter of links to that file. When removing the file physically, does not invoke the OS to remove the file effectively.

So an idea of hiding a file could be to keep a program running that does not close that file, like in the following snippet

// Copyright Robert Eisele 2015
#include <stdio.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main() {

    int fd = open("test.txt", O_CREAT);
    struct stat sb;

    while (1) {

        if (-1 != fstat(fd, &sb)) {
            printf("ALIVE %d\n", sb.st_size);
        } else {
    return 0;