June 1, 2023

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 letter r 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.


  1. Kernighan, Brian (1984). The Unix Programming Environment. Prentice Hall. pp. 102. ISBN 0-13-937681-X.↩︎

  2. New words list December 2003, Oxford English Dictionary’s website↩︎

✍✍✍✍✍✍✍✍✍✍✍✍✍✍

I do self-funded research and I'm writing a book.

> What's the book about?

About technologies and agency.

Meaning, technologies can foster agency. No doubt. But I am also asking:

Can usage of technologies give us a sense of empowerment while in fact undermining our abilities?

I posted a summary of the prologue on the homepage: https://yctct.com/

✍✍✍✍✍✍✍✍✍✍✍✍✍✍


personal computing command-line interface (cli) grep gnu linux trisquel text processing office applications wiki shell literacy

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct.com is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88