MX on Linux: Difference between revisions

188 bytes added ,  16:58, 4 September 2020
m
Line 63: Line 63:
=== nano ===
=== nano ===


There are various text editors available on a Pi, '''nano''' is a simple one. Like other text editors this can create a file when a file does not exist and edit (subject to file permissions) an existing file. The sudo gives you access to any file, it does not change the actual file access, so you might find you can read a file, but not save it after you have done your edit.  If you change the file name shown, then it can save as another file, but you will be asked if the new name is correct (again type '''Y''' to continue saving).
There are various text editors available on a Pi, '''nano''' is a simple one. Like other text editors this can create a file when a file does not exist and edit (subject to file permissions) an existing file. The sudo gives you access to any file, it does not change the actual file access, so you might find you can read a file, but not save it after you have done your edit.  If you change the file name shown, then it can save as another file, but you will be asked if the new name is correct (again type '''Y''' to continue saving).  Do remember that file names are case sensitive, and when you open an existing file for editing look in case "new file" message appears because you have made a typo in the path/file name.


The full syntax is <tt>sudo nano -B Path_file_name</tt> where the '''-B''' means it will create a backup of how the file was before (this can be enabled while in the editor by pressing the control key down and typing B). Alternatively use '''-C''' which stores each version in a back-up directory.  If you want to edit from a particular line and column you can use '''+line.column''', and also optionally use '''-l''' (lower-case "L") to display line numbers which might be useful when trying to correct a problem with a log file like [[dayfile.txt]].  If you don't specify a file name, then nano will create a new file and you will need to specify where to save it before exit.
The full syntax is <tt>sudo nano -B Path_file_name</tt> where the '''-B''' means it will create a backup of how the file was before (this can be enabled while in the editor by pressing the control key down and typing B). Alternatively use '''-C''' which stores each version in a back-up directory.  If you want to edit from a particular line and column you can use '''+line.column''', and also optionally use '''-l''' (lower-case "L") to display line numbers which might be useful when trying to correct a problem with a log file like [[dayfile.txt]].  If you don't specify a file name, then nano will create a new file and you will need to specify where to save it before exit.
5,838

edits