OIKT-zagovor 1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Change to the chapters directory and use the tilde (~) home directory shortcut to move all book chapters to the chapters directory. Move the first two chapters to the editor directory. Use brace expansion with a range to specify the chapter file names to move and a relative path for the destination directory. Use a single command to move the chapters 7 and 8 from the chapters directory to the vacation directory. Specify the chapter file names by using brace expansion with a list of strings an

"[student@serverb ~]$ cd Documents/my_bestseller/chapters [student@serverb chapters]$ mv ~/mystery_chapter* . [student@serverb chapters]$ mv mystery_chapter{1..2}.odf ../editor [student@serverb chapters]$ mv mystery_chapter{7,8}.odf ../vacation

Save your changes and exit the file.

To save and exit the file, enter the last-line :wq command.

Enter the visual line mode of Vim and remove the rows that contain the Desktop and Public strings.

Use the arrow keys to position the cursor at any character on the Desktop row. Enter visual mode with uppercase V. The full line is selected. Delete the selection by typing x. Repeat the operation for the row with the Public string.

Enter the visual mode of Vim. Remove the last seven characters from the first column on the first line. Preserve only the first four characters of the first column. Use the arrow keys to position the cursor at the last character of the first column on the first line. Delete the selection by typing x.

Use the arrow keys to position the cursor at the fifth character of the first column on the first line. Enter the visual mode by typing v

Enter the visual block mode of Vim. Repeat the operation of the previous step, but this time select from the second to the last line. Preserve only the first four characters of the first column.

Use the arrow keys to position the cursor at the fifth character of the second line. Enter the visual mode by using the Ctrl+V control sequence. Use the arrow keys to position the cursor at the last character of the first column on the last line. Delete the selection by typing x.

Enter the line-based visual mode of Vim. Your screen output might differ from these examples. Remove the first three lines of the editing_final_lab.txt file.

Use the arrow keys to position the cursor at the first character in the first line. Enter the line-based visual mode with Shift+V. Move down by using the down arrow key twice to select the first three lines. Delete the lines by typing x.

Enter the visual block mode of Vim to remove the time column, to leave the month and day columns on all lines.

Use the arrow keys to position the cursor at the first character of the current seventh column. Enter the visual block mode by typing Ctrl+V. Use the arrow keys to position the cursor at the last character of the seventh column on the last row. Delete the selection by typing x.

Enter the visual block mode of Vim and remove the fourth column of the file.

Use the arrow keys to position the cursor at the first character of the fourth column. Enter the visual block mode by using Ctrl+V. Use the arrow keys to position the cursor at the last character and row of the fourth column. Delete the selection by typing x.

Change your working directory to ~/Videos/season2, and then copy the first episode of the season to the vacation directory. Use a single cd command to change from your working directory to the ~/Documents/my_bestseller/vacation directory, list its files and use the previous working directory argument to return to the season2 directory. Copy the episode 2 file into the vacation directory. Use the shortcut again to return to the vacation directory

[student@serverb chapters]$ cd ~/Videos/season2 [student@serverb season2]$ cp *episode1.ogg ~/Documents/my_bestseller/vacation [student@serverb season2]$ cd ~/Documents/my_bestseller/vacation [student@serverb vacation]$ ls [student@serverb vacation]$ cd - [student@serverb season2]$ cp *episode2.ogg ~/Documents/my_bestseller/vacation [student@serverb season2]$ cd - mystery_chapter7.odf tv_season2_episode1.ogg mystery_chapter8.odf tv_season2_episode2.ogg

Delete the changes directory Delete vacation directory it by using the rm command with the recursive option. When finished, return to the student user's home directory.

[student@serverb my_bestseller]$ cd .. [student@serverb my_bestseller]$ rm -r changes [student@serverb my_bestseller]$ rm -r vacation [student@serverb my_bestseller]$ cd [student@serverb ~]$

Change your current directory to the changes directory and use the date +%F command with command substitution to copy the mystery_chapter5.odf file to a new file that includes the full date. Use the mystery_chapter5_YYYY-MM-DD.odf name format. By using command substitution with the date +%s command, make another copy of mystery_chapter5.odf, and append the current time stamp (as the number of seconds since the epoch, 1970-01-01 00:00 UTC) to ensure a unique file name.

[student@serverb my_bestseller]$ cd changes [student@serverb changes]$ cp mystery_chapter5.odf \ mystery_chapter5_$(date +%F).odf [student@serverb changes]$ cp mystery_chapter5.odf \ mystery_chapter5_$(date +%s).odf

Copy both files from the ~/Documents/my_bestseller/chapters directory to the ~/Documents/my_bestseller/changes directory to prevent these changes from modifying original files. Navigate to the ~/Documents/my_bestseller directory. Use square-bracket pattern matching to specify which chapter numbers to match in the filename argument of the cp command.

