How can I hide directories or files without changing their names?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







50















The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly.



How can I hide directories without using the dot notation?










share|improve this question

























  • Do I understand it right? You want folders that do not start with . to be hidden?

    – txwikinger
    Aug 12 '10 at 13:32











  • No i would like to hide files without using the . to hide them

    – myusuf3
    Aug 12 '10 at 13:33













  • Yeah. That's what I actually meant. You expressed it better.

    – txwikinger
    Aug 12 '10 at 13:52


















50















The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly.



How can I hide directories without using the dot notation?










share|improve this question

























  • Do I understand it right? You want folders that do not start with . to be hidden?

    – txwikinger
    Aug 12 '10 at 13:32











  • No i would like to hide files without using the . to hide them

    – myusuf3
    Aug 12 '10 at 13:33













  • Yeah. That's what I actually meant. You expressed it better.

    – txwikinger
    Aug 12 '10 at 13:52














50












50








50


13






The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly.



How can I hide directories without using the dot notation?










share|improve this question
















The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly.



How can I hide directories without using the dot notation?







gui directory hidden-files






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 20 '18 at 11:57









pomsky

33.3k11104136




33.3k11104136










asked Aug 12 '10 at 13:27









myusuf3myusuf3

13.5k338099




13.5k338099













  • Do I understand it right? You want folders that do not start with . to be hidden?

    – txwikinger
    Aug 12 '10 at 13:32











  • No i would like to hide files without using the . to hide them

    – myusuf3
    Aug 12 '10 at 13:33













  • Yeah. That's what I actually meant. You expressed it better.

    – txwikinger
    Aug 12 '10 at 13:52



















  • Do I understand it right? You want folders that do not start with . to be hidden?

    – txwikinger
    Aug 12 '10 at 13:32











  • No i would like to hide files without using the . to hide them

    – myusuf3
    Aug 12 '10 at 13:33













  • Yeah. That's what I actually meant. You expressed it better.

    – txwikinger
    Aug 12 '10 at 13:52

















Do I understand it right? You want folders that do not start with . to be hidden?

– txwikinger
Aug 12 '10 at 13:32





Do I understand it right? You want folders that do not start with . to be hidden?

– txwikinger
Aug 12 '10 at 13:32













No i would like to hide files without using the . to hide them

– myusuf3
Aug 12 '10 at 13:33







No i would like to hide files without using the . to hide them

– myusuf3
Aug 12 '10 at 13:33















Yeah. That's what I actually meant. You expressed it better.

– txwikinger
Aug 12 '10 at 13:52





Yeah. That's what I actually meant. You expressed it better.

– txwikinger
Aug 12 '10 at 13:52










6 Answers
6






active

oldest

votes


















79














Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.



There is another way to hide files from appearing in nautilus. If you create a file called .hidden inside of a directory, any filename listed in the file will not be displayed.



For example, below is a .hidden file that I created. This file will hide any files or folders named b or e located in the same directory as the .hidden file.



Example .hidden File



Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files: a, c, and f. You do not see the .hidden file due to the '.' at the beginning of its name.
Example Folder



The screenshot below is of the same folder as before. However, this time, I hit Ctrl+H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a '.'. There are also now files called 'b' and 'e', which although not having names beginning with a '.', were hidden due to being listed in the .hidden file.



Example Folders With Hidden Files Visible



Files mentioned in the .hidden file will only be hidden in nautilus. Tools like ls will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.



Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.






share|improve this answer



















  • 4





    Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

    – LFC_fan
    Nov 5 '10 at 23:48













  • +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

    – Anwar
    Sep 8 '12 at 6:49











  • +1 - Cool.... And I am haappy to give you 50th upvote.

    – Abid Rahman K
    Dec 13 '14 at 6:54



















13














Unix and Linux only supports hiding folders that being with a ..



If you really want to get them out of the way, but want them to not have .s, put them all in a .hidden in the same directory as the file or folder you want to hide. .hidden will not be exposed by the file manager, and your files will not have a name change.






