Select the right words
Probably the most difficult and important thing in any search query is to formulate the question. Often, just copying the text of the mistake into a search string is not enough. How and what to look for to get the desired result as quickly as possible?
– First, do it in English. If your level of English is not enough, use online translators. And whatever software you have to work with, try to use the English version.
– Do not hurry to copy the text of your mistake into the search engine. Think about your question first.
Let’s look at this example
Let’s assume that you need to remove the /usr/disk file. You run the magic command rm /usr/disk and get (very often) an error: rm: can not remove ‘/usr/disk’: Permission denied. At first glance, everything is clear. The problem is the lack of rights. But what makes the matter worse is the fact that you’re running the command under the superuser!
Order of operations:
1. Remove any information that applies only and exclusively to your situation from the request: the name of the specific file, the path and so on. In our case, it is necessary to remove the file name /usr/disk. This rule always works except for situations when the error is caused by a specific file. Then it is important to keep it in the search request. But these situations are rare, and as a rule, they are indicated by several signs at a time.
2. Define the essence of the problem and choose the key words that describe it. The shorter, the better:
❌ can not delete files – this is a very general request, searching for relevant answers will take a lot of time.
✅ rm permission denied – this is the fastest way to solve problems similar to yours.
3. Include the tool/technology/environment which caused your error into your request. It narrows your search and makes it more specific. Relevant additions in our case: linux (it is better to put it at the beginning of the note). Output: linux rm permission denied.
Rubber duck method
Rubber duck debugging or the “rubber duck method” was described in Andrew Hunt and David Thomas’s book Pragmatic Programmer. It tells a story of a programmer who tried to figure out the code by explaining its features to a rubber duck.
You do not need to have a rubber duck literally to understand the text of the error. Analyse it and try to explain what happened to an imagined duck. You need to use plain words to make it easy to understand. In the process you will figure out what the problem is, or you will find out the keywords that will help you find a solution.
In our example, judging by the text of the error, the file cannot be deleted because you do not have the necessary access rights. But how is it possible, if you are acting under the name of a super user, who by default can do everything? So, maybe this is what you should think about?
Let’s ask Google: root can not delete file
Advanced Search tools
When searching in Google, pay attention to the Advanced search panel. There are a lot of features that will help you to find the information you need faster. You can set the required parameters directly in the Google interface or use search operators.
Here are a few options that may be useful to you:
Current Data. You do not want to waste time on outdated information, do you? Limit the search period to a maximum of three years, or even a year.
Specify your search. If you see the phrase with inverted commas (” and “) on both sides, Google will search for those words in this exact order. This option is useful, for example, if you’re looking for the exact text of the notification about an error, and Google randomly throws out the results of the search for an important part of the text. Put the text in the inverted commas. In the search results you will see only those in the inverted commas, which have the text in the claws (when looking for variants of using some console utility key, put it into inverted commas, such as: sed “-e”)
Search by part of the phrase. Any part of the phrase in your note can be replaced by the symbol “*” or “?”. This is useful if you do not know the exact phrase, but roughly know how the text should look like. Replace the unknown part of the text with the asterisk (if there are a few words or symbols) or “?” (if you are missing one symbol).
Stop words. Add to your request a dash (-) and after it a word without a space that should not be in the search results. For example, if you are annoyed that you get variants of translation of your keywords instead of useful information, just omit them : “-translation”.
Another example : for request “Can not delete file -Windows” you will not see variants for Windows.
Learn by example
You need to find the cause of this error: file does not exist. Let’s go to Google
As you can see in the screenshot, the output includes 400+ million search results, many of which are just translations of the phrase from English to your native language. Let’s try to search among the variants of the answers that solve the problem. Let’s add the word ‘solved’ to the search string. And in order to exclude irrelevant variants, let’s take solved into inverted commas.
Search on Specific Websites
To limit search to a particular site, add site:URL (where URL is the address of the necessary site) to the request line. For example, put site Stackoverflow into a request site:stackoverflow.com. Stackoverflow is the collective intelligence of IT specialists around the world. Most probably, your problem has already been described more than once, and you can find the answer here. The best and most powerful answer to the question you asked for is marked as accepted. So add site:stackoverflow.com accepted to your request, to read only the description of already closed tasks.
And you can use the inurl operator to search for specific sections of the site. Suppose you are sure that the information you need is most likely to be found in the section for developers. Add inurl:developer to the search. Here you can also add the site address. For example, by asking inurl:developer site:google.com you will find Google documentation for developers.
You can trust in Google, but keep your powders dry!
Don’t overestimate Google’s role in your professional career. A search engine, even the smartest one, can’t completely replace a person. Relying solely on the help of Google, you teach yourself to “cheat” rather than solve problems on your own. In other words, you can quickly solve similar tasks, but do not count on serious professional growth.
Do not forget that the variants you’ve found cannot be used as they are. They should be analyzed.
For example, you need to find the number “5” in the data set. You have found a solution on stackoverflow that processes the datasets one by one. You tested the solution on a test array of 10 elements. Everything works, great! But!
- Are you sure it will work on an array with more than a million pieces of data?
- Will it work for an unsorted array?
- How helpful is this solution when it comes to non-digital data?
- And we still haven’t taken into account the framework within which this array was created and what its capabilities are. There may be very many pitfalls. To define them you need more than just the skill to google them.
And of course, never apply the solution without analyzing the command first.
Make sure that the command you have copied looks exactly as it appears on the browser screen. Sometimes when you copy the command, there might be some extra or missing characters, or it ends up with the row break symbol and other issues.
The best option is to copy the command into a text editor, analyze it, and if necessary adjust, adapt to your situation (e.g., correct file names) and then put it into the command line.
And still do not rely entirely on other people’s solutions. Invest time into developing your own skills. Follow a rule: if it takes you longer than 5 minutes to find a solution on your own, only then go to Google. The time spent on analyzing the problem, in any case, will speed up your search!