Hide files in Linux without using the dot











up vote
25
down vote

favorite
3












I wish to hide files in Linux without using the dot, since it's possible in Windows.



Is there a way to do this?










share|improve this question




















  • 6




    Keep in mind hiding files (obfuscation) is not replacement for security (restricting access)
    – uSlackr
    Nov 21 '11 at 15:32















up vote
25
down vote

favorite
3












I wish to hide files in Linux without using the dot, since it's possible in Windows.



Is there a way to do this?










share|improve this question




















  • 6




    Keep in mind hiding files (obfuscation) is not replacement for security (restricting access)
    – uSlackr
    Nov 21 '11 at 15:32













up vote
25
down vote

favorite
3









up vote
25
down vote

favorite
3






3





I wish to hide files in Linux without using the dot, since it's possible in Windows.



Is there a way to do this?










share|improve this question















I wish to hide files in Linux without using the dot, since it's possible in Windows.



Is there a way to do this?







linux ubuntu






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '11 at 2:23









3498DB

15.6k114762




15.6k114762










asked Nov 21 '11 at 14:32









aWebDeveloper

4793722




4793722








  • 6




    Keep in mind hiding files (obfuscation) is not replacement for security (restricting access)
    – uSlackr
    Nov 21 '11 at 15:32














  • 6




    Keep in mind hiding files (obfuscation) is not replacement for security (restricting access)
    – uSlackr
    Nov 21 '11 at 15:32








6




6




Keep in mind hiding files (obfuscation) is not replacement for security (restricting access)
– uSlackr
Nov 21 '11 at 15:32




Keep in mind hiding files (obfuscation) is not replacement for security (restricting access)
– uSlackr
Nov 21 '11 at 15:32










9 Answers
9






active

oldest

votes

















up vote
23
down vote













You cannot. There is a fundamental difference in the way the file systems handle hidden settings. In Windows, the file system stores several attributes for the file in metadata, including the attributes "hidden" and "system" (both of which are kinds of hidden files). In common *nix filesystems, no such attribute is stored. Instead, the information must be put somewhere else, such as in the file name. The convention is thus that files beginning with . (and depending on your system, maybe some others like _) will not be shown by most tools by default.



This is purely for convenience, a . beginning a file name means absolutely nothing but "the user probably doesn't want to see this all the time." To make sure that you know, running e.g. ls -a will show all files.



If you don't want to have a file clutter up your listings in Linux, you should rename it to start with a dot (Bonus: this will work for OS X too, if we're talking about a portable device). If you don't want users to be able to find a file, you're doing it wrong - that's what permissions are for.



Unix permissions as they pertain to directories often confuse people, and maybe understanding it better will help you. The "read" and "execute" permissions (r and x) mean something different for directories than they do for files. For directories, the execute x permission determines whether or not you access the inodes in the directory. The read r permission dictates whether or not you can access the listing of the directory. Functionally, x allows the user to do things in a directory, while the r permission allows them to see what's in it. These are different, and the difference can be confusing. Let's look at an example:




jeanluc@login64: ~ $ mkdir example
jeanluc@login64: ~ $ echo "you can read it" > example/file
jeanluc@login64: ~ $ ls example/
file
jeanluc@login64: ~ $ cat example/file
you can read it

jeanluc@login64: ~ $ chmod -x example/
jeanluc@login64: ~ $ ls example/
ls: cannot access example/file: Permission denied
file
jeanluc@login64: ~ $ cat example/file
cat: example/file: Permission denied
jeanluc@login64: ~ $ cd example/
-bash: cd: example/: Permission denied

jeanluc@login64: ~ $ chmod +x example/
jeanluc@login64: ~ $ chmod -r example/
jeanluc@login64: ~ $ ls example/
ls: cannot open directory example/: Permission denied
jeanluc@login64: ~ $ cat example/file
you can read it
jeanluc@login64: ~ $ cd example/
jeanluc@login64: ~/example $ ls
ls: cannot open directory .: Permission denied
jeanluc@login64: ~/example $ cd ..


So, notice that without execute I can still list the files (although ls shows an error because it cannot get the file properties), but I can't change in to the directory or read the files in it. Without read I cannot list the files, but I can still change in to the directory and if I know the name of a file I can still access it.



Do note, though, that removing the read permission only gives you security by obscurity. If the user guesses the file name, they will be able to read its contents.



This may not have really been relevant to your question, I just wanted to make sure you understood directory permissions.






