Use various editors to modify files.
Outcomes
Use the nano command-line editor to create and edit files.
Use the gedit text editor to edit files.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start files-edit
Instructions
Use the nano command-line editor to create the mytasklist.txt file and add two lines of text to the file.
Use the nano command with mytasklist.txt as the argument to create the file.
[student@workstation ~]$ nano mytasklist.txtThe title bar of the editor window displays the nano version and the name of the file.
The words [ New File ] appear at the bottom of the window.
Add your content by typing the following text into the window:
Always remember to make backups.Practice using the command line.
Review your content. Press Ctrl+x to exit the editor.
When prompted to save the file (save the modified buffer), press .
Press Enter when prompted to save the file name.
Confirm that the file was created and display the contents of that file.
Use the ls command to list the files in the current working directory.
[student@workstation ~]$ ls
Desktop Downloads Pictures Templates mytasklist.txt
Documents Music Public VideosDisplay the contents of the file with the cat command.
[student@workstation ~]$ cat mytasklist.txt
Always remember to make backups.
Practice using the command line.Use gedit to edit the mytasklist.txt file.
Add another line of text and confirm the change.
Open the gedit text editor.
Press Super to enter the , or click .
In the search field, type gedit, and then click .
Click in the upper left corner.
Click .
Click , select the mytasklist.txt file, and click .
Use the arrow keys to place the cursor at the end of the second line, and then press Enter to add a third line.
Type the following text.
Learn and practice during your free time.An asterisk (*) character appears at the top of the window before the file name.
This status indicates that the file changed and that the changes are not saved.
Click in the upper right corner.
Close the text editor window by clicking the icon in the upper right corner.
On the command line, display the contents of the file with the cat command.
[student@workstation ~]$ cat mytasklist.txt
Always remember to make backups.
Practice using the command line.
Learn and practice during your free time.The file contains the new line.