December 4, 2015

Unix Yes

Using Term2, I was looking around some files in the /usr/bin folder to see if there's any cool command line graphic utilities that I could use. In Mac OS X El Capitan (10.11.1) there are 1,052 unix applications in the /usr/bin folder. Many of them I'll probably never use. For example, Why would I ever use eMacs when I have BBEdit?

I did encounter a strange program called 'yes' which sounded weird for a application file name. I checked the description in the manual (man yes) it says that:

manyes.jpg
yes outputs expletive, or, by default, ``y'', forever.

Turns out that's all the application does. So if you type in:

yes testing

You get the word 'testing' on a single line repeated forever. What is the purpose of this application? Why would anyone need to have a phrase repeated endlessly?

A few people have pointed out that it's useful when you encounter a application where you are prompt to fix an error repeatedly. Another user points out that the 'yes' command is useful when you need to test high loads of CPU on a system.

The most useful that I encountered is if you wanted to delete a bunch of files and didn't want to bother saying 'yes' on each state:

yes | rm *.txt

To me it seems to be a weird unix application that encountered.

Largest Files in /usr/bin

While going through all the other applications in the /usr/bin folder, I was thinking what were the largest applications in the directory. So here is the list of the top 20 largest files in the /usr/bin folder:

36M  emacs
10M  php
5.4M  parl5.18
5.2M  parl5.16
3.1M  emacs-undumped
2.1M  db_printlog
2.1M  db_codegen
2.1M  db_load
2.1M  db_hotbackup
2.1M  db_recover
2.1M  db_dump
2.1M  db_checkpoint
2.1M  db_deadlock
2.1M  db_archive
2.1M  db_upgrade
2.1M  db_verify
2.1M  db_stat
1.6M  ssh
1.5M  dig
1.5M  host

You can easily get this information by typing in the following command in Terminal:

ls -lahS

That will get you the listing of all the files in the current directory, sorted by file size. The file size are in blocks which is a bit easier to read for most people. Would you rather see 36M or 37236368?

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!