Filtering in file explorer on Linux
When we write a LaTeX document, there will be a bunch of intermediate or temporary files generated in the same folder as the TeX file, such as *.aux
, *.synctex.gz
, *.out
, *.toc
, *.thm
, *.bbl
, *.blg
. This brings mess to our browsing experience in the file explorer. To focus on those files which need our editing and reading, we can use the filter function provided by Dolphin, the default KDE file explorer on Linux, to show only TeX files or PDF files. In addition, by clicking on the small lock icon at the right of the filter bar, the current filter can be kept effective when we change to another folder.
Many intermediate files are displayed in Dolphin by default
TeX files are filtered to be shown in Dolphin
However, the capability of the Dolphin’s file name filter is still limited. It only checks if a file name contains the input string and it does not support pattern matching. To to apply a more complex file name filter, we can resort to the Emacs Dired
mode. The procedures are summarized below.
- Press
C-x d
to enter theDired
mode. - Press
% m
to mark desired files via regular expression matching, such astex$
,pdf$
, etc. - Press
% m
again to mark more files, if needed. - Press
t
to invert the selection, i.e. all unmarked files are selected. - Press
k
to kill all lines corresponding to the marked files. N.B. This operation does not delete the files, but just filter them out from theDired
buffer. - Press
g
again to restore the display of all files in the folder.
Only TeX and PDF files are displayed in the Dired mode in Emacs