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?
Asked
Active
Viewed 7,010 times
12
1 Answers
21
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.hiddenfile from the previous method). The directory I assumed D:.You can hide these files from
lson Linux by adding this into your~./bashrc:ls () { if [ -f .hidden ]; then declare GLOBIGNORE="$GLOBIGNORE:.*:$(tr '\n' ':' < .hidden)" ls "$@" fi }This will hide the files when using
lsandlsonly. It also assumes you do not already have an alias forls.ls -lwill still show them but that is just another alias.
The last command I found on superuser. Please upvote that answer ;)