Performance Checklist
In this lab, you will edit a file using Vim's visual mode to simplify repetitive edits.
Outcomes
Familiarity with the utilities and techniques required to perform file editing. The final edited file will be a list of selected files and tabular data.
Perform the following steps on serverX unless directed otherwise.
Log in as student and begin in the student's home directory.
Redirect a long listing of all content in student's home directory, including
hidden directories and files, into a file named editing_final_lab.txt.
Your home directory files may not exactly match those shown in the example graphics.
This lab edits arbitrary lines and columns. The important outcome is to practice
the visual selection process.
[student@serverX ~]$cd[student@serverX ~]$ls -al > editing_final_lab.txt
Edit the file using Vim, to take advantage of visual mode.
[student@serverX ~]$vim editing_final_lab.txt
Remove the first three lines, since those lines are not normal file names. Enter line-based visual mode with upper case V.
Remove the permission columns for group and other on the first line. In this step, enter visual mode with lower case v, which allows selecting characters on a single line only.
![]() |
Remove the permission columns for group and other on the remaining lines. This step will use a more efficient block selection visual mode to avoid having to repeat the single line edit multiple times. This time, enter visual mode with the control sequence Ctrl+v, which allows selecting a block of characters on multiple lines.
![]() |
Remove the group owner column, leaving only one "student" column on all lines. Use the same block selection technique as the last step.
![]() |
Remove the time column, but leave the month and day on all lines. Again, use the block selection visual mode.
![]() |
Remove the Desktop and Public rows.
This time, enter visual mode with upper case V,
which automatically selects full lines.
![]() |
Save and exit. Make a backup, using the date (in seconds) to create a unique file name.
[student@serverX ~]$cp editing_final_lab.txt editing_final_lab_$(date +%s).txt
Mail the file contents as the message, not an attachment, to the user student.
[student@serverX ~]$cat editing_final_lab.txt | mail -s "lab file" student
Append a dashed line to the file to recognize the beginning of newer content.
[student@serverX ~]$echo "----------------------------------------" >> editing_final_lab.txt
Append a full process listing, but only for processes owned by the current user student and running on the currently used terminal.
View the process listing and send the listing to the file with one command line.
[student@serverX ~]$ps -f | tee -a editing_final_lab.txt
Confirm that the process listing is at the bottom of the lab file.
[student@serverX ~]$cat editing_final_lab.txt-rw- 1 student 7691 Mar 5 .bash_history -rw- 1 student 18 Jan 29 .bash_logout -rw- 1 student 193 Jan 29 .bash_profile -rw- 1 student 231 Jan 29 .bashrc drwx 12 student 4096 Feb 22 .cache drwx 18 student 4096 Feb 21 .config drwx 2 student 4096 Feb 23 Documents drwx 2 student 6 Feb 16 Downloads drwx 2 student 4096 Feb 23 Music drwx 2 student 6 Feb 23 Pictures drwx 2 student 24 Feb 22 .ssh drwx 2 student 6 Feb 16 Templates drwx 2 student 4096 Feb 23 Videos -rw- 1 student 1020 Feb 21 .viminfo ---------------------------------------- UID PID PPID C STIME TTY TIME CMD student 2005 2001 0 16:01 pts/0 00:00:00 /bin/bash student 26923 2005 0 19:14 pts/0 00:00:00 ps -f student 26924 2005 0 19:14 pts/0 00:00:00 tee -a editing_final_lab.txt