linux chp2
Which of the following commands enable(s) you to set permissions on a directory after you create it? (Choose all that apply.)
chmod
You have purchased a special monitor for your computer and the instructions tell you to make a minor modification to the inittab file. Where would you locate this file on a typical Linux system?
/etc
You are curious about the error and system logs kept by your operating system. In what main directory under the root (/) would you most likely find these logs?
/var
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
Enter cd to go to the home directory. Enter PS1="\w"! to change the command prompt. Use the cd documents and then cd spreadsheets commands to go to the documents directory and then the spreadsheets directory and notice that the command prompt changes to show that directory. Use cd .. to go to the documents directory and verify the prompt.
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.
Enter rm ~/documents/spreadsheets/datainfo and enter rm datainfo from the home directory, for example, to delete both instances of the file. Enter rm ~/documents/spreadsheets/myinfo and then enter rm ~/documents/spreadsheets/datadata.
Make certain you are in your home directory. Use a relative path to make your new documents directory the current working directory. Next, use a relative path to make the spreadsheets directory your current working directory. Now, use a command with dots in it to make the documents directory your current working directory.
First, enter cd documents and then enter cd spreadsheets. Next, enter cd .. to move back to the documents directory.
Make a directory under your home directory called documents. Next make a directory under the documents directory called spreadsheets. What is the absolute path for the spreadsheets directory?
First, students should use cd or pwd to make sure they are in their home directory (use cd to change to the home directory). Next, they should enter mkdir documents. Next, they can use cd documents and type mkdir spreadsheets. The absolute path is /home/username/documents/spreadsheets.
A friend of yours is trying to make more space on his hard disk drive and is considering deleting the /lib directory because he has heard it mostly contains games that he doesn't use. What is your recommendation?
Keep the /lib directory because it holds security information, shared library images, kernel modules and other important files.
Your company is discussing plans to migrate desktop and laptop users to Linux. One concern raised by the users is whether Linux supports the use of CDs and DVDs for both work files and for listening to music. Which of the following is an appropriate answer?
Linux supports both the UDF and iso9660 file systems for CD and DVD use.
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.
Make sure you are in your home directory. Enter cal >> datainfo. To copy the new file over the old one, with a verification prompt, enter cp -i datainfo ~/documents/spreadsheets. Last, to verify the contents of the file enter, (such as from the home directory) cat ~/documents/spreadsheets/datainfo (or students might use the more or less commands instead of cat).
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.
One way to change directories is to type cd documents and then cd spreadsheets. Enter cp datainfo myinfo and then cp datainfo datadata. Enter ls data* to list the files starting with data. Enter ls *info to list the files ending with info. Enter ls ?ata* to list the files with "ata" as the second, third, and fourth characters.
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).
Students can use the ls -l command, such as ls -l ~/documents/spreadsheets to determine the default permissions (-rw-rw-r--). To set the permissions enter chmod ugo+rx ~/documents/spreadsheets.
Change to the /dev directory. Next, access your home directory using a tilde (~) in the command that you employ.
Students should first enter cd /dev to go to the /dev directory. Next, they should enter cd ~ to return to their home directory.
Make the root file system directory your current working directory. What command can you use to verify that you are in the root file system directory? Return to your home directory.
Students should first type cd / to go to the root directory and then type pwd to verify that is their current working directory. Last, they use cd to go back to their home directory.
Change to your home directory. Use the rmdir command to delete the spreadsheets directory. What happens?
Students should see an error message that the directory is not empty.
Make /etc your current working directory and then go back to your home directory
Students should type cd /etc and then type cd to return to their home directories.
Use the ls -l command to view the contents of the root file system directory (/).
Students should type ls -l / to view the contents of the root directory.
Use the ls command to list the contents of the root file system directory (/) on your system.
Students should type ls / to view the contents of the root directory.
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.
The command students can use is: chmod go-rwx ~/documents/spreadsheets. To verify their work, students should enter ls -l ~/documents.
Determine the inode value for the /etc directory.
The command to determine the inode value is ls -i / .
Short answer: Your boss wants to use the command to view hidden files and also wants to know how to find them among other files. What do you tell her?
The command to view hidden files is ls -a. In the resulting list of files, the hidden files are the files that start with a dot (.) in front of the file name.
The file info.txt is in the help directory, which is a subdirectory of the /dev directory. What is the absolute path to info.txt?.
The full path is: /dev/help/info.txt.
Short answer: You have many files that begin with the word "account" and that end with two digits to designate a year, such as account00, account 01, and so on. What is the command that enables you to view all of these files that start with account?
The ls account?? command will display all of the files that start with account.
Short answer: When you see the permissions rwx--x--x associated with a file, what permissions are granted?
The permissions that are granted are: owner has read, write, and execute; group has execute; and others have execute.
You are helping a friend who is new to Linux. You want to determine which entries under her home directory are directories instead of files. When you perform a long listing of the home directory's contents, what do you use to distinguish a directory from a file?
The very first character in the line for an entry will be "d" for directory or "-" for an ordinary file
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.
To create the datainfo file, students can first use the cd command to make sure they are in their home directory. Next, they should type cat > datainfo, enter the two lines and type Ctrl+d. Finally, to copy the file they enter cp datainfo ~/documents/spreadsheets.
Change to your home directory. Delete the spreadsheets directory and then delete the documents directory.
Type cd. Enter rmdir ~/documents/spreadsheets and then enter rmdir documents.
Create a directory called secure under your home directory. Next, using the octal permission format, set security on the secure directory so that you have all permissions and no one else has any permissions.
Type mkdir secure and press Enter. Next type chmod 700 secure and press Enter.
Determine whether there are any hidden files in the /home directory.
Use the command ls -a /home. Typically, students will find there are no hidden files in /home.
Short answer: Where is virtual memory located?
Virtual memory is located on disk, such as in swap space.
Which of the following are file systems supported by UNIX and Linux operating systems? (Choose all that apply.)
a. NTFS, b. vfat, d. ufs, and e. ext
Which of the following are permissions that can be granted to a file? (Choose all that apply.)
b. write, c. execute, and e. read
You're frantically trying to get ready for a meeting and want to access a file in your home directory, but you are currently working in a public directory open to all users. What command can you enter to instantly go to your home directory?
cd
It's late and you have been working all day to finish a report. Before you go home you want to copy several files including your report file. What copy command should you use to ensure that you don't inadvertently copy an older report file over the newer report file you've been working on for the last four hours?
cp -u
You have created many notes to yourself that end in .txt. Which of the following commands enables you to list all of the .txt files in your home directory while you are in the Bash shell?
ls *.txt
A member of your department has given you permissions to view the contents of the accounting directory under his home directory. The name of his home directory is bramirez. Which of the following commands should you use to display the contents of the accounting directory?
ls /home/bramirez/accounting
You have been working in several directories for the past hour and right now you don't remember which directory you're in currently. What command can you use to show your current working directory?
pwd
Your boss is planning to do some house cleaning by deleting several old files. However, she mentions that she doesn't want to delete an important file inadvertently. What command can she use so that she is prompted to make sure she wants to delete a particular file?
rm -i