I went through the Linux man page for access command, but not sure about the application of the command.
Can someone explain this.
Can it be used like this:
access -f filename;
If i want to check whether the file is existing or not?
But I am getting an error :
The transaction failed: no-cache,
Same thing happens with:
access -w filename;
if I want to check whether the file is writable by current user.
Also this can also easily be done with test command easily. Then what is the exact difference between these two commands. Please elaborate.
thanks in advance.
That is not a Linux command. It’s
Cfunction that can be loaded through theunistd.hlibrary.You can use it in a
Cprogram as follows:Note that it returns
0on success. And0is false forCand many other languages, but in this case it meanstrue.The fact that you can see
man accessdoesn’t mean at all that it’s a Linux command as any standard Linux distribution has man pages for every C library and function. You can also seeman malloc. You can determine if it’s a Linux command or a C library man page by viewing the header. For exampleman access:As you can see, the first line states
Linux Programmer's Manual.