share|improve this answer





















  • 1





    i would so like to keep them in the same place :)

    – myusuf3
    Aug 12 '10 at 13:54






  • 1





    this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

    – jumpnett
    Aug 12 '10 at 14:59






  • 1





    @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

    – invert
    Aug 31 '10 at 13:33



















3














From the command line you could try something like this in your .bash_aliases file:



lsh() {
[ -s .hidden ] && echo "lsh: hiding $(wc -l .hidden) patterns" && ls $@ | grep -v -F "$(cat .hidden)";
[ ! -f .hidden ] && ls $@
}


This adds a new command lsh that behaves like ls, but hides files listed in a .hidden directory. (It also is missing some of its features like colorized output and column listings.)






share|improve this answer

































    2














    If you want to hide files, you are only left with renaming them with a preceding ., as is *NIX convention. Sorry, but that's it.



    However, if you would like to hide the content of the files/directories, you can do so with file permissions.



    So say you have a bunch of files in a folder called secret_stash, you could change it so that only you (the owner) have r-x (read, execute) and everyone else has nothing --- (no access). Since r-x is the minimum perms needed to view a directory (read to access its contents and execute to be able to see them), anything inside of that folder is effectively hidden from everyone but root.



    NOTE: I'm running this demo as root, and trying to access the folder as myuser



    To do this you run chmod 700 dirname (700 means rwx------):



    % mkdir secret_stash
    % chmod 700 secret_stash


    And here it is:



    % whoami
    root
    % ls -ld secret_stash
    drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
    % ls secret_stash
    ./ ../ secret.txt
    % cat secret_stash/secret.txt
    TOP SECRET DATA


    Now and if I try to access it from myuser, attempts to access the folder or its contents fail:



    % whoami
    myuser
    % ls -ld secret_stash
    drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
    % ls secret_stash
    ls: cannot open directory secret_stash: Permission denied
    % cat secret_stash/secret.txt
    cat: secret_stash/secret.txt: Permission denied


    And now I've said the word "secret" so many times it's lost all meaning!!






    share|improve this answer



















    • 2





      You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

      – Marco Ceppi
      Aug 12 '10 at 15:41











    • @Marco Ceppi - ULTIMATE SECRECY!

      – jathanism
      Aug 12 '10 at 18:22











    • Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

      – Marco Ceppi
      Aug 12 '10 at 18:28






    • 2





      @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

      – Lie Ryan
      Jun 26 '12 at 4:24





















    2














    1st off: if you want to hide a file from anyone: install a linux intrusion detection system. (Snort is an example) You can even hide a file from "root" but "root" will also be able to revert those setting.





    But it might be easier to just set the permissions of the directory that holds the file to "root". Example:



     $ sudo su
    # mkdir tmp/
    # touch tmp/1
    # chown root:root tmp
    # chmod 000 tmp
    # ls -l
    total 4
    d--------- 2 root root 4096 2015-08-07 06:36 tmp
    # exit
    exit
    $ ls
    tmp
    $ cd tmp/
    bash: cd: tmp/: Permission denied


    And the file 1 is effectively hidden from view.



    Directory will be visible; file will not be visible.
    Mind though: "root" will ALWAYS have access to any file.





    Together with the chattr you can even make the file immutable.



    sudo su    
    chattr + i {file}


    and even "root" can not alter the file -unless- the chattr is reverted (and yes "root" can do that).




    Any Keyboard Shortcut for that?




    No, this is something you need to do manually.






    share|improve this answer

































      0














      There's also an extension for Nautilus called nautilus-hide that will allow you to hide any file or folder with a simple right-click on them.



      To install this extension :
      sudo apt-get install nautilus-hide in a terminal,
      or search for "nautilus hide" in the Ubuntu Software Center.



      Don't forget to quit Nautilus after installation : Alt+F2 and type nautilus -q.






      share|improve this answer


























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        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',
        autoActivateHeartbeat: false,
        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%2faskubuntu.com%2fquestions%2f2034%2fhow-can-i-hide-directories-or-files-without-changing-their-names%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        79














        Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.



        There is another way to hide files from appearing in nautilus. If you create a file called .hidden inside of a directory, any filename listed in the file will not be displayed.



        For example, below is a .hidden file that I created. This file will hide any files or folders named b or e located in the same directory as the .hidden file.



        Example .hidden File



        Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files: a, c, and f. You do not see the .hidden file due to the '.' at the beginning of its name.
        Example Folder



        The screenshot below is of the same folder as before. However, this time, I hit Ctrl+H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a '.'. There are also now files called 'b' and 'e', which although not having names beginning with a '.', were hidden due to being listed in the .hidden file.



        Example Folders With Hidden Files Visible



        Files mentioned in the .hidden file will only be hidden in nautilus. Tools like ls will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.



        Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.






        share|improve this answer



















        • 4





          Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

          – LFC_fan
          Nov 5 '10 at 23:48













        • +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

          – Anwar
          Sep 8 '12 at 6:49











        • +1 - Cool.... And I am haappy to give you 50th upvote.

          – Abid Rahman K
          Dec 13 '14 at 6:54
















        79














        Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.



        There is another way to hide files from appearing in nautilus. If you create a file called .hidden inside of a directory, any filename listed in the file will not be displayed.



        For example, below is a .hidden file that I created. This file will hide any files or folders named b or e located in the same directory as the .hidden file.



        Example .hidden File



        Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files: a, c, and f. You do not see the .hidden file due to the '.' at the beginning of its name.
        Example Folder



        The screenshot below is of the same folder as before. However, this time, I hit Ctrl+H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a '.'. There are also now files called 'b' and 'e', which although not having names beginning with a '.', were hidden due to being listed in the .hidden file.



        Example Folders With Hidden Files Visible



        Files mentioned in the .hidden file will only be hidden in nautilus. Tools like ls will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.



        Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.






        share|improve this answer



















        • 4





          Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

          – LFC_fan
          Nov 5 '10 at 23:48













        • +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

          – Anwar
          Sep 8 '12 at 6:49











        • +1 - Cool.... And I am haappy to give you 50th upvote.

          – Abid Rahman K
          Dec 13 '14 at 6:54














        79












        79








        79







        Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.



        There is another way to hide files from appearing in nautilus. If you create a file called .hidden inside of a directory, any filename listed in the file will not be displayed.



        For example, below is a .hidden file that I created. This file will hide any files or folders named b or e located in the same directory as the .hidden file.



        Example .hidden File



        Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files: a, c, and f. You do not see the .hidden file due to the '.' at the beginning of its name.
        Example Folder



        The screenshot below is of the same folder as before. However, this time, I hit Ctrl+H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a '.'. There are also now files called 'b' and 'e', which although not having names beginning with a '.', were hidden due to being listed in the .hidden file.



        Example Folders With Hidden Files Visible



        Files mentioned in the .hidden file will only be hidden in nautilus. Tools like ls will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.



        Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.






        share|improve this answer













        Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.



        There is another way to hide files from appearing in nautilus. If you create a file called .hidden inside of a directory, any filename listed in the file will not be displayed.



        For example, below is a .hidden file that I created. This file will hide any files or folders named b or e located in the same directory as the .hidden file.



        Example .hidden File



        Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files: a, c, and f. You do not see the .hidden file due to the '.' at the beginning of its name.
        Example Folder



        The screenshot below is of the same folder as before. However, this time, I hit Ctrl+H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a '.'. There are also now files called 'b' and 'e', which although not having names beginning with a '.', were hidden due to being listed in the .hidden file.



        Example Folders With Hidden Files Visible



        Files mentioned in the .hidden file will only be hidden in nautilus. Tools like ls will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.



        Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 16 '10 at 18:21









        nhandlernhandler

        2,4181712




        2,4181712








        • 4





          Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

          – LFC_fan
          Nov 5 '10 at 23:48













        • +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

          – Anwar
          Sep 8 '12 at 6:49











        • +1 - Cool.... And I am haappy to give you 50th upvote.

          – Abid Rahman K
          Dec 13 '14 at 6:54














        • 4





          Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

          – LFC_fan
          Nov 5 '10 at 23:48













        • +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

          – Anwar
          Sep 8 '12 at 6:49











        • +1 - Cool.... And I am haappy to give you 50th upvote.

          – Abid Rahman K
          Dec 13 '14 at 6:54








        4




        4





        Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

        – LFC_fan
        Nov 5 '10 at 23:48







        Wow that's nice. Hides files in Nautilus pretty well. This should be voted as the answer really.

        – LFC_fan
        Nov 5 '10 at 23:48















        +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

        – Anwar
        Sep 8 '12 at 6:49





        +1. Just a note, IF you think you have to add ' for file or folder name which contains ` ` space, it is not. Simply add the file or folder name

        – Anwar
        Sep 8 '12 at 6:49













        +1 - Cool.... And I am haappy to give you 50th upvote.

        – Abid Rahman K
        Dec 13 '14 at 6:54





        +1 - Cool.... And I am haappy to give you 50th upvote.

        – Abid Rahman K
        Dec 13 '14 at 6:54













        13














        Unix and Linux only supports hiding folders that being with a ..



        If you really want to get them out of the way, but want them to not have .s, put them all in a .hidden in the same directory as the file or folder you want to hide. .hidden will not be exposed by the file manager, and your files will not have a name change.






        share|improve this answer





















        • 1





          i would so like to keep them in the same place :)

          – myusuf3
          Aug 12 '10 at 13:54






        • 1





          this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

          – jumpnett
          Aug 12 '10 at 14:59






        • 1





          @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

          – invert
          Aug 31 '10 at 13:33
















        13














        Unix and Linux only supports hiding folders that being with a ..



        If you really want to get them out of the way, but want them to not have .s, put them all in a .hidden in the same directory as the file or folder you want to hide. .hidden will not be exposed by the file manager, and your files will not have a name change.






        share|improve this answer





















        • 1





          i would so like to keep them in the same place :)

          – myusuf3
          Aug 12 '10 at 13:54






        • 1





          this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

          – jumpnett
          Aug 12 '10 at 14:59






        • 1





          @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

          – invert
          Aug 31 '10 at 13:33














        13












        13








        13







        Unix and Linux only supports hiding folders that being with a ..



        If you really want to get them out of the way, but want them to not have .s, put them all in a .hidden in the same directory as the file or folder you want to hide. .hidden will not be exposed by the file manager, and your files will not have a name change.






        share|improve this answer















        Unix and Linux only supports hiding folders that being with a ..



        If you really want to get them out of the way, but want them to not have .s, put them all in a .hidden in the same directory as the file or folder you want to hide. .hidden will not be exposed by the file manager, and your files will not have a name change.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 8 '12 at 6:53









        Anwar

        57.5k22149255




        57.5k22149255










        answered Aug 12 '10 at 13:35









        lfaraonelfaraone

        4,20912031




        4,20912031








        • 1





          i would so like to keep them in the same place :)

          – myusuf3
          Aug 12 '10 at 13:54






        • 1





          this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

          – jumpnett
          Aug 12 '10 at 14:59






        • 1





          @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

          – invert
          Aug 31 '10 at 13:33














        • 1





          i would so like to keep them in the same place :)

          – myusuf3
          Aug 12 '10 at 13:54






        • 1





          this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

          – jumpnett
          Aug 12 '10 at 14:59






        • 1





          @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

          – invert
          Aug 31 '10 at 13:33








        1




        1





        i would so like to keep them in the same place :)

        – myusuf3
        Aug 12 '10 at 13:54





        i would so like to keep them in the same place :)

        – myusuf3
        Aug 12 '10 at 13:54




        1




        1





        this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

        – jumpnett
        Aug 12 '10 at 14:59





        this solution will keep them in their same place. .hidden doesn't even have to be in your home folder if you don't want it to be. I usually use it on removable drives that have config files I don't want to see.

        – jumpnett
        Aug 12 '10 at 14:59




        1




        1





        @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

        – invert
        Aug 31 '10 at 13:33





        @jumpnett is correct, place .hidden in the same location as the files you want to hide, and add the file/directory names in the .hidden file, one per line. Works great!

        – invert
        Aug 31 '10 at 13:33











        3














        From the command line you could try something like this in your .bash_aliases file:



        lsh() {
        [ -s .hidden ] && echo "lsh: hiding $(wc -l .hidden) patterns" && ls $@ | grep -v -F "$(cat .hidden)";
        [ ! -f .hidden ] && ls $@
        }


        This adds a new command lsh that behaves like ls, but hides files listed in a .hidden directory. (It also is missing some of its features like colorized output and column listings.)






        share|improve this answer






























          3














          From the command line you could try something like this in your .bash_aliases file:



          lsh() {
          [ -s .hidden ] && echo "lsh: hiding $(wc -l .hidden) patterns" && ls $@ | grep -v -F "$(cat .hidden)";
          [ ! -f .hidden ] && ls $@
          }


          This adds a new command lsh that behaves like ls, but hides files listed in a .hidden directory. (It also is missing some of its features like colorized output and column listings.)






          share|improve this answer




























            3












            3








            3







            From the command line you could try something like this in your .bash_aliases file:



            lsh() {
            [ -s .hidden ] && echo "lsh: hiding $(wc -l .hidden) patterns" && ls $@ | grep -v -F "$(cat .hidden)";
            [ ! -f .hidden ] && ls $@
            }


            This adds a new command lsh that behaves like ls, but hides files listed in a .hidden directory. (It also is missing some of its features like colorized output and column listings.)






            share|improve this answer















            From the command line you could try something like this in your .bash_aliases file:



            lsh() {
            [ -s .hidden ] && echo "lsh: hiding $(wc -l .hidden) patterns" && ls $@ | grep -v -F "$(cat .hidden)";
            [ ! -f .hidden ] && ls $@
            }


            This adds a new command lsh that behaves like ls, but hides files listed in a .hidden directory. (It also is missing some of its features like colorized output and column listings.)







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 27 '12 at 8:44









            Flimm

            21.9k1563123




            21.9k1563123










            answered Nov 1 '11 at 2:41









            qneillqneill

            20615




            20615























                2














                If you want to hide files, you are only left with renaming them with a preceding ., as is *NIX convention. Sorry, but that's it.



                However, if you would like to hide the content of the files/directories, you can do so with file permissions.



                So say you have a bunch of files in a folder called secret_stash, you could change it so that only you (the owner) have r-x (read, execute) and everyone else has nothing --- (no access). Since r-x is the minimum perms needed to view a directory (read to access its contents and execute to be able to see them), anything inside of that folder is effectively hidden from everyone but root.



                NOTE: I'm running this demo as root, and trying to access the folder as myuser



                To do this you run chmod 700 dirname (700 means rwx------):



                % mkdir secret_stash
                % chmod 700 secret_stash


                And here it is:



                % whoami
                root
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ./ ../ secret.txt
                % cat secret_stash/secret.txt
                TOP SECRET DATA


                Now and if I try to access it from myuser, attempts to access the folder or its contents fail:



                % whoami
                myuser
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ls: cannot open directory secret_stash: Permission denied
                % cat secret_stash/secret.txt
                cat: secret_stash/secret.txt: Permission denied


                And now I've said the word "secret" so many times it's lost all meaning!!






                share|improve this answer



















                • 2





                  You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

                  – Marco Ceppi
                  Aug 12 '10 at 15:41











                • @Marco Ceppi - ULTIMATE SECRECY!

                  – jathanism
                  Aug 12 '10 at 18:22











                • Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

                  – Marco Ceppi
                  Aug 12 '10 at 18:28






                • 2





                  @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

                  – Lie Ryan
                  Jun 26 '12 at 4:24


















                2














                If you want to hide files, you are only left with renaming them with a preceding ., as is *NIX convention. Sorry, but that's it.



                However, if you would like to hide the content of the files/directories, you can do so with file permissions.



                So say you have a bunch of files in a folder called secret_stash, you could change it so that only you (the owner) have r-x (read, execute) and everyone else has nothing --- (no access). Since r-x is the minimum perms needed to view a directory (read to access its contents and execute to be able to see them), anything inside of that folder is effectively hidden from everyone but root.



                NOTE: I'm running this demo as root, and trying to access the folder as myuser



                To do this you run chmod 700 dirname (700 means rwx------):



                % mkdir secret_stash
                % chmod 700 secret_stash


                And here it is:



                % whoami
                root
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ./ ../ secret.txt
                % cat secret_stash/secret.txt
                TOP SECRET DATA


                Now and if I try to access it from myuser, attempts to access the folder or its contents fail:



                % whoami
                myuser
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ls: cannot open directory secret_stash: Permission denied
                % cat secret_stash/secret.txt
                cat: secret_stash/secret.txt: Permission denied


                And now I've said the word "secret" so many times it's lost all meaning!!






                share|improve this answer



















                • 2





                  You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

                  – Marco Ceppi
                  Aug 12 '10 at 15:41











                • @Marco Ceppi - ULTIMATE SECRECY!

                  – jathanism
                  Aug 12 '10 at 18:22











                • Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

                  – Marco Ceppi
                  Aug 12 '10 at 18:28






                • 2





                  @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

                  – Lie Ryan
                  Jun 26 '12 at 4:24
















                2












                2








                2







                If you want to hide files, you are only left with renaming them with a preceding ., as is *NIX convention. Sorry, but that's it.



                However, if you would like to hide the content of the files/directories, you can do so with file permissions.



                So say you have a bunch of files in a folder called secret_stash, you could change it so that only you (the owner) have r-x (read, execute) and everyone else has nothing --- (no access). Since r-x is the minimum perms needed to view a directory (read to access its contents and execute to be able to see them), anything inside of that folder is effectively hidden from everyone but root.



                NOTE: I'm running this demo as root, and trying to access the folder as myuser



                To do this you run chmod 700 dirname (700 means rwx------):



                % mkdir secret_stash
                % chmod 700 secret_stash


                And here it is:



                % whoami
                root
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ./ ../ secret.txt
                % cat secret_stash/secret.txt
                TOP SECRET DATA


                Now and if I try to access it from myuser, attempts to access the folder or its contents fail:



                % whoami
                myuser
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ls: cannot open directory secret_stash: Permission denied
                % cat secret_stash/secret.txt
                cat: secret_stash/secret.txt: Permission denied


                And now I've said the word "secret" so many times it's lost all meaning!!






                share|improve this answer













                If you want to hide files, you are only left with renaming them with a preceding ., as is *NIX convention. Sorry, but that's it.



                However, if you would like to hide the content of the files/directories, you can do so with file permissions.



                So say you have a bunch of files in a folder called secret_stash, you could change it so that only you (the owner) have r-x (read, execute) and everyone else has nothing --- (no access). Since r-x is the minimum perms needed to view a directory (read to access its contents and execute to be able to see them), anything inside of that folder is effectively hidden from everyone but root.



                NOTE: I'm running this demo as root, and trying to access the folder as myuser



                To do this you run chmod 700 dirname (700 means rwx------):



                % mkdir secret_stash
                % chmod 700 secret_stash


                And here it is:



                % whoami
                root
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ./ ../ secret.txt
                % cat secret_stash/secret.txt
                TOP SECRET DATA


                Now and if I try to access it from myuser, attempts to access the folder or its contents fail:



                % whoami
                myuser
                % ls -ld secret_stash
                drwx------ 2 root root 4.0K 2010-08-12 07:59 secret_stash/
                % ls secret_stash
                ls: cannot open directory secret_stash: Permission denied
                % cat secret_stash/secret.txt
                cat: secret_stash/secret.txt: Permission denied


                And now I've said the word "secret" so many times it's lost all meaning!!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 12 '10 at 15:14









                jathanismjathanism

                26016




                26016








                • 2





                  You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

                  – Marco Ceppi
                  Aug 12 '10 at 15:41











                • @Marco Ceppi - ULTIMATE SECRECY!

                  – jathanism
                  Aug 12 '10 at 18:22











                • Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

                  – Marco Ceppi
                  Aug 12 '10 at 18:28






                • 2





                  @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

                  – Lie Ryan
                  Jun 26 '12 at 4:24
















                • 2





                  You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

                  – Marco Ceppi
                  Aug 12 '10 at 15:41











                • @Marco Ceppi - ULTIMATE SECRECY!

                  – jathanism
                  Aug 12 '10 at 18:22











                • Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

                  – Marco Ceppi
                  Aug 12 '10 at 18:28






                • 2





                  @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

                  – Lie Ryan
                  Jun 26 '12 at 4:24










                2




                2





                You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

                – Marco Ceppi
                Aug 12 '10 at 15:41





                You can make it really hidden with chmod -R 000 secret_stash then no one will be able to read it!

                – Marco Ceppi
                Aug 12 '10 at 15:41













                @Marco Ceppi - ULTIMATE SECRECY!

                – jathanism
                Aug 12 '10 at 18:22





                @Marco Ceppi - ULTIMATE SECRECY!

                – jathanism
                Aug 12 '10 at 18:22













                Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

                – Marco Ceppi
                Aug 12 '10 at 18:28





                Of course this is more "Security" than it is "Obscurity" - which is what the OP was looking for I think ;)

                – Marco Ceppi
                Aug 12 '10 at 18:28




                2




                2





                @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

                – Lie Ryan
                Jun 26 '12 at 4:24







                @MarcoCeppi: chmod 000 will hide the file from even the owner of the file, except the root, which can always bypass 000. However, the owner of the file can still change the permission of the file to read it, so you need to also change the ownership of the file to root to make the 000 permission really meaningful.

                – Lie Ryan
                Jun 26 '12 at 4:24













                2














                1st off: if you want to hide a file from anyone: install a linux intrusion detection system. (Snort is an example) You can even hide a file from "root" but "root" will also be able to revert those setting.





                But it might be easier to just set the permissions of the directory that holds the file to "root". Example:



                 $ sudo su
                # mkdir tmp/
                # touch tmp/1
                # chown root:root tmp
                # chmod 000 tmp
                # ls -l
                total 4
                d--------- 2 root root 4096 2015-08-07 06:36 tmp
                # exit
                exit
                $ ls
                tmp
                $ cd tmp/
                bash: cd: tmp/: Permission denied


                And the file 1 is effectively hidden from view.



                Directory will be visible; file will not be visible.
                Mind though: "root" will ALWAYS have access to any file.





                Together with the chattr you can even make the file immutable.



                sudo su    
                chattr + i {file}


                and even "root" can not alter the file -unless- the chattr is reverted (and yes "root" can do that).




                Any Keyboard Shortcut for that?




                No, this is something you need to do manually.






                share|improve this answer






























                  2














                  1st off: if you want to hide a file from anyone: install a linux intrusion detection system. (Snort is an example) You can even hide a file from "root" but "root" will also be able to revert those setting.





                  But it might be easier to just set the permissions of the directory that holds the file to "root". Example:



                   $ sudo su
                  # mkdir tmp/
                  # touch tmp/1
                  # chown root:root tmp
                  # chmod 000 tmp
                  # ls -l
                  total 4
                  d--------- 2 root root 4096 2015-08-07 06:36 tmp
                  # exit
                  exit
                  $ ls
                  tmp
                  $ cd tmp/
                  bash: cd: tmp/: Permission denied


                  And the file 1 is effectively hidden from view.



                  Directory will be visible; file will not be visible.
                  Mind though: "root" will ALWAYS have access to any file.





                  Together with the chattr you can even make the file immutable.



                  sudo su    
                  chattr + i {file}


                  and even "root" can not alter the file -unless- the chattr is reverted (and yes "root" can do that).




                  Any Keyboard Shortcut for that?




                  No, this is something you need to do manually.






                  share|improve this answer




























                    2












                    2








                    2







                    1st off: if you want to hide a file from anyone: install a linux intrusion detection system. (Snort is an example) You can even hide a file from "root" but "root" will also be able to revert those setting.





                    But it might be easier to just set the permissions of the directory that holds the file to "root". Example:



                     $ sudo su
                    # mkdir tmp/
                    # touch tmp/1
                    # chown root:root tmp
                    # chmod 000 tmp
                    # ls -l
                    total 4
                    d--------- 2 root root 4096 2015-08-07 06:36 tmp
                    # exit
                    exit
                    $ ls
                    tmp
                    $ cd tmp/
                    bash: cd: tmp/: Permission denied


                    And the file 1 is effectively hidden from view.



                    Directory will be visible; file will not be visible.
                    Mind though: "root" will ALWAYS have access to any file.





                    Together with the chattr you can even make the file immutable.



                    sudo su    
                    chattr + i {file}


                    and even "root" can not alter the file -unless- the chattr is reverted (and yes "root" can do that).




                    Any Keyboard Shortcut for that?




                    No, this is something you need to do manually.






                    share|improve this answer















                    1st off: if you want to hide a file from anyone: install a linux intrusion detection system. (Snort is an example) You can even hide a file from "root" but "root" will also be able to revert those setting.





                    But it might be easier to just set the permissions of the directory that holds the file to "root". Example:



                     $ sudo su
                    # mkdir tmp/
                    # touch tmp/1
                    # chown root:root tmp
                    # chmod 000 tmp
                    # ls -l
                    total 4
                    d--------- 2 root root 4096 2015-08-07 06:36 tmp
                    # exit
                    exit
                    $ ls
                    tmp
                    $ cd tmp/
                    bash: cd: tmp/: Permission denied


                    And the file 1 is effectively hidden from view.



                    Directory will be visible; file will not be visible.
                    Mind though: "root" will ALWAYS have access to any file.





                    Together with the chattr you can even make the file immutable.



                    sudo su    
                    chattr + i {file}


                    and even "root" can not alter the file -unless- the chattr is reverted (and yes "root" can do that).




                    Any Keyboard Shortcut for that?




                    No, this is something you need to do manually.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 7 '15 at 8:26

























                    answered Aug 7 '15 at 7:16









                    RinzwindRinzwind

                    210k28404537




                    210k28404537























                        0














                        There's also an extension for Nautilus called nautilus-hide that will allow you to hide any file or folder with a simple right-click on them.



                        To install this extension :
                        sudo apt-get install nautilus-hide in a terminal,
                        or search for "nautilus hide" in the Ubuntu Software Center.



                        Don't forget to quit Nautilus after installation : Alt+F2 and type nautilus -q.






                        share|improve this answer






























                          0














                          There's also an extension for Nautilus called nautilus-hide that will allow you to hide any file or folder with a simple right-click on them.



                          To install this extension :
                          sudo apt-get install nautilus-hide in a terminal,
                          or search for "nautilus hide" in the Ubuntu Software Center.



                          Don't forget to quit Nautilus after installation : Alt+F2 and type nautilus -q.






                          share|improve this answer




























                            0












                            0








                            0







                            There's also an extension for Nautilus called nautilus-hide that will allow you to hide any file or folder with a simple right-click on them.



                            To install this extension :
                            sudo apt-get install nautilus-hide in a terminal,
                            or search for "nautilus hide" in the Ubuntu Software Center.



                            Don't forget to quit Nautilus after installation : Alt+F2 and type nautilus -q.






                            share|improve this answer















                            There's also an extension for Nautilus called nautilus-hide that will allow you to hide any file or folder with a simple right-click on them.



                            To install this extension :
                            sudo apt-get install nautilus-hide in a terminal,
                            or search for "nautilus hide" in the Ubuntu Software Center.



                            Don't forget to quit Nautilus after installation : Alt+F2 and type nautilus -q.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Aug 7 '15 at 9:19









                            muru

                            1




                            1










                            answered Aug 7 '15 at 9:00









                            SNuguesSNugues

                            496




                            496






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f2034%2fhow-can-i-hide-directories-or-files-without-changing-their-names%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

                                數位音樂下載

                                When can things happen in Etherscan, such as the picture below?

                                格利澤436b