alexleonard said:

alexleonard

Does anyone know what command I would run in Linux to 1) locate a certain filename, 2) display location, 3) show file permissions?

10 months, 1 week ago.

17 comments so far

  • map

    Try channel #linux...

    10 months, 1 week ago by map

  • alexleonard

    Thanks @map :)

    I'll post there now.

    10 months, 1 week ago by alexleonard

  • edythemighty

    I'm gonna go out on a limb and say find might cover the first, and probably the second. As for showing file permissions, I know there's another command for that, but alas, I only woke up an hour ago. I need brain food! Ask @BigEclipse

    10 months, 1 week ago by edythemighty

  • BigEclipse

    ls -l displays permissions. Use chmod to change them. Not sure what you mean by "display" location. After finding, just use cd to get there.

    10 months, 1 week ago by BigEclipse

  • edythemighty

    @alexleonard: Here is a more organized and descriptive article. Gotta love IBM's *nix articles :3

    10 months, 1 week ago by edythemighty

  • alexleonard

    Thanks guys - I'll test those out.

    The idea is that I want to search through many sub-folders for a particular file I know to be in many locations and double-check the file permissions of those files all in one go.

    It's a security thing - just want to make sure I haven't left permissions incorrect on a web server.

    10 months, 1 week ago by alexleonard

  • alexleonard

    So I might need to do something like

    find . -name [filename] -exec ls -l {} \;

    10 months, 1 week ago by alexleonard

  • BigEclipse

    It'd look like: ls -l filename.ext or locate filename.

    10 months, 1 week ago by BigEclipse

  • alexleonard

    Oh right, and does ls do listing of stuff below your current dir? I had assumed it just listed everything in the current dir?

    10 months, 1 week ago by alexleonard

  • BigEclipse

    locate lists everything in all directories.

    10 months, 1 week ago by BigEclipse

  • alexleonard

    and does locate allow me to exec an ls -l query as well?

    10 months, 1 week ago by alexleonard

  • bubu1uk

    locate to find file.

    ls /pathwhereitis to see permissions ;)

    10 months, 1 week ago by bubu1uk

  • alexleonard

    I think the problem is that I'm talking about hundreds of files here, so I can locate all of them, but if I have to ls /path on each one it will take ages

    10 months, 1 week ago by alexleonard

  • bubu1uk

    what exact file u'r looking for?

    10 months, 1 week ago by bubu1uk

  • BigEclipse

    Yeah, that is the thing with locate. Not sure if you can use ls -l simultaneously, my memory says 'no'.

    10 months, 1 week ago by BigEclipse

  • alexleonard

    So yeah

    find . -name file.ext -exec ls -l {} \;

    works a treat

    :)

    10 months, 1 week ago by alexleonard

  • alexleonard

    @edythemighty: That article you linked to had it right, but for some reason it wasn't working for me unless su'd

    Thanks for the help people :)

    10 months, 1 week ago by alexleonard

Sign in to add a comment