010-160 practice question 3 of 15
Which of the following commands puts the lines of the file data.csv into alphabetical order?
Full set: 81 questionsThe sort command is a standard command-line utility in Linux and other Unix-like operating systems used to sort lines of text files. By default, without any specific options, sort arranges the lines of the input file (data.csv in this case) in lexicographical (i.e., alphabetical) order based on the current locale settings. The sorted output is then written to standard output. This command directly and efficiently accomplishes the task described in the question.
A. a..z data.csv is not a valid command; a..z is a syntax for character ranges in some contexts, but it is not an executable program for sorting.
C. abc data.csv is incorrect as abc is not a standard Linux command for sorting files.
D. wc -s data.csv is incorrect. The wc command is used to count lines, words, and characters, not to sort them. The -s option is not a valid sorting flag for wc.
E. grep --sort data.csv is incorrect. The grep command is used for searching text based on patterns, not for sorting the lines within a file.
1. GNU Coreutils Manual: The official documentation for sort states, "By default, sort writes the sorted contents of FILEs to standard output... The default sort is lexicographical, according to the current locale."
Source: GNU Coreutils, sort invocation. Section 22.1, "sort: Sort text files."
2. The Linux man-pages project: The manual page for the sort command provides a definitive description of its function.
Source: sort(1) Linux manual page. DESCRIPTION section: "Write sorted concatenation of all FILE(s) to standard output... Comparisons are based on one or more sort keys extracted from each line of input. By default, there is one key, the entire line."
3. MIT OpenCourseWare: University course materials on command-line tools consistently identify sort as the primary utility for this task.
Source: MIT, "The Missing Semester of Your CS Education," Lecture 2: Shell Tools and Scripting. The lecture demonstrates using sort to order lines from a file or standard input.
Keep practicing
Take the free 010-160 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 010-160 practice questions
- Question 1What can be found in the /proc/ directory?
- Question 2Which permissions are set on a regular file once the permissions have been modified with …
- Question 4Which of the following programs are web servers? (Choose two.)
- Question 5The file script.sh in the current directory contains the following content: #!/bin/bash e…
- Question 6Reverse DNS assigns hostnames to IP addresses. How is the name of the IP address 198.51.1…
- Question 7The current directory contains the following file: -rw-r—r— 1 root exec 24551 Apr 2 12:36…
