|
INTERVIEW QUESTIONS
OPERATING SYSTEMS
LINUX
DETAILS
Question: You have a file called phonenos that consists of two fields per line, telephone number and name, with the fields being separated by a comma (,). You want to have a list of the names only. Which command will accomplish this? Choose one:
a. cut -d, -f2 phonenos b. cut -d, -f1 phonenos c. cut -d -f2 phonenos d. cut -f2 phonenos
Answer: Answer: a
When using the cut utility, you can specify the character that is used to delimit the fields by using the -d option. Use the -f option to specify which field to return.
|
|
|
Category |
Linux Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9721 users |
Added on |
12/11/2009 |
Views |
72475 |
Rate it! |
|
|
Question:
You have a file called phonenos that consists of two fields per line, telephone number and name, with the fields being separated by a comma (,). You want to have a list of the names only. Which command will accomplish this? Choose one:
a. cut -d, -f2 phonenos b. cut -d, -f1 phonenos c. cut -d -f2 phonenos d. cut -f2 phonenos
Answer:
Answer: a
When using the cut utility, you can specify the character that is used to delimit the fields by using the -d option. Use the -f option to specify which field to return. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
You have a file named phonenos containing names and telephone numbers. Each line contains the telephone number followed by the name. You want to sort the file by telephone number in ascending order. Which of the following commands will accomplish this. Choose one:
a. sort phonenos b. sort -c phonenos c. sort -n phonenos d. sort -r phonenos
|
View Answer
|
|
When using sed to replace one term with another it will print every line in the file and then print each line every time it does a replacement. What option should you add to the command line to only print the lines that are changed? Choose one:
a. -n b. -p c. -g d. -f
|
View Answer
|
|
Which of the following commands will replace all occurrences of the word rate with the word speed in the file racing? Choose one:
a. sed s/rate/speed/g racing b. sed -n s/rate/speed/ racing c. sed s/rate/speed/ racing d. sed s2/rate/speed/ racing
|
View Answer
|
|
Your default umask is 002. What does this mean? Choose one:
a. Any file you create will have the permissions set as owner and group having read and write permissions; others as read only. b. Any file you create will have the permissions set as owner and group having read, write and execute permissions; others as read and execute. c. Any directoy you create will have the permissions set as owner and group having read, write and execute permissions; others as read and write permissions. d. Any directory you create will have the permissions set as owner and group having read and write permissions; others as read only.
|
View Answer
|
|
What is meant by sticky bit? Choose one:
a. When set on a directory, then only the owner of a file can delete it. b. When set on an executable, then any user can run the executable. c. When set on a file, only the owner can see the file in a directory listing. d. When set on a directory, then everyone has read, write and execute permission on the files contained in that directory.
|
View Answer
|
|
You have a file with permissions set as -rw-r--r-- 1 root admin 7202 Sep 17 9:10 phonenos What would be the effect of issuing the command chmod 4755?
Choose one: a. The owner would be given execute permission. b. To run the file you will have to give root's password. c. When executing the file phonenos it would be run under the same permissions as the owner's. d. Everyone would have the write permission to the phonenos file.
|
View Answer
|
|
You have a file with the following permissions -rw-r--r-- 1 root admin 7202 Sep 17 9:10 phonenos You want the members of the admin group to be able to modify the file. What command should you use? Choose one:
a. chmod 664 phonenos b. chmod 114 phonenos c. chmod 771 phonenos d. chmod 551 phonenos
|
View Answer
|
|
You have a directory with the following permissions drw-rw--w- 1 root admin 7202 Sep 17 9:10 administration and need to give everyone except root read only access to it. Which of the following commands will accomplish this? Choose one:
a. chmod uo=r administration b. chmod ug+r administration c. chmod uo+r administration d. chmod ug=r administration
|
View Answer
|
|
You copy the administration directory to George's home directory. -rw-rw--w- 1 root admin 7202 Sep 17 9:10 administration The only group that George is a member of is users. He calls you to say he cannot list the contents of the administration directory. Why can't he look at its contents since it is in his home directory? Choose one:
a. In order to view the contents of a directory, you must have read permission. George only has write permission. b. Only the owner of a directory can list its contents. c. George needs to change his default group to admin. d. George needs to make himself the owner of the administration directory.
|
View Answer
|
|
You have a file called administration with the following attributes -rw-rw-r-- 1 root admin 7202 Sep 17 9:10 administration George is a member of the admin group and Bob is a member of the sales group. Both George and Bob need to make changes to this file. What permissions do George and Bob have to the file? Choose one:
a. George has read and write permissions and Bob has read permission. b. Bob has read and write permissions and George has read permission. c. Both George and Bob have read and write permissions. d. Both George and Bob have read permission only.
|
View Answer
|
|
A listing of the /data directory shows drw-rw-r-- 1 root accounting 17249 Sep 7 10:08 accounting drw-rw-r-- 1 root admin 7202 Sep 17 9:10 administration drw-rw-r-- 1 root humres 13367 Sep 1 12:58 humres drw-rw-r-- 1 root sales 9449 Sep 22 7:34 sales George, who is a member of the admin group, attempts to delete a file contained in the humres directory but is unsuccessful. What do you and George need to do to allow George to delete files in this directory? Choose one:
a. You need to add George to the humres group then George needs to make the humres group his default group. b. You need to edit the /etc/passwd file to show the humres group as George's default group. c. Give George ownership of the humres directory. d. George needs to give you a list of files to be deleted and then you should delete them.
|
View Answer
|
|
Bob has created a new directory that will contain files that he and seven other users will be using for a new project. These eight users are the only members of the kickoff group. What does Bob need to do to give these users access to these files. Choose one:
a. Change the group on the new directory to kickoff using the chgrp command. b. Make each of the other seven users the owner of the files as they are created. c. Give the others group the read and write permission to the directory. d. Place the files in the ftp directory so each user can copy them to his own home directory.
|
View Answer
|
|
You copy a file to Bob's home directory that Bob needs to revise. However, when Bob attempts to open the file he is unsuccessful. What command do you need to use to give Bob ownershiop of the file?
|
View Answer
|
|
You issue the command ls -l memos and get the following output -rw-rw-r-- 1 bob users 17249 Sep 7 10:08 accounting -rw-rw-r-- 1 bob users 7202 Sep 17 9:10 administration -rw-rw-r-- 1 root users 13367 Sep 1 12:58 humres -rw-rw-r-- 1 bob users 9449 Sep 22 7:34 sales Bob opens the humres file and makes changes, however, he is unable to save the file after making changes. What is the problem? Choose one:
a. Bob is not a member of the users group and only has read access. b. Bob's quota has been exceeded. c. Only the owner of a file can make changes to it. d. The file humres is corrupted and he needs to save his changes to another file.
|
View Answer
|
|
How does the locate and find commands differ in their method of searching? Choose one:
a. locate uses the locatedb database and find searches the directory tree. b. find uses the finddb database and locate searches the directory tree. c. find searches the directory tree and the locate command only searches known directories. d. Both locate and find searches the directory tree.
|
View Answer
|
|
You need to locate a file called salesdata that one of your user's created in his home directory but you do not know which one. How could you use the find command to locate this file?
|
View Answer
|
|
You wish to create a link to the /data directory in bob's home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful.
|
View Answer
|
|
You have two files in two different directories with the same inode. What type of link is involved?
|
View Answer
|
|
You have a file called salesdata and create symbolic links to it in bob's home directory. Bob calls you and says that his link no longer works. How can you fix the link? Choose one:
a. The file salesdata has been deleted. You will have to restore it from a backup. b. You will need to delete the symbolic link in bob's directory and recreate it. c. Rename the link in bob's directory to salesdata.lnk. d. Change the owner of the link in bob's directory and change the permissions to give others read and write permissions.
|
View Answer
|
|
You have a large spreadsheet located in the /data directory that five different people need to be able to change. How can you enable each user to edit the spreadsheet from their individual home directories? Choose one:
a. Create a symbolic link in the /data directory. b. Copy the spreadsheet to each user's home directory. c. Create a hard link in each user's home directory. d. Create a script to move the spreadsheet to which ever user's home directory who needs to edit it.
|
View Answer
|