I have my computer set up to use the same home folder / user profile for Linux and Windows. As a consequence I have files like NTUSER.DAT that are hidden on Windows showing up when I ls and in my file manager. Is there any way to make Linux hide the hidden files?

  • You have a secondary consequence: Using NTFS for your Linux home directory will break Linux permissions because NTFS does not support them.
    – Thomas Ward
    Dec 27, 2015 at 3:52

1 Answer 1


Add the files you want to hide to a file named .hidden with 1 file per line inside the directory those files are. Somehing like ls {files} >.hidden will work to quickly do this.

  • You can hide files looking from Windows with C:\>attrib +h D:\*.hidden /S (this will hide the .hidden file from the previous method). The directory I assumed D:.

  • You can hide these files from ls on Linux by adding this into your ~./bashrc:

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

    This will hide the files when using ls and ls only. It also assumes you do not already have an alias for ls. ls -l will still show them but that is just another alias.

The last command I found on superuser. Please upvote that answer ;)

  • 3
    Hmmm... if I understand well, the OP is thinking using an NTFS filesystem as home dir... they should read your answer here: askubuntu.com/questions/330356/…
    – Rmano
    Dec 26, 2015 at 12:32
  • will this work for graphical file managers too?
    – 0x539
    Dec 26, 2015 at 20:47
  • For nautilus yes, only the 1st part is needed for that. The 3rd part is for command line. Not sure about other managers though. The .hidden method might be Nautilus feature.
    – Rinzwind
    Dec 26, 2015 at 20:48
  • attrib will only work on NTFS/FAT filesystems.
    – Braiam
    Dec 26, 2015 at 22:46
  • @Rinzwind It causes other problems though: if you try to run ls -l bash passes the -l flag to the las export :(
    – 0x539
    Dec 28, 2015 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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