If you’re one of those who’ve spent time with your Terminal command line, chances are you’ve made a typographical error, or two, or hundreds if your handwriting accuracy is similar to ours at the time of writing. write things like this.
It is one of the nightmares of working with Unix. After years of point-and-click, having to write sometimes long and complex commands by hand results in surprising typos and inaccuracies.
And unfortunately, Terminal isn’t as forgiving of typographical errors as any current word processor like Microsoft Word or Google Docs, which immediately marks the word in red so you can check the spelling.
Let’s see an example where we try to change the directory in the Applications folder. The command would look like this in Terminal (where% is the command prompt):
% cd apps
However, in a hurry when entering the command, it turns out that you type “Applications” instead of “Applications”. Terminal will very kindly suggest:
cd: no such file or directory: Applications
One way to correct this error is to use the arrow keys on your keyboard to navigate to the right place in the command and press “Delete” at the right place. (This is more convenient if the command is short and doesn’t take long to repeat it.)
This is a potentially simpler method for more complicated commands: use the caret (^) character. Immediately after receiving the error in Terminal, run the following command with the caret.
Then type the part of the above command that you want to fix, type another cursor and retype the corrected version of the command. In this example, it was three o’clock p those who were wrong, because there should have been only two.
To resolve this issue, you will need to enter this command:
^ ppp ^ ppp
When you press ‘Return’, Terminal reruns the previous command, making the correction you just indicated. And to let you know what happened, Terminal will also echo the corrected command that was executed:
% cd apps
cd: no such file or directory: Applications
% ^ ppp ^ ppp
CD applications
[email protected] Applications%
You might not use it every day, but it’s a time-saving tip if you’re someone who spends time programming and developing with the Terminal command line.
You may also be interested in knowing the most important keyboard shortcuts you need to know how to manage on a Mac.
Original article published in igamesnews United States.
.