A program stops working. The cause is one wrong value, in one of many settings files. This is a common job on a Linux computer, and you can do it with the commands from this chapter.
1. Read the log. Find the wrong valuetail, grep -i error
2. Find the file and the line that set the valuegrep -rn VALUE DIR
3. Copy the filecp FILE FILE.bak
4. Fix the valuenano FILE
5. Comparediff FILE.bak FILE
1. Read the log
New lines go at the end of a log file. Start there:
text
learner@tidepool:~$ tail -n 5 /var/log/till.log
learner@tidepool:~$ grep -i error /var/log/till.log
12:01 ERROR cannot reach printer receipt-1OAn error message often names the value that failed. Here it is receipt-1O.
2. Find the file
The value is inside a file, so search the contents with grep -r. Add -n for the line number:
text
learner@tidepool:~$ grep -rn receipt-1O ~/config
/home/learner/config/till/devices.conf:3:printer=receipt-1O3, 4, 5. Copy, fix, compare
text
learner@tidepool:~$ cp ~/config/till/devices.conf ~/config/till/devices.conf.bak
learner@tidepool:~$ nano ~/config/till/devices.conf
learner@tidepool:~$ diff ~/config/till/devices.conf.bak ~/config/till/devices.conf
3c3
< printer=receipt-1O
---
> printer=receipt-10The output shows one change, on line 3. That is the change that you wanted.