Linux Review 2-2
Which of the following are directories defined by the Filesystem Hierarchy Standard? /bin /etc /mnt /dev
/bin /etc /mnt /dev
What directory contains all the files needed by the system for initial startup? The root directory /bin /sbin /boot
/boot
What is a soft link? A pointer to another file's inode. A new file containing the path name to another file's data blocks. A copy of the original file. A file with a file node which is a duplicate of the original file's inode.
A new file containing the path name to another file's data blocks.
A hard link is: A new file inode referring to the same data. A pointer to the inode of an existing file. A new file containing the path name to the original file. Any of the above can be a hard link.
A pointer to the inode of an existing file.
The output of the command: ls -l produces information about each file in the working directory including: File name, file size, and time. File type, link count, and date. Owner and owner's group. All of the above.
All of the above.
The root user has the authority to: Delete all user accounts (including management personnel) on the system without prior notification. Delete any file on the system including those, that if deleted, would make the system inoperable. Change or remove any password on the system without prior notification of the user. All of the above None of the above.
All of the above.
What command will create a soft link named: "mypass" to /etc/passwd? ln /etc/passwd mypass ln -s mypass /etc/passwd ln -s /etc/passwd mypass ln mypass /etc/passwd
ln -s /etc/passwd mypass
What command will create a new directory called sourcefiles? mkdir sourcefiles md sourcefiles make sourcefiles crdir sourcefiles
mkdir sourcefiles
What command can be used to rename files and directories? cp mv rename rn
mv
A identity of the current working directory can be displayed with what command? cwd dir pwd All of the above None of the above
pwd
What command will allow you to remove a link to a file? rm del delink ln -r
rm
What command will remove directory sourcefiles del sourcefiles rmdir sourcefiles rm sourcefiles delete sourcefiles
rmdir sourcefiles
A symbolic link is also known as a soft link and is depicted by an @ symbol appearing at the beginning of the filename when viewed using the ls -l command. True or False? True False
False
Hard links need not be on the same file system as the target file. True False
False
The ls -l ~ displays the long listing of all the files in your Home directory System s root directory $PATH directory All of the above None of the above
Home directory
The shell expands the characters: ~/ (a tilde followed by a slash) at the start of a pathname Into the pathname of your home directory. Into the pathname of the working directory. Into the pathname of the parent directory, Into the pathname of the root directory.
Into the pathname of your home directory.
An inode in Linux Is an entry in the lost&found directory Is the control structure for a file. Can be created using the mkinode command All of the above None of the above
Is the control structure for a file.
What does the mv command do? (choose all that apply) It makes a volume. It makes a directory. It moves a directory. It moves a file.
It moves a directory. It moves a file.
After creating a hard link to a file, the original file is deleted, what happens to the hard link? It is automatically removed. It still points to the file but the original name is deleted. It will point to nothing. You will get the error: "Unable to delete this file."
It still points to the file but the original name is deleted.
What must a user do to run cp or mv interactively and be asked whether to overwrite an existing file? Type cp -interactive or mv -interactive Type cp -i or mv -i Type interactive cp or interactive mv. Just type cp or mv as they run in interactive mode by default.
Just type cp or mv as they run in interactive mode by default.
What is the most common and preferred method of sharing files among selected Linux/UNIX users? Duplicate files. Common logins. Common group for selected users. Links
Links
If myprograms is a directory, what does the command: rm -r ~/myprograms do? Deletes myprograms only if it contains no files. Recursively deletes files including any subdirectories in myprograms, and then deletes the directory myprograms. Deletes all the subdirectories in myprograms and moves the files into the primary directory. None of the above.
Recursively deletes files including any subdirectories in myprograms, and then deletes the directory myprograms.
The which command ________________ Can only be used to search for executables. Searches for a file in all directories starting from the root. Is not valid in Linux Searches for a file only in directories listed in the PATH variable
Searches for a file only in directories listed in the PATH variable
Which type of link can be used to create a directory entry to a file in another file system? Hard link Soft link Cross system link Any type of link will work
Soft link
What does the /var diretory contain? Variety of additional programs Spools and log files Temporary files Files that are architecture independent. Local variable device files
Spools and log files
When you change the data in a file that is hard-linked to three others, _______________ Only the data in the file you modified is affected. Only the data in the file you modified and any hard linked files in the same directory are affected. The data in the file you modified and the data in all hard linked files are modified because they share the same inode, data, and size. The data in the file you modified as well as the data in all hard linked files are modified because they have different inodes.
The data in the file you modified and the data in all hard linked files are modified because they share the same inode, data, and size.
If a file to which a soft link exists is deleted, what happens? The soft link points to a non-existent file. The soft link is automatically removed. A file can not be deleted if a soft link to it exists. The original file can be accessed via the softlink even if the original file entry is removed.
The soft link points to a non-existent file.
To dereference a symbolic link means: To remove the link to the target file. To follow the link to the target file's data blocks. To change the symbolic link to the target file to a hard link. To temporarily gain owner permissions to the target file.
To follow the link to the target file's data blocks.
Given the following output from the ls command, how many files are linked with file1? drwxr-xr-x 3 root root 4096 Apr 8 07:12 Desktop -rw-r--r-- 3 root root 282 Apr 29 22:06 file1 -rw-r--r-- 1 root root 282 Apr 29 22:06 file2 -rw-r--r-- 4 root root 282 Apr 29 22:06 file3 -rw-r--r-- 2 root root 282 Apr 29 22:06 file4 -rw-r--r-- 1 root root 282 Apr 29 22:06 file5 -rw-r--r-- 1 user1 sys 282 Apr 29 22:06 file6 One Two Three Four
Two
What command will change the working directory to /home/rbass/sourcefiles? chdir /home/rbass/sourcefiles cd /sourcefiles cd /home/rbass/sourcefiles cdir /home/rbass/sourcefiles
cd /home/rbass/sourcefiles
If you have any empty directory called ~/backups, you can copy directory ~/courses into it by using the following command: cpdir ~/courses ~/backups cp -r ~/courses ~/backups dp -d ~/courses ~/backups All of the above None of the above
cp -r ~/courses ~/backups
Which command creates a link? link ln cp -l None of the above is correct.
ln