CS 315 Lab 02
A. Try to find the proper Linux commands that will answer the following questions. Hint: You can either find the answer from the textbook or from the Internet.
*You need to write the procedure that is necessary to accomplish the tasks listed below. Test to see if your answers are correct and type your correct answer under each question. Upload your finished lab document to the dropbox.
1. Use the ls command to list the contents of the root file system directory (/) on your system.
2. Use the ls -l command to view the contents of the root file system directory (/).
ls –l /
3. Determine the inode value for the /etc directory.
ls –i /
11. With your home directory as your current directory, use the command to remove read, write, and execute permissions from group and others for the spreadsheets directory. Next, verify that your change has taken place.
chmod 700 spreadsheets
12. Use the cat command to create a two-line file in your home directory called datainfo. On the first line enter 144 and on the second line enter 288. After the file is created, copy it from your home directory to the spreadsheets directory you created.
cp datainfo documents/spreadsheets
13. Determine the default permissions on the datainfo file your created. Next, set the permissions on the datainfo file so that the owner, group, and others can read and execute the file (otherwise leave the default settings as is).
chmod ugo+x datainfo
14. Append the current month’s calendar to the datainfo file that is in your home directory. Next copy your changed datainfo file over the older datainfo file in the spreadsheets directory, but use the copy option that prompts you before you overwrite the file in the spreadsheets directory. Check the contents of the datainfo file in the spreadsheets directory to make certain your copy was successful.
cal >> datainfo
cp -i datainfo documents/spreadsheets
15. Make the spreadsheets directory your working directory. Make copies of the datainfo file in the spreadsheets directory, so that one copy is named myinfo and one is named datadata. Next, use a wildcard character to list all files that start with “data.” Use a wildcard character to list all files that end with “info.” Use a wildcard character combination to list all files that have “ata” as the second, third, and fourth characters.
cp datainfo myinfo
cp datainfo datadata
16. Make certain you are in your home directory. Change your command prompt so that it shows your current working directory with an exclamation point, such as mydirectory! Change to the spreadsheets and then to the documents directory and notice how the prompt changes
17. Change to your home directory. Use the rmdir command to delete the spreadsheets directory. What happens?
it shows: rmdir: failed to remove `documents/spreadsheets': Directory not empty
18. Delete the datainfo files in both your home directory and in the spreadsheets directory. Also, delete the myinfo and datadata files in the spreadsheets directory.
19. Change to your home directory. Delete the spreadsheets directory and then delete the documents directory.