Explore key concepts of command line basics and essential CLI tools with this quiz, designed for beginners aiming to improve navigation, file management, and command usage skills. Strengthen your foundational understanding of terminal commands, command arguments, and common utilities in the tools ecosystem.
Which command allows you to change your current working directory to a folder named 'projects' located in your home directory?
Explanation: The 'cd' command is used to change directories, and '~/projects' refers to the 'projects' folder in your home directory. 'ls' lists files and directories but does not change the directory. 'pwd' prints the current directory's path, not change it. 'mv' moves or renames files and directories rather than allowing navigation.
If you want to list all files, including hidden ones, in your current directory using the command line, which command would you use?
Explanation: The 'ls -a' command displays all files and directories, including those that are hidden (which start with a dot). 'pwd -a' is invalid as 'pwd' does not have an '-a' option for listing. 'dir -h' shows file sizes in human-readable format but does not necessarily reveal hidden files. 'ls /hidden' incorrectly assumes a directory named 'hidden', not showing actual hidden files.
Which command displays the contents of a file named 'notes.txt' in your current directory without editing it?
Explanation: The 'cat' command is used for displaying the contents of a file directly in the terminal. 'rm notes.txt' deletes the file instead of showing its contents. 'touch notes.txt' is used to create or update a file's timestamp, not to read its content. 'cd notes.txt' would attempt to change into 'notes.txt' as if it were a directory, which is incorrect.
Suppose you want to create a duplicate of 'summary.doc' in the same directory and name it 'summary_backup.doc'; which command accomplishes this?
Explanation: The 'cp' command copies files, allowing you to make a duplicate with a new name. 'mv' moves or renames files but does not keep the original. 'rm' removes files, and using it as shown here is neither practical nor correct. 'cat summary.doc summary_backup.doc' displays the contents of both files, not copying them.
In the command 'ls -l /home/user', what does the '-l' option specifically change about the output?
Explanation: The '-l' option in 'ls' switches the output to a long-format, showing file details like permissions, size, and dates. It does not filter by file size, so it does not list only files larger than 1 megabyte. The command does not limit results to a specific number of files, nor does it exclude files that begin with 'l'; those are common misunderstandings.