1

This question already has an answer here:

I am trying to see all the files that are not user writeable. I know I can use the ls command to view all, but I wanted to have just the ones that are not user writeable. I am currently in unix and the find command will not work for me

marked as duplicate by steeldriver, dr01, Wouter Verhelst, don_crissti, αғsнιη Apr 9 '18 at 16:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @steeldriver Note that the user can't seem to use -writable with find which implies that they are not on Linux. The answer in the duplicate is therefore unusable to them. – Kusalananda Apr 9 '18 at 15:39
  • @steeldriver ... or they are mistyping the command. – Kusalananda Apr 9 '18 at 16:09
  • -bash-3.2$ find . -type f ! -prem -u=w then the system responds with -bash-3.2$ – jameet bhatti Apr 9 '18 at 16:13
  • @don_crissti I hear you. That's a good point. – Kusalananda Apr 9 '18 at 16:16
  • @jameetbhatti -prem should be -perm. – Kusalananda Apr 9 '18 at 16:17
2

With standard find (should work on any Unix system):

find . -type f ! -perm -u=w

This will find all files that are not writable by their owner.

With GNU find (default on Linux systems):

find . -type f ! -writable

The GNU variation will find files that may be writable by the file's owner, but not by the current user.

  • it keeps responding saying find: abd option -writable – jameet bhatti Apr 9 '18 at 15:29
  • @jameetbhatti What Unix are you using? The second variation will only work with GNU find (the default find on Linux). Other Unices sometimes has this installed as gfind. – Kusalananda Apr 9 '18 at 15:34
  • I am currently using a program called putty which puts me in the bash shell – jameet bhatti Apr 9 '18 at 15:57
  • @jameetbhatti Ok, is the machine that you are connecting to running Linux or or some other Unix? The first command should work regardless. – Kusalananda Apr 9 '18 at 16:02
  • 3
    @jameetbhatti Sure, and you asked about finding files that were not user writable. – Kusalananda Apr 9 '18 at 16:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.