
How often could you not remember this or that command in Git, Vim, Linux, C ++? How much time do you spend searching for an answer in man or on the Internet? Have you ever tried to write your own directories and how did it end? Would you like to help your memory a little?
Let me help you. Under the cut there is a small history of the evolution of my reference books and the utility Dic.
Remember everything
After reading my first IT book, I made it a rule to write detailed summaries of everything that I learned in “understandable language”, so that in the future you can return to the notes and remind myself of the forgotten. Soon I noticed that little things are often forgotten, such as the names of the necessary utilities or commands, and rereading the synopsis for too long. Then I decided to act differently and write small directories, which no longer contain the main thoughts of the book, but a description of the main commands and examples of their use. This approach turned out to be much more efficient than the previous one, since my first guess turned out to be wrong: if you read the book, your brain will remember its content without any problems, but it will be difficult for it to recall small details, and that’s what you need to take notes.
')
At first everything went well, if I could not remember something, I turned to reference books and (thanks to the hierarchical structure) quickly found the necessary information, but sometimes I was more willing to postpone the solution of the problem “for later” because I was just too lazy to open the necessary reference book. and look for it (albeit quickly) information. At first I did not pay attention to this, reducing everything to my own laziness, but from the very time I switched to Xmonad, I realized that it was not at all in me. The problem is that in order to find a very small piece of information, I force myself to perform too complex actions: go to the directory with a dictionary, open the dictionary with the necessary editor, use the mouse to find the necessary information - all this is too difficult to solve a tiny task, therefore it’s too lazy solve. For me, as a programmer who likes “exercise bikes” in programming, it was a challenge to unprecedented audacity and I found a solution!
Dic
For an hour, I sketched "on my knee" a small Bash script that provided me with all the necessary information using short queries. The whole algorithm of the script can be described in one sentence:
knowing the name of the dictionary and the section, the script must return the contents of the file that describes this section.
In practice, it looks like this. Suppose I need to find out what the git init command does, I type in the terminal:
dic git init
and get a brief (one sentence) description of the command:
git init - git clone <url> [<dir>] - ( dir) dic
“What if I don’t remember the name of the team, but I know what it does?” You ask. The solution is just as simple:
dic git | grep '' ''
the entry will appear on the screen
init — (init,clone)
telling us that we need to read the dic git init section.
The increase in the speed of information retrieval was obvious. If earlier I needed at least a minute or two to search in reference books or on the Internet, then now I have ten seconds (I even noticed!).
How it works
Of course, the solution I propose is not for everyone. Firstly, you need Bash, secondly, you should always have a terminal at hand and you should be able to work with it quickly, thirdly, you should be able to compile directories correctly (since Dic is not able to do this). If this does not frighten you, then let's "sit at the helm" and look at the "dashboard":

- Dic uses the contents of the .dic / library / directory to retrieve and manage accessible dictionaries;
- The directory .dic / library / contains subdirectories (dictionaries). The name of each dictionary should be as short and informative as possible (for example, I have a Vim dictionary called vim). In this case, calling dic vim will force dic to work with the .dic / library / vim directory;
- Each dictionary should contain files without extensions (sections), whose names should be as short and informative as possible. These files contain all the information we need in the future. For example, a file containing information about Git indexing commands is called .dic / library / git / index;
- Each section contains a brief description of the commands (utilities, other important data) related to this section. All commands are written on a separate line and are often (optionally) grouped into paragraphs. The command should be written as follows: command - description. Here is a small example of a dictionary section:
git init —
- In addition to the sections, each directory contains two system files: desctiption - the file contains a description of the directory, contents - the file contains a description of all sections with an indication in brackets of all the commands described in each of the sections.
That's all Dic needs to work with a dictionary, everything is as simple as possible.
Now a few words about the available commands:
- dic - Dic initialization, if this has not yet been done and displaying a list of available dictionaries, if initialization has already been performed;
- dic Dictionary name - displaying a list of sections related to this dictionary;
- dic name Dictionary name section - output section contents;
- dic name Dictionary name section - output command description;
- dic -h - Dic help;
- dic -u - update dictionaries from Github.com
The whole world
Having a convenient dictionary at hand is good, and if it is filled with several people at once, it is even better! That is why Dic can use the repository on Github.com to update its dictionaries. Of course, you can do without git by simply copying the dictionaries you need to the .git / library directory, and even create your own dictionaries, but Wikipedia.org would be the 6th most visited website on the Internet, if not for the teamwork of all users ?!
If you do not already have Git, be sure to install it. After the first launch of Dic, it will create the .dic / library directory in your home directory and download all the directories available today. If you are familiar with Git, you will be able to maintain your own branch of directories, which may be added to the main one and others will be able to use your reference books. If you feel that your directories are outdated, just execute dic -u and it will update them from the repository.
Where to begin
- Install Git (optional).
- At the end of the post you will find a link to the script Dic. Download it and put it in a convenient place. Personally, I created a symbolic link d to Dic to access directories even faster.
- Run the script dic.sh (no root privileges are required), it will create the directory .dic / library / in your home directory and try to create a Git repository in it using git clone.
- If you do not want to use Git, you will also find a link to the Github.com repository at the bottom of the post. Download the directories of interest from there and put them in the .dic / library / directory and Dic is ready to go.
Create your directories and add commands to existing ones as needed. Try to write as briefly and informatively as possible to spend less time searching for information, but do not forget that other people may use your reference books.
useful links
- Script Dic
- Directory Repository on Github.com