PROG-325 Checkpoint 1-4 Solutions
PROG-325 Checkpoint 1-4 Solutions
1.
2.
To find out where you are what command do you use? Write the command: pwd
3.
4.
Change the permissions to checkpoint so the Owner had full rights, the group has read and execute
and all others have nothing. Write the command: chmod 750 checkpoint
5.
6.
Create an empty file called workfile. What three commands can you use to accomplish the
creating of an empty file:
7.
8.
> workfile
touch workfile
Use vi to create a file called first_names.txt. Put each of these names on a separate line:
Brian
John
Jane
Zoe
Lorraine
Use vi to create a file called last_names.txt. Put each of these names on a separate line:
Candido
Smith
Doe
Ripley
9.
What command can you use to view the contents of the first_names.txt and last_names.txt files
without using vi? Write the command: cat first_names.txt; cat last_names.txt
10. Copy first_names.txt and last_names.txt into a file called names.txt. All the contents from
first_names.txt should be placed first and the contents from last_names.txt should be placed after
the first_names.txt Write the command: cat first_names.txt last_names.txt > names.txt
11. Combine first_names.txt and last_names.txt into a file called full_names.txt. The first record from
first_names.txt should matched up with the first record from last_names.txt and then the second
and so on. Write the command: paste d first_names.txt last_names.txt > full_names.txt
12. Sort the contents for the names.txt file. Write the command: sort names.txt
13. Sort the contents of the names.txt file in reverse order and place into a file called names_sort.txt.
Write the command: sort r names.txt > names_sort.txt
14. Copy the names_sort.txt file to names_sort.txt.backup. Write the command: cp names_sort.txt
names_sort.txt.backup
15. Create a backup directory within the checkpoint directory. Write the command: mkdir backup
16. Copy all the txt files into the backup directory. Write the command: cp *.txt backup
17. Within the backup directory rename names_sort.txt to names_sorted.txt. Write the command:
mv backup/names_sort.txt backup/names_sorted.txt
Or
cd backup
mv names_sort.txt names_sorted.txt
18. With one command rename the checkpoint/names_sort.txt.backup to names_sorted.backup and
place into the backup directory. Write the command: mv names_sort.txt.backup
backup/names_sorted.backup
19. You are done with the backup directory and what to get rid of it and everything in it. There two
ways to do it. Write the commands:
1.
rm r backup
2.
cd backup
rm *
cd ..
rmdir backup
3.
rmdir r backup