Pop quiz shows that members know basic Linux commands

Of the 733 TechRepublic members who took our Basic Linux Command Pop Quiz, how many do you think knew which command would take them directly to the root directory? Do you know the answer? Find out how our members did and how you would have done.

While Linux may never unseat Windows as the dominant desktop OS, many of our members will be ready if it does. More than 700 TechRepublic members took our recent Basic Linux Commands Pop Quiz, and the results were very positive. Four out of the five questions were answered correctly by at least 70 percent of the quiz takers. This is how the questions break down.


You can go home again

Figure A

The correct answer is cd, and 75 percent of our quiz takers got this correct, as shown in Figure A. To quickly change to the current user's home directory, type cd and press [Enter]. As for the other commands, ls displays a list of a directory's contents; vi is a text editor; dir is a variable, which stands for directory, that can be used with various shell commands; and pico is a text editor like vi.

Getting to the root

Figure B

The correct answer is cd /, and 72 percent of the members who took the quiz got this one right, as shown in Figure B. The cd command is used to change the working directory. If no directory is entered, the cd command will change the working directory to the home directory of the current user as pointed out in Question 1. When used with the slash (/) the cd command will change the working directory to the root directory. As for the other answers, ls .. displays a list of the current working directory's parent directory's contents, cd .. changes the working directory to the current directory's parent directory, cd root changes the working directory to a directory named root (but this isn't actually the root directory), and cd will change the working directory to the current user's home directory.

Where am I?

Figure C

The correct answer is pwd, and 64 percent of our quiz takers knew this answer, as shown in Figure C. The pwd command prints the full pathname of the current working directory. As for the other answers, I've already covered cd, dir, and ls. The locate command will search a database (or databases) for a particular filename and list the results.

The power to create

Figure D

The correct answer is mkdir test, and as shown in Figure D, 86 percent of those who took the quiz knew the correct answer. The mkdir command is used to create one or more directories. Write permission is required in the parent directory to create a directory. You can also use the –m option to set the access mode for the new directory and the –p directory to create parent directories if they don't already exist. For example, the command mkdir –m =r test will create a read-only directory called test. The command mkdir –p test1/test2 will create the directory called test1 with a subdirectory called test2.

As for the incorrect answers, the nwdir,mknwdir, and newdir commands are just made up, and you don't need to use quotation marks around the directory name when using the mkdir command to create a directory with no spaces in the directory name (as in this question). To create a directory with the name "test test", you would use the command mkdir "test test".

The power to delete

Figure E

The correct answer is rmdir test, and as shown in Figure E, 83 percent of our quiz takers knew the correct answer. The rmdir command is used to delete an empty directory. If you want to delete a directory and all its contents, you would use the rm –r command. You can use the –p option with the rmdir command to remove directories and their parent directories. As for the other answers (remove, dedir, deldir, or delete), none are actual Linux user commands.

Sharpen your Linux skills
For more Linux information, check out these other TechRepublic articles:

Send us your quiz topics
If you have a topic you'd like us to cover in an upcoming pop quiz, we want to hear about it. Drop us a line and share your suggestions for both quiz topics and questions. If you like to comment about this quiz, please post a comment to this article. Good luck on our next quiz!