UNCLASSIFIED
Linux Questions I create to test the students:
Friday @ 5:00pm
students:
1. Question: Which symbol represent the "pipe" command
A. ?
B. ~
C. |
D. >
2. Question: Which command does the same thing as "cat" but inverts the results...basically dumping the contents of the file to the screen, but with the last line first and the first line last
3. Question: which root sub-directory contains temporary files created by system and users; files under this directory are deleted when system is rebooted.
4. Question: What are two powerful features of the Linux command line shell which allow the output(or even input) of a program to be sent to a file or another program
5. Question: which command would you use to display the contents of "football.txt", beginning at line 3.
6. Question: Every single file and directory starts from this directory?
7. Question: List all files in /etc in long listing format and pipe it over to "more" command, so I can see a page at a time:
8. Question: write command to update printer.pdf when it is newer to the "/var" directory. The source file is located in the "~/tmp" directory.
9. Question: This command stands for "catenate" and displays the content of a file by dumping it to the screen
10. Question: which root sub-directory contains binary executables; commands used by all the users of the system are located here...for example: ps, ls, ping, grep, cp...
11. Question: Which command shows the last 10 lines of a text file, if no option is given
12. Question: This command is a filter for paging through text one screen at a time. Doesn't provide as many options
13. Question: This command opens a plain-text file viewer to view the file.
14. Question: Which command would you use to view "access.log" in real time
15. Question: This command is opposite of "tail" command. By default it displays the 1st ten lines of a text file
105. Question:
Create a tarball called /tmp/files.tar containing multiple files from the /etc directory: multiple file name are below
host.conf
shadow
passwd
yum.conf
16. Question: Which command would you write to copy "etc.txt" into a new filed called "etcbkup.txt", using your redirect ">" symbol. Source file is located in "~/var" directory. Destination file should be created in "~/tmp" directory. You are currently in the "~/" directory.
17. Question: This command is used to move files and directories or rename files
18. Question: Write the command to display the 1st 15 lines of "passwd.txt" file. Source location of file is "/etc" directory. Your current location is "~/tmp" directory.
19. Question: What type of log file is the "tac" command is useful for examining
20. Question: copy picture.jpg from /etc to your home your directory...your are logged in as root; you are currently in "/var" directory;
21. Question: To output the last 100 lines of "tech.txt" file, what command would you write? Source file is located in "~/tmp" directory. You are currently in "/" directory
22. Question: Which command would you write to append the content from "flower.txt" file to "lily.txt" file. Both files are located in "~/tmp" directory. You are currently in the "~/tmp" directory.
23. Question: This command can be used to move files and rename directories and files.
24. Question: write the command to rename "friday.txt" file to "lastfriday.txt" in the current directory. The source file is located in the "/var" directory
25. Question:Let's say you are the user steve and you have a directory, /home/steve/files, which contains many files and subdirectories. You want to copy all those files, and all the subdirectories (and the files and subdirectories they contain), to a new location, /home/steve/files-backup. Write the command you would use....
26. Question: Which option for the "cp" command is a force copy by removing the destination file
27. Question: Write the command to move all files in "~/backup" directory to the "~/tmp" directory. You are currently in "/" directory
28. Question: Which option would you use with the "mv" command for interactive prompt before overwrite?
29. Question: which command is used to create a new directory.
30. Question: which root sub-directory contains configuration files required by all programs; also contains startup and shutdown shell scripts used to start and stop individual programs. ex: resolv.conf
31. Question:Let's say you are the user student, and you have a bunch of files in the directory "/home/sally/pictures/" named picture-01.jpg, picture-02.jpg... and you want to copy them into the directory /home/sally/picture-backup/. Write the command you would use..
32. Question: Which option would you use with the "mv" command for force move by overwriting destination file without prompt
33. Question: Which option for the "cp" command is recursive copy (copy entire directory, including hidden files)?
34. Question: Which command would I type to remove directory "test2Dir".. There are 2 files inside the "test2Dir" directory... see structure below:
/var/test2Dir/
35. Question: Which option for the "cp" command, link files instead of copy
36. Question: which option would I use with the "rm" command to remove directories and their content recursively.
37. Question: I want to delete directory /test , but it has the following content inside
-- a directory call "test2"
-- a directory called "test3"
-- a file inside "test2" called animals.txt
38. Question: which root sub-directory stands for variable files; content of the files that are expected to grow can be found under this directory
39. Question: Which option for the "cp" command allows me to copy archive files?
101. Question:
How would you extract archive “/tmp/etc.tar” to the following location “~/tmp/etc_backup”. You are currently in “/var” directory?
40. Question: Which command will prompt me for every file or directory "rm" command tries to delete, if write-protected:
A. rm -f testDir
B. rm -r testDir
C. rm -rf testDir
42. Question: Which option would I use with "rm" command to ignore nonexistent files and never prompt before removing
43. Question: command to sort & display files by size
44. Question: this command is used to remove files and directories
45. Question: which commands stand for "Print Working Directory", which shows the current working directory you are in
46. Question: Which option is used to set directory permissions while using the mkdir command
47. Question: I want to delete sub-directory "test2" ... the parent directory is "test"... there is 1 file in the "test2" directory called exam.txt... What's the command to delete the "test2" directory
48. Question: this root sub-directory is the home directory for all users to store their personal files.
49. Question: command to sort files by modification time
50. Question: To create the following directory structure "/test/test2/test3" in one command, what command would you use.
51. Question: The rmdir command works with files also
- True or False
52. Question: command to display files in reverse order
53. Question: To create an empty file called "football.txt", which command should be used.
54. Question: command to display files in "long listing format"
55. Question: command to list all files (including hidden files)
56. Question: This command is used to remove directories
57. Question: This pathname always starts with the forward slash(/)
58. Question: what command (include short-cut symbol) will take you into your "home" directory
59. Question: this root sub-directory is the temporary mount directory where sysadmins can mount filesystems; should be empty and only used for temporary mount points
60. Question: I'm running a process or job and I want to cancel the running command, which key sequence do I use:
61. Question: Select the correct command:
1. mkdir /test/test2
2. mkdir -rf /test/test2
3. mkdir -p /test/test2
62. Question: Which option would you use with the mkdir command to create a complete directory structure in one command.
63. Question: What can I type to repeat the last command
64. Question: By default the "history" remembers the last ___ commands of any user.
65. Question: what command (include short-cut symbol) will take you to the previous directory
66. Question: which special symbol refers to the current working directory.
67. Question: This pathname starts from the current working directory.
68. Question: which key sequence will move the cursor backward one charater
69. Question: How would I change my history to show the last 25 commands?
70. Question: use this command to change the current working directory; used to navigate the directory tree
71. Question: which command displays the last commands you used
72. Question: How would you redirect both "stdout" and "stderr" to the same file of the following command:
"find / allfiles_n_errors.txt"
73. Question: Using "stdout" how would you send "echo It is Happy Friday" to the following "record.txt" file located in "home" directory. You are currently in the "/" directory. You are currently logged into the terminal as "student". You can overwrite any content that maybe in the file, if it already exists.
107. Question:
How would you uncompress the gzip tar file “bkup.tar.gz”?
74. Question: Using "stdout" Add the following line to the "record.txt" file listed in the previous question. "Each day is a Happy Day".You are still in "/" directory.
75. Question: To redirect both "stdout" and "stderr" to the same file, what do you use?
76. Question: How would you redirect any errors that exists from the following command: "find / > allfiles.txt"
77. Question: Mount the device (/dev/sdb1) to your home directory "project42". "project42" hasn't been created yet. What are the steps to mount device "/dev/sdb1".
78. Question: If you have successfully completed question "77" above, now unmount the device.
79. Question: Which command would you run to show the user-friendly way of looking at mounted file systems in human readable format?
80. Question: What command could I use to display all mounted file systems on /dev/sdb:
81. Question:
How would I mount the following device (/dev/hdb1) as read-only to the following location: /mnt/backup
82. Question:
Which command would I use to display all the contents of the /etc directory in long listing format, including the inode number?
83.Question:
Which command allows you to see how many inodes are used and free on mounted file systems?
84. Question:
What is an inode?
85. Question:
I have a file (ab*.sql) I'm having problems removing from directory /tmp, with an inode number 1448365. I've tried the "rm" command, but no success. What's another way to delete the file.
86. Question:
The ______contains all of the inodes and is created when you create the file system (with mkfs).
87. Question:
Each inode has a unique number (the inode number). Which command could you use to see the inode numbers?
88. Question:
There are two types of links, what are they?
89. Question:
Which link is this:
- Points to other files or directories, no matter where it is located
- Most flexible type link used
- There is a difference between original file and the link..If you remove the original file, the linked file won’t work
- Do not link to inodes, but create a name to name mapping
90.Question:
Create a symbolic link of the following file listed below to the destination location listed below:
Location of Source File: /var/linked.txt
Name of new linked file: slinked.txt
Destination file: “files” directory located under “~”
Your current location: /tmp
91. Question:
Which link can be used to point to a file that exists on the same device?
92. Question:
What command would you use to create a link?
93. Question:
Create an archive of the "/etc" directory and save to the "/tmp" directory of your "home" directory..you are currently in the "/" directory. . .name file etcbu.tar:
94. Question:
Which tar command option, creates a tarball?
95. Question:
Which tar command option, specifies a tarball name?
96. Question:
Which tar command option, compresses a tarball with bzip2?
97. Question:
Which tar command option, compresses a tarball with gzip command?
98. Question:
Which tar command option, extracts from a tarball?
99. Question:
Which tar command option, lists contents of a tarball
100. Question:
How would you list the contents of the following tar file (/tmp/passwd.tar)?
102. Question:
How would you list the specific file “etc/resolv.conf” in the “/backup/etc.tar” archive?
103. Question:
Write command to create gzip tar file and preserve the permissions:
Source: /etc
Tar file name: etc_backup.tar.gz
Destination: /backup
41. Question: Which command makes a copy of your files and directories?
A. mv
B. cp
C. pwd
104. Question:
Which command would you write to archive a copy of the “/var” directory to the “copy_of_etc” directory, located under the home directory?
106. Question:
How would you uncompress the following tar file: /etc/ebkup.tar?
Page 1 of 15
UNCLASSIFIED