In this lab, you will edit a file with gedit, selecting text and pasting it into the editor.
Outcomes
An edited list of the configuration files found in the user's home directory.
Perform the following steps on serverX unless directed otherwise.
Log in as student and begin in student's home directory.
Redirect a long listing of all home directory files, including hidden, into a file named gedit_lab.txt. Confirm that the file contains the listing.
[student@serverX ~]$cd[student@serverX ~]$ls -al > gedit_lab.txt[student@serverX ~]$cat gedit_lab.txt
Open the file with the gedit text editor. Include the ending ampersand so that the shell prompt can return while gedit is running.
[student@serverX ~]$gedit gedit_lab.txt &
Insert the date at the top of your file document.
In the shell command window, display today's date with day of the week, month, date, and year.
[student@serverX ~]$date +%A", "%B" "%d", "%YFriday, February 21, 2014
Select the text using the mouse.
![]() |
Insert the text at the top of the file document. Switch to the gedit window. Using arrow keys, place the cursor at the upper-left corner of the document. Press the middle mouse button to paste the text.
Press Enter one or more times at the end of the inserted text to open blank lines above the file listing.
Insert a description for this document, including your username and host name, on line 2.
In the shell command window, create descriptive text using shell expansion concepts to include the username and host name where the file list was generated.
[student@serverX ~]$echo "$USER's configuration files on" $(hostname)student's configuration files on serverX.example.com
Select the text using the mouse.
![]() |
Insert the text on the second line of the file document. Switch to the gedit window. Using the arrow keys, place the cursor at the second line's leftmost character. Press the middle mouse button to paste the text.
Press Enter or Delete, as necessary, to maintain blank lines above the file listing.
Remove file lines that are not hidden configuration files or directories.
Remove the “total” line at the beginning of the listing.
Remove the two lines representing the current directory and the parent directory.
Remove lines for file names that do not start with a dot. Do not edit or remove lines for hidden files or directories that begin with a dot.
The final file document should be similar to the following image. Manually edit the file to make corrections. The asterisk in the document tab or window header is a reminder of edits unsaved. Save the file and exit gedit.
![]() |