[Bash Tricks]: Editing wrongly typed command

 

We often used to type a lengthy command and realize the error after running the command. To correct this error, either we used to re-type the whole command or edit (after up arrow). This can be easily handled with bash tricks by using ‘^’.

Example:

cp /some/very/long/path/for/the/source /some/extra/loong/path/for/destination

Note the wrong spell ‘loong’ in destination path. To resolve this, either we used to re-type the whole command or edit the spell for correct destination.

The above can be done in one liner bash tricks as below.

^loong^long

Here is the working video of  Editing wrongly typed command

Written by

No Comment

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *