You don’t need a new app to run a tagging system on your files: use the programme grep
You don’t need to install a new programme to organise your files with a tagging system. You can do so with simple text files and the programmes grep, to be used on the command line.
It starts with finding unique names for your tags, let’s say [hashtag][keyword]
, such as #tag1
, #tag2
, #art
et cetera.
Tag your .txt or Markdown files anywhere in the file, at the top, within the text. It does not matter.
Use grep to retrieve all files with a given tag. grep will search for the pattern [hashtag][keyword]
.
For example, when you need to list all the files with, say, the tag: #tag1
, run grep with the following expression:
$ grep -l #tag1 *
short for $ grep --files-with-matches #tag1 *
where:
- the option
-l
, short for--files-with-matches
, tells grep to only print the name of matching files (not the matching content.) - the regular expression
*
tells grep to search all files in the current working directory. You can invoke the option-r
, short for--recursive
, to search files located in directories located within the current working directory, that is, recursively, hence the letterr
for the option.
To learn more about grep, run:
$ man grep
or
$ info grep
grep is copyleft-licensed, that is licensed under GNU General Public License version 3 and was written for private use by Ken Thompson1 (called s
then), and first published in the seventies.
grep was added as a verb and a noun to the Oxford Dictionary in 20032.
personal computing command-line interface (cli) grep gnu linux trisquel text processing office applications wiki shell literacy offline