Yin and Yang by Klem, Public Domain

Little more than a week ago, I began to think about pairs of commands, foobar and unfoobar. They are like yins and yangs, they complete each other, make things come full circle, from Wikipedia:

In Chinese philosophy, the concept of yin-yang (simplified Chinese: 阴阳; traditional Chinese: 陰陽; pinyin: yīnyáng), which is often called “yin and yang”, is used to describe how opposite or contrary forces are interconnected and interdependent in the natural world; and, how they give rise to each other as they interrelate to one another.

Or you can see them as one countering another, if you are negative.

1   cat and tac

One concatenates lines in the order of given file list, another reverses order of lines:

$ cat test.txt
123
===
ABC
$ tac test.txt
ABC
===
123

2   cat and rev

Differ than above, rev keeps the order, but reverses the order of characters in each line:

$ rev test.txt
321
===
CBA

3   cat and split

One concatenates into one, another breaks into pieces:

$ split -l 1 test.txt test-
$ more test-* | cat
::::::::::::::
test-aa
::::::::::::::
123
::::::::::::::
test-ab
::::::::::::::
===
::::::::::::::
test-ac
::::::::::::::
ABC

4   head and tail

One goes from beginning, another goes for the end, or toss a coin?

5   uniq -u and uniq -d/-D

One option for unique lines, another for duplicate lines:

$ cat test.txt
1
2
2
$ uniq -u test.txt
1
$ uniq -d test.txt
2
$ uniq -D test.txt
2
2

6   expand and unexpand

Tabs to spaces, spaces back to tabs, special case PEP8.

7   true and false

True yin and yang, or false?

8   Other foobars and unfoobars

Commands like compress and uncompress for compressions, encryptions, those sorts of pairs. Or variables, aliases like alias and unalias.

9   Any more?

Leave the pairs in comments below.