share|improve this answer






























    up vote
    21
    down vote













    Create a file .hidden in the directory with the names of the files to be hidden (one name each line).



    Then add the following to your ~/.bashrc:



    ls () {
    if [ -f .hidden ]; then
    declare GLOBIGNORE="$GLOBIGNORE:.*:$(tr 'n' ':' < .hidden)"
    ls "$@"
    fi
    }


    Now your ls command does not list these files.



    I use this technique to hide my __pycache__ and __init__.py files.









    share|improve this answer























    • it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
      – Jakuje
      Dec 27 '15 at 19:22






    • 1




      code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
      – Rinzwind
      Dec 28 '15 at 14:14




















    up vote
    11
    down vote













    You can actually hide files in Linux without adding a dot. This actually hides them in Nautilus; an ls from the command line will still list the files.




    1. Create a text file named .hidden in the folder where you want to hide the files.

    2. Add the names of the files or folders you want to hide, one per line, to the file.

    3. Refresh your file browser.






    share|improve this answer



















    • 2




      does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
      – Tim Haegele
      Feb 4 '13 at 20:40






    • 2




      Files are hidden in Nautilus; not in ls lists.
      – To Do
      Feb 4 '13 at 21:03






    • 1




      just awesome solution! :)
      – Merianos Nikos
      Dec 9 '17 at 8:42


















    up vote
    4
    down vote













    A dot is used to hide files in linux, and that can not be changed.



    However, you could play with the file permissions to prevent users from being able to have access to given folder/file. Try experimenting with chmod command.






    share|improve this answer




























      up vote
      2
      down vote













      Are you only trying to hide files from your graphical user interface's file manager and/or desktop environment? If so, there might be options beyond simply prefixing the filename with a dot.



      I believe the only additional files hidden by any Linux file manager are backup files, i.e. those ending in a tilde ~ or .bak or whatever they believe is the backup extension. In any case, you are probably in luck if all you wish to do is hide backup files from the file manager.



      Do not give your files a backup extension to hide them or they might get accidentally deleted!!



      As an aside, you can hide files from the Finder in Mac OS X using the command SetFile -a V [file] or editing /.hidden but obviously this won't hide the file from the command line's ls program.






      share|improve this answer

















      • 2




        In OS X you can also hide files by chflags hidden filename.
        – slhck
        Nov 21 '11 at 19:02


















      up vote
      2
      down vote













      If you have some programming skills and if only what you need is hidding filenames for user convinience to stop cluttering the visual space you can hack it!



      I will consider command line tools only, as they are quite uniform and are the only tools constantly used be me.



      There many ways to store this information:





      1. You can store "hidden" extended attribute in selected files. See man attr



          attr -s hidden -V true your_file


      2. Or as mentioned above you can store list of filename in .hidden file



      Important: This will not work out of the box you have to implement the logic, clean systems will just ignore .hidden files and hidden extended attributes!



      Also there are muliple possible implementations:





      1. If you have only few files, write in your .bashrc file



        alias ls='ls -I filename_1 -I filename_2'


        man ls for more information.



      2. Write a function ls such as it handles all the logic behind recognizing
        hidden files and assembling list of all -I entries, and then executing
        /bin/ls with proper ignore flags. Very laborious task, because you have
        to handle all ls parameters properly.



      3. Get sources of coreutils



        git clone git://git.sv.gnu.org/coreutils


        or



        git clone git://git.suckless.org/sbase


        Patch it the way you need to handle your implementation of hidden files.
        And place it in your PATH



        I hacked it in less then 5 minutes using suckless sources and diff is like this:



         diff --git a/ls.c b/ls.c
        index cdfce4d..8197409 100644
        --- a/ls.c
        +++ b/ls.c
        @@ -214,6 +214,17 @@ lsdir(const char *path)
        first = 0;
        while ((d = readdir(dp))) {
        +///////////////////////////////////////////////
        +// Dirty hack to implement hidden files
        +// FIXME: Make proper(!) subroutine
        + char attr_command[1024] = "attr -Lqg hidden "; // Oh, dear. That's bad
        + int attr_code;
        + strcat(attr_command, d->d_name);
        + strcat(attr_command, " >/dev/null 2>&1");
        + attr_code = system(attr_command);
        + if (!attr_code)
        + continue;
        +///////////////////////////////////////////////
        if (d->d_name[0] == '.' && !aflag && !Aflag)
        continue;
        else if (Aflag)







      share|improve this answer





















      • ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
        – Melab
        Oct 3 '15 at 17:54


















      up vote
      2
      down vote













      This is the best solution I have found, add to your profile:



      alias ls="/bin/ls --color=auto --ignore='*.egg-info' --ignore='__pycache__'"


      If you need more patterns just add more --ignore flags.






      share|improve this answer




























        up vote
        2
        down vote













        Nowadays you can write FUSE that hides files according to given config.



        This article makes me believe you need to tweak the getdir function:




        getdir: int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);

        This reads the contents of a directory. This operation is the opendir(), readdir(), …, closedir() sequence in one call. For each directory entry, the filldir() function should be called.




        I'm not a programmer but I imagine one could make getdir omit all files listed in (e.g.) .hidden file. If you implement this correctly then every tool (GUI or not) will be affected.






        share|improve this answer




























          up vote
          1
          down vote













          You can 'hide' the contents of a directory by taking away 'x' perms for the group, or other: chmod go-x directoryname. You could no longer list files, though you could access a file if you knew the exact path. This does not sound like what you want.



          Keep in mind the dotfile thing is a convenience, not really to hide the file for security sake, but to reduce clutter for files during file listing. It's baked into ls and the other tools.






          share|improve this answer





















          • And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
            – Bachsau
            Apr 14 at 20:33











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f359784%2fhide-files-in-linux-without-using-the-dot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          9 Answers
          9






          active

          oldest

          votes








          9 Answers
          9






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          23
          down vote













          You cannot. There is a fundamental difference in the way the file systems handle hidden settings. In Windows, the file system stores several attributes for the file in metadata, including the attributes "hidden" and "system" (both of which are kinds of hidden files). In common *nix filesystems, no such attribute is stored. Instead, the information must be put somewhere else, such as in the file name. The convention is thus that files beginning with . (and depending on your system, maybe some others like _) will not be shown by most tools by default.



          This is purely for convenience, a . beginning a file name means absolutely nothing but "the user probably doesn't want to see this all the time." To make sure that you know, running e.g. ls -a will show all files.



          If you don't want to have a file clutter up your listings in Linux, you should rename it to start with a dot (Bonus: this will work for OS X too, if we're talking about a portable device). If you don't want users to be able to find a file, you're doing it wrong - that's what permissions are for.



          Unix permissions as they pertain to directories often confuse people, and maybe understanding it better will help you. The "read" and "execute" permissions (r and x) mean something different for directories than they do for files. For directories, the execute x permission determines whether or not you access the inodes in the directory. The read r permission dictates whether or not you can access the listing of the directory. Functionally, x allows the user to do things in a directory, while the r permission allows them to see what's in it. These are different, and the difference can be confusing. Let's look at an example:




          jeanluc@login64: ~ $ mkdir example
          jeanluc@login64: ~ $ echo "you can read it" > example/file
          jeanluc@login64: ~ $ ls example/
          file
          jeanluc@login64: ~ $ cat example/file
          you can read it

          jeanluc@login64: ~ $ chmod -x example/
          jeanluc@login64: ~ $ ls example/
          ls: cannot access example/file: Permission denied
          file
          jeanluc@login64: ~ $ cat example/file
          cat: example/file: Permission denied
          jeanluc@login64: ~ $ cd example/
          -bash: cd: example/: Permission denied

          jeanluc@login64: ~ $ chmod +x example/
          jeanluc@login64: ~ $ chmod -r example/
          jeanluc@login64: ~ $ ls example/
          ls: cannot open directory example/: Permission denied
          jeanluc@login64: ~ $ cat example/file
          you can read it
          jeanluc@login64: ~ $ cd example/
          jeanluc@login64: ~/example $ ls
          ls: cannot open directory .: Permission denied
          jeanluc@login64: ~/example $ cd ..


          So, notice that without execute I can still list the files (although ls shows an error because it cannot get the file properties), but I can't change in to the directory or read the files in it. Without read I cannot list the files, but I can still change in to the directory and if I know the name of a file I can still access it.



          Do note, though, that removing the read permission only gives you security by obscurity. If the user guesses the file name, they will be able to read its contents.



          This may not have really been relevant to your question, I just wanted to make sure you understood directory permissions.






          share|improve this answer



























            up vote
            23
            down vote













            You cannot. There is a fundamental difference in the way the file systems handle hidden settings. In Windows, the file system stores several attributes for the file in metadata, including the attributes "hidden" and "system" (both of which are kinds of hidden files). In common *nix filesystems, no such attribute is stored. Instead, the information must be put somewhere else, such as in the file name. The convention is thus that files beginning with . (and depending on your system, maybe some others like _) will not be shown by most tools by default.



            This is purely for convenience, a . beginning a file name means absolutely nothing but "the user probably doesn't want to see this all the time." To make sure that you know, running e.g. ls -a will show all files.



            If you don't want to have a file clutter up your listings in Linux, you should rename it to start with a dot (Bonus: this will work for OS X too, if we're talking about a portable device). If you don't want users to be able to find a file, you're doing it wrong - that's what permissions are for.



            Unix permissions as they pertain to directories often confuse people, and maybe understanding it better will help you. The "read" and "execute" permissions (r and x) mean something different for directories than they do for files. For directories, the execute x permission determines whether or not you access the inodes in the directory. The read r permission dictates whether or not you can access the listing of the directory. Functionally, x allows the user to do things in a directory, while the r permission allows them to see what's in it. These are different, and the difference can be confusing. Let's look at an example:




            jeanluc@login64: ~ $ mkdir example
            jeanluc@login64: ~ $ echo "you can read it" > example/file
            jeanluc@login64: ~ $ ls example/
            file
            jeanluc@login64: ~ $ cat example/file
            you can read it

            jeanluc@login64: ~ $ chmod -x example/
            jeanluc@login64: ~ $ ls example/
            ls: cannot access example/file: Permission denied
            file
            jeanluc@login64: ~ $ cat example/file
            cat: example/file: Permission denied
            jeanluc@login64: ~ $ cd example/
            -bash: cd: example/: Permission denied

            jeanluc@login64: ~ $ chmod +x example/
            jeanluc@login64: ~ $ chmod -r example/
            jeanluc@login64: ~ $ ls example/
            ls: cannot open directory example/: Permission denied
            jeanluc@login64: ~ $ cat example/file
            you can read it
            jeanluc@login64: ~ $ cd example/
            jeanluc@login64: ~/example $ ls
            ls: cannot open directory .: Permission denied
            jeanluc@login64: ~/example $ cd ..


            So, notice that without execute I can still list the files (although ls shows an error because it cannot get the file properties), but I can't change in to the directory or read the files in it. Without read I cannot list the files, but I can still change in to the directory and if I know the name of a file I can still access it.



            Do note, though, that removing the read permission only gives you security by obscurity. If the user guesses the file name, they will be able to read its contents.



            This may not have really been relevant to your question, I just wanted to make sure you understood directory permissions.






            share|improve this answer

























              up vote
              23
              down vote










              up vote
              23
              down vote









              You cannot. There is a fundamental difference in the way the file systems handle hidden settings. In Windows, the file system stores several attributes for the file in metadata, including the attributes "hidden" and "system" (both of which are kinds of hidden files). In common *nix filesystems, no such attribute is stored. Instead, the information must be put somewhere else, such as in the file name. The convention is thus that files beginning with . (and depending on your system, maybe some others like _) will not be shown by most tools by default.



              This is purely for convenience, a . beginning a file name means absolutely nothing but "the user probably doesn't want to see this all the time." To make sure that you know, running e.g. ls -a will show all files.



              If you don't want to have a file clutter up your listings in Linux, you should rename it to start with a dot (Bonus: this will work for OS X too, if we're talking about a portable device). If you don't want users to be able to find a file, you're doing it wrong - that's what permissions are for.



              Unix permissions as they pertain to directories often confuse people, and maybe understanding it better will help you. The "read" and "execute" permissions (r and x) mean something different for directories than they do for files. For directories, the execute x permission determines whether or not you access the inodes in the directory. The read r permission dictates whether or not you can access the listing of the directory. Functionally, x allows the user to do things in a directory, while the r permission allows them to see what's in it. These are different, and the difference can be confusing. Let's look at an example:




              jeanluc@login64: ~ $ mkdir example
              jeanluc@login64: ~ $ echo "you can read it" > example/file
              jeanluc@login64: ~ $ ls example/
              file
              jeanluc@login64: ~ $ cat example/file
              you can read it

              jeanluc@login64: ~ $ chmod -x example/
              jeanluc@login64: ~ $ ls example/
              ls: cannot access example/file: Permission denied
              file
              jeanluc@login64: ~ $ cat example/file
              cat: example/file: Permission denied
              jeanluc@login64: ~ $ cd example/
              -bash: cd: example/: Permission denied

              jeanluc@login64: ~ $ chmod +x example/
              jeanluc@login64: ~ $ chmod -r example/
              jeanluc@login64: ~ $ ls example/
              ls: cannot open directory example/: Permission denied
              jeanluc@login64: ~ $ cat example/file
              you can read it
              jeanluc@login64: ~ $ cd example/
              jeanluc@login64: ~/example $ ls
              ls: cannot open directory .: Permission denied
              jeanluc@login64: ~/example $ cd ..


              So, notice that without execute I can still list the files (although ls shows an error because it cannot get the file properties), but I can't change in to the directory or read the files in it. Without read I cannot list the files, but I can still change in to the directory and if I know the name of a file I can still access it.



              Do note, though, that removing the read permission only gives you security by obscurity. If the user guesses the file name, they will be able to read its contents.



              This may not have really been relevant to your question, I just wanted to make sure you understood directory permissions.






              share|improve this answer














              You cannot. There is a fundamental difference in the way the file systems handle hidden settings. In Windows, the file system stores several attributes for the file in metadata, including the attributes "hidden" and "system" (both of which are kinds of hidden files). In common *nix filesystems, no such attribute is stored. Instead, the information must be put somewhere else, such as in the file name. The convention is thus that files beginning with . (and depending on your system, maybe some others like _) will not be shown by most tools by default.



              This is purely for convenience, a . beginning a file name means absolutely nothing but "the user probably doesn't want to see this all the time." To make sure that you know, running e.g. ls -a will show all files.



              If you don't want to have a file clutter up your listings in Linux, you should rename it to start with a dot (Bonus: this will work for OS X too, if we're talking about a portable device). If you don't want users to be able to find a file, you're doing it wrong - that's what permissions are for.



              Unix permissions as they pertain to directories often confuse people, and maybe understanding it better will help you. The "read" and "execute" permissions (r and x) mean something different for directories than they do for files. For directories, the execute x permission determines whether or not you access the inodes in the directory. The read r permission dictates whether or not you can access the listing of the directory. Functionally, x allows the user to do things in a directory, while the r permission allows them to see what's in it. These are different, and the difference can be confusing. Let's look at an example:




              jeanluc@login64: ~ $ mkdir example
              jeanluc@login64: ~ $ echo "you can read it" > example/file
              jeanluc@login64: ~ $ ls example/
              file
              jeanluc@login64: ~ $ cat example/file
              you can read it

              jeanluc@login64: ~ $ chmod -x example/
              jeanluc@login64: ~ $ ls example/
              ls: cannot access example/file: Permission denied
              file
              jeanluc@login64: ~ $ cat example/file
              cat: example/file: Permission denied
              jeanluc@login64: ~ $ cd example/
              -bash: cd: example/: Permission denied

              jeanluc@login64: ~ $ chmod +x example/
              jeanluc@login64: ~ $ chmod -r example/
              jeanluc@login64: ~ $ ls example/
              ls: cannot open directory example/: Permission denied
              jeanluc@login64: ~ $ cat example/file
              you can read it
              jeanluc@login64: ~ $ cd example/
              jeanluc@login64: ~/example $ ls
              ls: cannot open directory .: Permission denied
              jeanluc@login64: ~/example $ cd ..


              So, notice that without execute I can still list the files (although ls shows an error because it cannot get the file properties), but I can't change in to the directory or read the files in it. Without read I cannot list the files, but I can still change in to the directory and if I know the name of a file I can still access it.



              Do note, though, that removing the read permission only gives you security by obscurity. If the user guesses the file name, they will be able to read its contents.



              This may not have really been relevant to your question, I just wanted to make sure you understood directory permissions.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 31 '12 at 2:17

























              answered Nov 21 '11 at 17:59









              jcrawfordor

              14.6k53049




              14.6k53049
























                  up vote
                  21
                  down vote













                  Create a file .hidden in the directory with the names of the files to be hidden (one name each line).



                  Then add the following to your ~/.bashrc:



                  ls () {
                  if [ -f .hidden ]; then
                  declare GLOBIGNORE="$GLOBIGNORE:.*:$(tr 'n' ':' < .hidden)"
                  ls "$@"
                  fi
                  }


                  Now your ls command does not list these files.



                  I use this technique to hide my __pycache__ and __init__.py files.









                  share|improve this answer























                  • it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
                    – Jakuje
                    Dec 27 '15 at 19:22






                  • 1




                    code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
                    – Rinzwind
                    Dec 28 '15 at 14:14

















                  up vote
                  21
                  down vote













                  Create a file .hidden in the directory with the names of the files to be hidden (one name each line).



                  Then add the following to your ~/.bashrc:



                  ls () {
                  if [ -f .hidden ]; then
                  declare GLOBIGNORE="$GLOBIGNORE:.*:$(tr 'n' ':' < .hidden)"
                  ls "$@"
                  fi
                  }


                  Now your ls command does not list these files.



                  I use this technique to hide my __pycache__ and __init__.py files.









                  share|improve this answer























                  • it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
                    – Jakuje
                    Dec 27 '15 at 19:22






                  • 1




                    code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
                    – Rinzwind
                    Dec 28 '15 at 14:14















                  up vote
                  21
                  down vote










                  up vote
                  21
                  down vote









                  Create a file .hidden in the directory with the names of the files to be hidden (one name each line).



                  Then add the following to your ~/.bashrc:



                  ls () {
                  if [ -f .hidden ]; then
                  declare GLOBIGNORE="$GLOBIGNORE:.*:$(tr 'n' ':' < .hidden)"
                  ls "$@"
                  fi
                  }


                  Now your ls command does not list these files.



                  I use this technique to hide my __pycache__ and __init__.py files.









                  share|improve this answer














                  Create a file .hidden in the directory with the names of the files to be hidden (one name each line).



                  Then add the following to your ~/.bashrc:



                  ls () {
                  if [ -f .hidden ]; then
                  declare GLOBIGNORE="$GLOBIGNORE:.*:$(tr 'n' ':' < .hidden)"
                  ls "$@"
                  fi
                  }


                  Now your ls command does not list these files.



                  I use this technique to hide my __pycache__ and __init__.py files.










                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 26 '17 at 21:11









                  Gilles

                  51.7k13112159




                  51.7k13112159










                  answered Sep 24 '14 at 8:43









                  A Sz

                  31123




                  31123












                  • it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
                    – Jakuje
                    Dec 27 '15 at 19:22






                  • 1




                    code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
                    – Rinzwind
                    Dec 28 '15 at 14:14




















                  • it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
                    – Jakuje
                    Dec 27 '15 at 19:22






                  • 1




                    code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
                    – Rinzwind
                    Dec 28 '15 at 14:14


















                  it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
                  – Jakuje
                  Dec 27 '15 at 19:22




                  it is interesting. Does it work also in the nautilus or other gui tools? Are you able to see the files with ls -al?
                  – Jakuje
                  Dec 27 '15 at 19:22




                  1




                  1




                  code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
                  – Rinzwind
                  Dec 28 '15 at 14:14






                  code is missing a ' " at the end. (and in case you wonder where the upvotes are from: askubuntu.com/a/713591/15811 ) ;-)
                  – Rinzwind
                  Dec 28 '15 at 14:14












                  up vote
                  11
                  down vote













                  You can actually hide files in Linux without adding a dot. This actually hides them in Nautilus; an ls from the command line will still list the files.




                  1. Create a text file named .hidden in the folder where you want to hide the files.

                  2. Add the names of the files or folders you want to hide, one per line, to the file.

                  3. Refresh your file browser.






                  share|improve this answer



















                  • 2




                    does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
                    – Tim Haegele
                    Feb 4 '13 at 20:40






                  • 2




                    Files are hidden in Nautilus; not in ls lists.
                    – To Do
                    Feb 4 '13 at 21:03






                  • 1




                    just awesome solution! :)
                    – Merianos Nikos
                    Dec 9 '17 at 8:42















                  up vote
                  11
                  down vote













                  You can actually hide files in Linux without adding a dot. This actually hides them in Nautilus; an ls from the command line will still list the files.




                  1. Create a text file named .hidden in the folder where you want to hide the files.

                  2. Add the names of the files or folders you want to hide, one per line, to the file.

                  3. Refresh your file browser.






                  share|improve this answer



















                  • 2




                    does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
                    – Tim Haegele
                    Feb 4 '13 at 20:40






                  • 2




                    Files are hidden in Nautilus; not in ls lists.
                    – To Do
                    Feb 4 '13 at 21:03






                  • 1




                    just awesome solution! :)
                    – Merianos Nikos
                    Dec 9 '17 at 8:42













                  up vote
                  11
                  down vote










                  up vote
                  11
                  down vote









                  You can actually hide files in Linux without adding a dot. This actually hides them in Nautilus; an ls from the command line will still list the files.




                  1. Create a text file named .hidden in the folder where you want to hide the files.

                  2. Add the names of the files or folders you want to hide, one per line, to the file.

                  3. Refresh your file browser.






                  share|improve this answer














                  You can actually hide files in Linux without adding a dot. This actually hides them in Nautilus; an ls from the command line will still list the files.




                  1. Create a text file named .hidden in the folder where you want to hide the files.

                  2. Add the names of the files or folders you want to hide, one per line, to the file.

                  3. Refresh your file browser.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 22 '15 at 21:51

























                  answered Feb 4 '13 at 20:06









                  To Do

                  1,08221124




                  1,08221124








                  • 2




                    does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
                    – Tim Haegele
                    Feb 4 '13 at 20:40






                  • 2




                    Files are hidden in Nautilus; not in ls lists.
                    – To Do
                    Feb 4 '13 at 21:03






                  • 1




                    just awesome solution! :)
                    – Merianos Nikos
                    Dec 9 '17 at 8:42














                  • 2




                    does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
                    – Tim Haegele
                    Feb 4 '13 at 20:40






                  • 2




                    Files are hidden in Nautilus; not in ls lists.
                    – To Do
                    Feb 4 '13 at 21:03






                  • 1




                    just awesome solution! :)
                    – Merianos Nikos
                    Dec 9 '17 at 8:42








                  2




                  2




                  does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
                  – Tim Haegele
                  Feb 4 '13 at 20:40




                  does not work here with "ls" in debian 5.0. Is it specific to nautilus or dolphin or ...?
                  – Tim Haegele
                  Feb 4 '13 at 20:40




                  2




                  2




                  Files are hidden in Nautilus; not in ls lists.
                  – To Do
                  Feb 4 '13 at 21:03




                  Files are hidden in Nautilus; not in ls lists.
                  – To Do
                  Feb 4 '13 at 21:03




                  1




                  1




                  just awesome solution! :)
                  – Merianos Nikos
                  Dec 9 '17 at 8:42




                  just awesome solution! :)
                  – Merianos Nikos
                  Dec 9 '17 at 8:42










                  up vote
                  4
                  down vote













                  A dot is used to hide files in linux, and that can not be changed.



                  However, you could play with the file permissions to prevent users from being able to have access to given folder/file. Try experimenting with chmod command.






                  share|improve this answer

























                    up vote
                    4
                    down vote













                    A dot is used to hide files in linux, and that can not be changed.



                    However, you could play with the file permissions to prevent users from being able to have access to given folder/file. Try experimenting with chmod command.






                    share|improve this answer























                      up vote
                      4
                      down vote










                      up vote
                      4
                      down vote









                      A dot is used to hide files in linux, and that can not be changed.



                      However, you could play with the file permissions to prevent users from being able to have access to given folder/file. Try experimenting with chmod command.






                      share|improve this answer












                      A dot is used to hide files in linux, and that can not be changed.



                      However, you could play with the file permissions to prevent users from being able to have access to given folder/file. Try experimenting with chmod command.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 21 '11 at 15:24









                      bbaja42

                      2,43411930




                      2,43411930






















                          up vote
                          2
                          down vote













                          Are you only trying to hide files from your graphical user interface's file manager and/or desktop environment? If so, there might be options beyond simply prefixing the filename with a dot.



                          I believe the only additional files hidden by any Linux file manager are backup files, i.e. those ending in a tilde ~ or .bak or whatever they believe is the backup extension. In any case, you are probably in luck if all you wish to do is hide backup files from the file manager.



                          Do not give your files a backup extension to hide them or they might get accidentally deleted!!



                          As an aside, you can hide files from the Finder in Mac OS X using the command SetFile -a V [file] or editing /.hidden but obviously this won't hide the file from the command line's ls program.






                          share|improve this answer

















                          • 2




                            In OS X you can also hide files by chflags hidden filename.
                            – slhck
                            Nov 21 '11 at 19:02















                          up vote
                          2
                          down vote













                          Are you only trying to hide files from your graphical user interface's file manager and/or desktop environment? If so, there might be options beyond simply prefixing the filename with a dot.



                          I believe the only additional files hidden by any Linux file manager are backup files, i.e. those ending in a tilde ~ or .bak or whatever they believe is the backup extension. In any case, you are probably in luck if all you wish to do is hide backup files from the file manager.



                          Do not give your files a backup extension to hide them or they might get accidentally deleted!!



                          As an aside, you can hide files from the Finder in Mac OS X using the command SetFile -a V [file] or editing /.hidden but obviously this won't hide the file from the command line's ls program.






                          share|improve this answer

















                          • 2




                            In OS X you can also hide files by chflags hidden filename.
                            – slhck
                            Nov 21 '11 at 19:02













                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          Are you only trying to hide files from your graphical user interface's file manager and/or desktop environment? If so, there might be options beyond simply prefixing the filename with a dot.



                          I believe the only additional files hidden by any Linux file manager are backup files, i.e. those ending in a tilde ~ or .bak or whatever they believe is the backup extension. In any case, you are probably in luck if all you wish to do is hide backup files from the file manager.



                          Do not give your files a backup extension to hide them or they might get accidentally deleted!!



                          As an aside, you can hide files from the Finder in Mac OS X using the command SetFile -a V [file] or editing /.hidden but obviously this won't hide the file from the command line's ls program.






                          share|improve this answer












                          Are you only trying to hide files from your graphical user interface's file manager and/or desktop environment? If so, there might be options beyond simply prefixing the filename with a dot.



                          I believe the only additional files hidden by any Linux file manager are backup files, i.e. those ending in a tilde ~ or .bak or whatever they believe is the backup extension. In any case, you are probably in luck if all you wish to do is hide backup files from the file manager.



                          Do not give your files a backup extension to hide them or they might get accidentally deleted!!



                          As an aside, you can hide files from the Finder in Mac OS X using the command SetFile -a V [file] or editing /.hidden but obviously this won't hide the file from the command line's ls program.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 21 '11 at 18:47









                          Jeff Burdges

                          1666




                          1666








                          • 2




                            In OS X you can also hide files by chflags hidden filename.
                            – slhck
                            Nov 21 '11 at 19:02














                          • 2




                            In OS X you can also hide files by chflags hidden filename.
                            – slhck
                            Nov 21 '11 at 19:02








                          2




                          2




                          In OS X you can also hide files by chflags hidden filename.
                          – slhck
                          Nov 21 '11 at 19:02




                          In OS X you can also hide files by chflags hidden filename.
                          – slhck
                          Nov 21 '11 at 19:02










                          up vote
                          2
                          down vote













                          If you have some programming skills and if only what you need is hidding filenames for user convinience to stop cluttering the visual space you can hack it!



                          I will consider command line tools only, as they are quite uniform and are the only tools constantly used be me.



                          There many ways to store this information:





                          1. You can store "hidden" extended attribute in selected files. See man attr



                              attr -s hidden -V true your_file


                          2. Or as mentioned above you can store list of filename in .hidden file



                          Important: This will not work out of the box you have to implement the logic, clean systems will just ignore .hidden files and hidden extended attributes!



                          Also there are muliple possible implementations:





                          1. If you have only few files, write in your .bashrc file



                            alias ls='ls -I filename_1 -I filename_2'


                            man ls for more information.



                          2. Write a function ls such as it handles all the logic behind recognizing
                            hidden files and assembling list of all -I entries, and then executing
                            /bin/ls with proper ignore flags. Very laborious task, because you have
                            to handle all ls parameters properly.



                          3. Get sources of coreutils



                            git clone git://git.sv.gnu.org/coreutils


                            or



                            git clone git://git.suckless.org/sbase


                            Patch it the way you need to handle your implementation of hidden files.
                            And place it in your PATH



                            I hacked it in less then 5 minutes using suckless sources and diff is like this:



                             diff --git a/ls.c b/ls.c
                            index cdfce4d..8197409 100644
                            --- a/ls.c
                            +++ b/ls.c
                            @@ -214,6 +214,17 @@ lsdir(const char *path)
                            first = 0;
                            while ((d = readdir(dp))) {
                            +///////////////////////////////////////////////
                            +// Dirty hack to implement hidden files
                            +// FIXME: Make proper(!) subroutine
                            + char attr_command[1024] = "attr -Lqg hidden "; // Oh, dear. That's bad
                            + int attr_code;
                            + strcat(attr_command, d->d_name);
                            + strcat(attr_command, " >/dev/null 2>&1");
                            + attr_code = system(attr_command);
                            + if (!attr_code)
                            + continue;
                            +///////////////////////////////////////////////
                            if (d->d_name[0] == '.' && !aflag && !Aflag)
                            continue;
                            else if (Aflag)







                          share|improve this answer





















                          • ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
                            – Melab
                            Oct 3 '15 at 17:54















                          up vote
                          2
                          down vote













                          If you have some programming skills and if only what you need is hidding filenames for user convinience to stop cluttering the visual space you can hack it!



                          I will consider command line tools only, as they are quite uniform and are the only tools constantly used be me.



                          There many ways to store this information:





                          1. You can store "hidden" extended attribute in selected files. See man attr



                              attr -s hidden -V true your_file


                          2. Or as mentioned above you can store list of filename in .hidden file



                          Important: This will not work out of the box you have to implement the logic, clean systems will just ignore .hidden files and hidden extended attributes!



                          Also there are muliple possible implementations:





                          1. If you have only few files, write in your .bashrc file



                            alias ls='ls -I filename_1 -I filename_2'


                            man ls for more information.



                          2. Write a function ls such as it handles all the logic behind recognizing
                            hidden files and assembling list of all -I entries, and then executing
                            /bin/ls with proper ignore flags. Very laborious task, because you have
                            to handle all ls parameters properly.



                          3. Get sources of coreutils



                            git clone git://git.sv.gnu.org/coreutils


                            or



                            git clone git://git.suckless.org/sbase


                            Patch it the way you need to handle your implementation of hidden files.
                            And place it in your PATH



                            I hacked it in less then 5 minutes using suckless sources and diff is like this:



                             diff --git a/ls.c b/ls.c
                            index cdfce4d..8197409 100644
                            --- a/ls.c
                            +++ b/ls.c
                            @@ -214,6 +214,17 @@ lsdir(const char *path)
                            first = 0;
                            while ((d = readdir(dp))) {
                            +///////////////////////////////////////////////
                            +// Dirty hack to implement hidden files
                            +// FIXME: Make proper(!) subroutine
                            + char attr_command[1024] = "attr -Lqg hidden "; // Oh, dear. That's bad
                            + int attr_code;
                            + strcat(attr_command, d->d_name);
                            + strcat(attr_command, " >/dev/null 2>&1");
                            + attr_code = system(attr_command);
                            + if (!attr_code)
                            + continue;
                            +///////////////////////////////////////////////
                            if (d->d_name[0] == '.' && !aflag && !Aflag)
                            continue;
                            else if (Aflag)







                          share|improve this answer





















                          • ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
                            – Melab
                            Oct 3 '15 at 17:54













                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          If you have some programming skills and if only what you need is hidding filenames for user convinience to stop cluttering the visual space you can hack it!



                          I will consider command line tools only, as they are quite uniform and are the only tools constantly used be me.



                          There many ways to store this information:





                          1. You can store "hidden" extended attribute in selected files. See man attr



                              attr -s hidden -V true your_file


                          2. Or as mentioned above you can store list of filename in .hidden file



                          Important: This will not work out of the box you have to implement the logic, clean systems will just ignore .hidden files and hidden extended attributes!



                          Also there are muliple possible implementations:





                          1. If you have only few files, write in your .bashrc file



                            alias ls='ls -I filename_1 -I filename_2'


                            man ls for more information.



                          2. Write a function ls such as it handles all the logic behind recognizing
                            hidden files and assembling list of all -I entries, and then executing
                            /bin/ls with proper ignore flags. Very laborious task, because you have
                            to handle all ls parameters properly.



                          3. Get sources of coreutils



                            git clone git://git.sv.gnu.org/coreutils


                            or



                            git clone git://git.suckless.org/sbase


                            Patch it the way you need to handle your implementation of hidden files.
                            And place it in your PATH



                            I hacked it in less then 5 minutes using suckless sources and diff is like this:



                             diff --git a/ls.c b/ls.c
                            index cdfce4d..8197409 100644
                            --- a/ls.c
                            +++ b/ls.c
                            @@ -214,6 +214,17 @@ lsdir(const char *path)
                            first = 0;
                            while ((d = readdir(dp))) {
                            +///////////////////////////////////////////////
                            +// Dirty hack to implement hidden files
                            +// FIXME: Make proper(!) subroutine
                            + char attr_command[1024] = "attr -Lqg hidden "; // Oh, dear. That's bad
                            + int attr_code;
                            + strcat(attr_command, d->d_name);
                            + strcat(attr_command, " >/dev/null 2>&1");
                            + attr_code = system(attr_command);
                            + if (!attr_code)
                            + continue;
                            +///////////////////////////////////////////////
                            if (d->d_name[0] == '.' && !aflag && !Aflag)
                            continue;
                            else if (Aflag)







                          share|improve this answer












                          If you have some programming skills and if only what you need is hidding filenames for user convinience to stop cluttering the visual space you can hack it!



                          I will consider command line tools only, as they are quite uniform and are the only tools constantly used be me.



                          There many ways to store this information:





                          1. You can store "hidden" extended attribute in selected files. See man attr



                              attr -s hidden -V true your_file


                          2. Or as mentioned above you can store list of filename in .hidden file



                          Important: This will not work out of the box you have to implement the logic, clean systems will just ignore .hidden files and hidden extended attributes!



                          Also there are muliple possible implementations:





                          1. If you have only few files, write in your .bashrc file



                            alias ls='ls -I filename_1 -I filename_2'


                            man ls for more information.



                          2. Write a function ls such as it handles all the logic behind recognizing
                            hidden files and assembling list of all -I entries, and then executing
                            /bin/ls with proper ignore flags. Very laborious task, because you have
                            to handle all ls parameters properly.



                          3. Get sources of coreutils



                            git clone git://git.sv.gnu.org/coreutils


                            or



                            git clone git://git.suckless.org/sbase


                            Patch it the way you need to handle your implementation of hidden files.
                            And place it in your PATH



                            I hacked it in less then 5 minutes using suckless sources and diff is like this:



                             diff --git a/ls.c b/ls.c
                            index cdfce4d..8197409 100644
                            --- a/ls.c
                            +++ b/ls.c
                            @@ -214,6 +214,17 @@ lsdir(const char *path)
                            first = 0;
                            while ((d = readdir(dp))) {
                            +///////////////////////////////////////////////
                            +// Dirty hack to implement hidden files
                            +// FIXME: Make proper(!) subroutine
                            + char attr_command[1024] = "attr -Lqg hidden "; // Oh, dear. That's bad
                            + int attr_code;
                            + strcat(attr_command, d->d_name);
                            + strcat(attr_command, " >/dev/null 2>&1");
                            + attr_code = system(attr_command);
                            + if (!attr_code)
                            + continue;
                            +///////////////////////////////////////////////
                            if (d->d_name[0] == '.' && !aflag && !Aflag)
                            continue;
                            else if (Aflag)








                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 14 '15 at 10:24









                          Aleksy Grabowski

                          211




                          211












                          • ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
                            – Melab
                            Oct 3 '15 at 17:54


















                          • ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
                            – Melab
                            Oct 3 '15 at 17:54
















                          ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
                          – Melab
                          Oct 3 '15 at 17:54




                          ls.c lies in src, not the root directory, and there is no function lsdir in ls.c.
                          – Melab
                          Oct 3 '15 at 17:54










                          up vote
                          2
                          down vote













                          This is the best solution I have found, add to your profile:



                          alias ls="/bin/ls --color=auto --ignore='*.egg-info' --ignore='__pycache__'"


                          If you need more patterns just add more --ignore flags.






                          share|improve this answer

























                            up vote
                            2
                            down vote













                            This is the best solution I have found, add to your profile:



                            alias ls="/bin/ls --color=auto --ignore='*.egg-info' --ignore='__pycache__'"


                            If you need more patterns just add more --ignore flags.






                            share|improve this answer























                              up vote
                              2
                              down vote










                              up vote
                              2
                              down vote









                              This is the best solution I have found, add to your profile:



                              alias ls="/bin/ls --color=auto --ignore='*.egg-info' --ignore='__pycache__'"


                              If you need more patterns just add more --ignore flags.






                              share|improve this answer












                              This is the best solution I have found, add to your profile:



                              alias ls="/bin/ls --color=auto --ignore='*.egg-info' --ignore='__pycache__'"


                              If you need more patterns just add more --ignore flags.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jan 27 '16 at 21:40









                              jsmedmar

                              1213




                              1213






















                                  up vote
                                  2
                                  down vote













                                  Nowadays you can write FUSE that hides files according to given config.



                                  This article makes me believe you need to tweak the getdir function:




                                  getdir: int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);

                                  This reads the contents of a directory. This operation is the opendir(), readdir(), …, closedir() sequence in one call. For each directory entry, the filldir() function should be called.




                                  I'm not a programmer but I imagine one could make getdir omit all files listed in (e.g.) .hidden file. If you implement this correctly then every tool (GUI or not) will be affected.






                                  share|improve this answer

























                                    up vote
                                    2
                                    down vote













                                    Nowadays you can write FUSE that hides files according to given config.



                                    This article makes me believe you need to tweak the getdir function:




                                    getdir: int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);

                                    This reads the contents of a directory. This operation is the opendir(), readdir(), …, closedir() sequence in one call. For each directory entry, the filldir() function should be called.




                                    I'm not a programmer but I imagine one could make getdir omit all files listed in (e.g.) .hidden file. If you implement this correctly then every tool (GUI or not) will be affected.






                                    share|improve this answer























                                      up vote
                                      2
                                      down vote










                                      up vote
                                      2
                                      down vote









                                      Nowadays you can write FUSE that hides files according to given config.



                                      This article makes me believe you need to tweak the getdir function:




                                      getdir: int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);

                                      This reads the contents of a directory. This operation is the opendir(), readdir(), …, closedir() sequence in one call. For each directory entry, the filldir() function should be called.




                                      I'm not a programmer but I imagine one could make getdir omit all files listed in (e.g.) .hidden file. If you implement this correctly then every tool (GUI or not) will be affected.






                                      share|improve this answer












                                      Nowadays you can write FUSE that hides files according to given config.



                                      This article makes me believe you need to tweak the getdir function:




                                      getdir: int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);

                                      This reads the contents of a directory. This operation is the opendir(), readdir(), …, closedir() sequence in one call. For each directory entry, the filldir() function should be called.




                                      I'm not a programmer but I imagine one could make getdir omit all files listed in (e.g.) .hidden file. If you implement this correctly then every tool (GUI or not) will be affected.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Feb 26 '17 at 22:36









                                      Kamil Maciorowski

                                      22.6k155072




                                      22.6k155072






















                                          up vote
                                          1
                                          down vote













                                          You can 'hide' the contents of a directory by taking away 'x' perms for the group, or other: chmod go-x directoryname. You could no longer list files, though you could access a file if you knew the exact path. This does not sound like what you want.



                                          Keep in mind the dotfile thing is a convenience, not really to hide the file for security sake, but to reduce clutter for files during file listing. It's baked into ls and the other tools.






                                          share|improve this answer





















                                          • And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
                                            – Bachsau
                                            Apr 14 at 20:33















                                          up vote
                                          1
                                          down vote













                                          You can 'hide' the contents of a directory by taking away 'x' perms for the group, or other: chmod go-x directoryname. You could no longer list files, though you could access a file if you knew the exact path. This does not sound like what you want.



                                          Keep in mind the dotfile thing is a convenience, not really to hide the file for security sake, but to reduce clutter for files during file listing. It's baked into ls and the other tools.






                                          share|improve this answer





















                                          • And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
                                            – Bachsau
                                            Apr 14 at 20:33













                                          up vote
                                          1
                                          down vote










                                          up vote
                                          1
                                          down vote









                                          You can 'hide' the contents of a directory by taking away 'x' perms for the group, or other: chmod go-x directoryname. You could no longer list files, though you could access a file if you knew the exact path. This does not sound like what you want.



                                          Keep in mind the dotfile thing is a convenience, not really to hide the file for security sake, but to reduce clutter for files during file listing. It's baked into ls and the other tools.






                                          share|improve this answer












                                          You can 'hide' the contents of a directory by taking away 'x' perms for the group, or other: chmod go-x directoryname. You could no longer list files, though you could access a file if you knew the exact path. This does not sound like what you want.



                                          Keep in mind the dotfile thing is a convenience, not really to hide the file for security sake, but to reduce clutter for files during file listing. It's baked into ls and the other tools.







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Nov 21 '11 at 15:40









                                          Rich Homolka

                                          24.9k64366




                                          24.9k64366












                                          • And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
                                            – Bachsau
                                            Apr 14 at 20:33


















                                          • And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
                                            – Bachsau
                                            Apr 14 at 20:33
















                                          And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
                                          – Bachsau
                                          Apr 14 at 20:33




                                          And it is also untrue. While removing read permissions from a directory stops you from listing its contents, removing the execute permission will deny any access to the directory at all. When you don't have permission to execute a directory, you won't have access to anything beyond it. Not even if there's a subdirectory with full rights in it and you know its path.
                                          – Bachsau
                                          Apr 14 at 20:33


















                                           

                                          draft saved


                                          draft discarded



















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f359784%2fhide-files-in-linux-without-using-the-dot%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Index of /

                                          Tribalistas

                                          Listed building