[student@serverb vacation]$ cd ~/Documents/my_bestseller [student@serverb my_bestseller]$ cp chapters/mystery_chapter[56].odf changes

Create a hard link to the ~/Documents/project_plans/season2_project_plan.odf file called ~/Documents/backups/season2_project_plan.odf.back.

[student@serverb ~]$ ln ~/Documents/project_plans/season2_project_plan.odf \ ~/Documents/backups/season2_project_plan.odf.back

Create the my_bestseller directory under the Documents directory. Create the chapters directory under the my_bestseller directory. Create three directories called editor, changes, and vacation, under the my_bestseller directory by using a single command.

[student@serverb ~]$ mkdir -p Documents/my_bestseller/chapters [student@serverb ~]$ mkdir Documents/my_bestseller/{editor,changes,vacation}

Create two subdirectories called season1 and season2 under the Videos directory by using a single command. Move the appropriate TV episodes into the season subdirectories by using only two commands.

[student@serverb ~]$ mkdir -p Videos/season{1..2} -- [student@serverb ~]$ mv tv_season1* Videos/season1 [student@serverb ~]$ mv tv_season2* Videos/season2

Create a directory called project_plans in the Documents directory. The Documents directory is placed in the student user's home directory. Create two empty files in the project_plans directory called season1_project_plan.odf and season2_project_plan.odf. Hint: If the ~/Documents directory does not exist, then use the mkdir command -p option to create it.

[student@serverb ~]$ mkdir -p ~/Documents/project_plans [student@serverb ~]$ touch \ ~/Documents/project_plans/{season1,season2}_project_plan.odf

As the author of a successful series of mystery novels, you are editing your next bestseller's chapters for publishing. Create eight files with mystery_chapterX.odf names. Replace X with the numbers 1 through 8.

[student@serverb ~]$ touch mystery_chapter{1..8}.odf

Create sets of empty practice files to use in this lab. If you do not immediately recognize the intended shell expansion shortcut, then use the solution to learn and practice. Use shell tab completion to locate file path names. Create 12 files with tv_seasonX_episodeY.ogg names in the /home/student directory. Replace X with the season number and Y with that season's episode, for two seasons of six episodes each.

[student@serverb ~]$ touch tv_season{1..2}_episode{1..6}.ogg

Back up the editing_final_lab.txt file and append the date (in seconds) at the end of the file name preceded with an underscore (_) character. Use the lab_file shell variable.

[student@workstation ~]$ cp $lab_file \ editing_final_lab_$(date +%s).txt

Use the date command to display the current time and date.

[student@workstation ~]$ date

Display the current time in 24-hour clock time (for example, 13:57). Hint: The format string that displays that output is %R.

[student@workstation ~]$ date +%R

Append a dashed line to the editing_final_lab.txt file. The dashed line should contain 12 dash (-) characters for this lab to be graded correctly. Use the lab_file shell variable.

[student@workstation ~]$ echo "------------" >> $lab_file

What kind of file is /home/student/zcat? Is it readable by humans?

[student@workstation ~]$ file zcat

Display the first 10 lines of the zcat file.

[student@workstation ~]$ head zcat

Use the shell history to run the date +%R command again.

[student@workstation ~]$ history [student@workstation ~]$ !2

On workstation, create the lab_file shell variable and assign editing_final_lab.txt as the value. List the student home directory, including hidden directories and files, and redirect the output to the editing_final_lab.txt file by using the shell variable.

[student@workstation ~]$ lab_file=editing_final_lab.txt [student@workstation ~]$ ls -al > $lab_file

List the content of the Documents directory, and append the output to the editing_final_lab.txt file, and display the output in the terminal. Use the tee command and the lab_file shell variable.

[student@workstation ~]$ ls Documents/ | tee -a $lab_file lab_review.txt

Use the tail command -n 20 option to display the last 20 lines in the file. Use command-line editing to accomplish this task with a minimal number of keystrokes.

[student@workstation ~]$ tail -n 20 zcat

Display the last 10 lines of the zcat file.

[student@workstation ~]$ tail zcat

Use Vim to edit the editing_final_lab.txt file. Use the lab_file shell variable.

[student@workstation ~]$ vim $lab_file

Use the wc command and Bash shortcuts to display the size of the zcat file.

[student@workstation ~]$ wc zcat

Repeat the previous command exactly with four or fewer keystrokes.

[student@workstation]$ !!

Confirm that the directory listing is at the bottom of the lab file. Use the lab_file shell variable.

student@workstation ~]$ cat $lab_file


Set pelajaran terkait

National Flood Insurance Program

View Set

Pays et capitales d'Amérique du Sud

View Set

Mental Health Nursing -chapter 10, 11,12

View Set

First certificate language practice-Consolidation 1

View Set

Grammar Study Guide - Semicolon and Colons

View Set