6

I was wondering if there is some method to display .htaccess files by default in every folder i create it.

Is it possible to exclude .htaccess files from the hidden files? Maybe from the terminal

4 Answers 4

14

You can use Ctrl+H if you are browsing files using Ubuntu File Browser (Nautilus)

1
  • Can we set somehow Nemo or Nautilus, to show hidden files per directory like sorting, for example?
    – Vassilis
    Jul 9, 2018 at 13:26
8

You can set an alias to ls so that it will always list 'dot' files; the syntax varies a bit depending of the shell used; for bash it is:

alias ls='ls -a'

Add the above line to your ~/.bashrc. The drawback is this will list all files starting with a dot, every time.

1
  • 1
    I'd also recommend alias ls='ls -a --color=auto'
    – Irfan434
    May 16, 2018 at 5:14
0

In linux, every file with a "dot" in the start of its name is treated as hidden file. Being hidden is not some property that you can remove from a file, thereby excluding that file from hidden files. If you want to unhide a file, you need to change its name i.e if you want to remove .somefile from hidden files, you rename it to somefile. But I dont think that you can do the same with .htaccess because its a configuration file and if you rename it to htaccess your webserver will still be looking for .htaccess.

So, in short, I don't think it is possible to exclude .htaccess files from hidden files.

0

If you wanted only to show the the .htaccess dot file but keep the rest hidden you could add an alias to your bash configuration file for ls that uses grep to filter out the non-htaccess dotfiles.

alias ls='ls -a | grep ".*([.]htaccess$)|.*\d{2}:\d{2} ([^.].*$)|.*$"'

That regular expression is not working by the way, maybe someone with more experience could write the correct solution. But this method should give you what you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .