1.
What command shows you memory utilization?
Explanation
The command "free" shows the memory utilization by displaying the total amount of free and used memory in the system. On the other hand, the command "top" provides a dynamic real-time view of the system, including information about memory usage, CPU usage, and other system statistics. Both commands can be used to monitor memory utilization, but "free" specifically focuses on memory while "top" provides a broader overview of system performance.
2.
What command clears the contents of your terminal display?
Explanation
The correct answer is "clear". This command is used to clear the contents of the terminal display, removing all previous commands and output from the screen. The "reset" command, on the other hand, resets the terminal to its default settings, but does not clear the display.
3.
What command is used to change the permissions of a file?
Explanation
The command "chmod" is used to change the permissions of a file. This command allows the user to modify the permissions for the owner, group, and others on the file. By using different options and parameters with the "chmod" command, the user can grant or revoke read, write, and execute permissions for the file. This command is commonly used in Unix-like operating systems to manage file permissions and ensure the security and accessibility of files.
4.
What command is used to change ownership of a file?
Explanation
The command "chown" is used to change the ownership of a file. This command allows the user to transfer the ownership of a file to another user or group. By using "chown", the user can modify the permissions and access rights of a file, granting ownership to a specific user or group. This command is commonly used in Unix-based operating systems to manage file ownership and control access to files.
5.
What command allows you to view a file one page at a time?
Explanation
The correct answer is "less". The "less" command allows you to view a file one page at a time. It is a pager program that displays text files or the output of other commands on the terminal. It allows you to scroll through the file using the arrow keys or specific commands, making it easier to navigate through large files without overwhelming the screen with too much information at once. The "more" command is similar but has fewer features compared to "less".
6.
What is the default directory path for system log files?
Explanation
The default directory path for system log files is typically "/var/log" or "/var/log/". This is where various log files are stored on a Unix-like operating system. The logs contain important information about system events, errors, and activities, which can be useful for troubleshooting and monitoring the system's performance. The "/var/log" directory is commonly used by many Linux distributions and Unix-based systems to organize and store log files.
7.
What command is used to copy a file?
Explanation
The command "cp" is used to copy a file. This command allows the user to make a duplicate copy of a file or directory. By using the "cp" command followed by the source file and destination file, the file is copied from the source location to the specified destination.
8.
What command is used to change directories?
Explanation
The command "cd" is used to change directories in a command line interface. It allows the user to navigate through different directories or folders on the computer's file system. By typing "cd" followed by the desired directory name, the user can switch to that directory and access its contents. This command is commonly used in operating systems like Unix, Linux, and Windows Command Prompt.
9.
What do you type in to move to the parent directory
Explanation
The correct answer is "cd ..". This command is used to move to the parent directory in the command line interface. The ".." represents the directory immediately above the current directory. Another option, "cd ../", is also correct as it achieves the same result. However, the second option provided, "cd ../", is incorrect as it includes an extra forward slash ("/") which is not necessary.
10.
What is the command to delete a file?
Explanation
The command "rm" is used to delete a file in a Unix/Linux system. It stands for "remove" and is a basic command for deleting files. The command "rm -f" is a more forceful version of the "rm" command, where the "-f" flag is used to forcefully remove the file without prompting for confirmation. Both commands can be used to delete files, but "rm -f" is more commonly used when you want to delete files without any confirmation prompts.
11.
What is the command to run a program with elevated permissions?
Explanation
The command "sudo" is used to run a program with elevated permissions. It allows a user to execute a command as a superuser or another user, granting them temporary administrative privileges. This is commonly used in Unix-based operating systems to perform tasks that require higher privileges, such as installing software or making system changes.
12.
What is the command to switch to the root user account?
Explanation
The correct answer is "su". This command is used to switch to the root user account in Unix-like operating systems. "sudo su root" is also a valid command to switch to the root user account using the sudo command. "sudo su" alone can also be used to switch to the root user account, but it is not recommended as it can potentially cause security risks.
13.
If you want to protect files from deletion, you have to
Correct Answer
C. Change the file's directory write permission
Explanation
To protect files from deletion, you need to change the file's directory write permission. By modifying the directory write permission, you can prevent users from deleting or modifying files within that directory. This means that even if someone has write permission for the file itself, they won't be able to delete it if they don't have write permission for the directory containing it.
14.
If you want to protect files from content modifications, you have to
Correct Answer
A. Change the file write permission
Explanation
To protect files from content modifications, you need to change the file write permission. By changing the write permission, you can restrict users from making any changes to the file, ensuring its integrity and preventing unauthorized modifications. This allows you to maintain the original content and prevent any accidental or intentional alterations to the file. Changing the file read permission or the directory permissions would not directly address the issue of content modifications.
15.
If you want to restrict users from directory content listing, you have to
Correct Answer
D. Change the directory read permission
Explanation
To restrict users from directory content listing, you need to change the directory read permission. By changing the directory read permission, you can prevent users from viewing the contents of the directory, including any files or subdirectories within it. This ensures that the directory's content remains private and inaccessible to unauthorized users.
16.
Chmod 644 finance.doc644 equals to
Correct Answer
D. Rw- r-- r--
Explanation
The given answer, "rw- r-- r--", represents the permission settings for the file "finance.doc" when using the chmod command with the argument "644". In this case, "rw-" indicates that the owner of the file has read and write permissions, while "r--" indicates that the group and other users only have read permissions. This means that the owner can read and modify the file, while the group and other users can only read the file.
17.
The difference between "x" permission in file and directory, is
Correct Answer
C. Enter permission in directory, execute permission in file
Explanation
The correct answer is enter permission in directory, execute permission in file. In Unix-like operating systems, the "x" permission for a directory allows a user to enter (i.e., access) the directory, while the "x" permission for a file allows a user to execute (i.e., run) the file as a program. So, the difference between the "x" permission in a file and a directory is that it grants enter permission in a directory and execute permission in a file.
18.
The command to restrict user not to delete finance.doc within directory /home/budi
Correct Answer
D. Chmod -w /home/budi
Explanation
The correct answer is "chmod -w /home/budi". This command removes the write permission for the directory "/home/budi", which means that users will not be able to delete the file "finance.doc" within that directory. The other options either only modify the permissions of the file "finance.doc" or change the permissions of the entire directory without specifically targeting the file.
19.
You're now in directory X1 (see below). Moving to directory X3 using command:X1 <--- You're here |__ X2 |__ X3
Correct Answer
D. Cd X2/X3/
Explanation
The correct answer is "cd X2/X3/" because it correctly navigates to directory X3, which is located inside directory X2. The command "cd X2/X3/" specifies the path to directory X3 relative to the current directory X1.
20.
One single command to completely remove directory X1 and all it's contents (see below)X1 |__ X2 |__ X3
Correct Answer
D. Rm -rf X1
Explanation
The correct answer is "rm -rf X1" because the "rm" command is used to remove files and directories, and the "-rf" options are used to forcefully remove directories and their contents recursively. This means that the command will remove directory X1 and all its contents, including directory X2 and file X3.
21.
You're now in directory X3 (see below). Moving to directory X1 using command:X1 |__ X2 |__ X3
<--- You're here
Correct Answer
C. Cd ../..
Explanation
The command "cd ../.." is used to move up two levels in the directory structure. The ".." represents the parent directory, so using it twice moves up two levels. In this case, it will take you from directory X3 to the root directory.
22.
One single command to create new directory X3 inside new directory X2 inside new directory X1 (see below)X1 |__ X2 |__ X3
Correct Answer
C. Mkdir X1 X1/X2 X1/X2/X3
Explanation
The correct answer is "mkdir X1 X1/X2 X1/X2/X3" because this command creates a new directory called X1, then creates a new directory called X2 inside X1, and finally creates a new directory called X3 inside X2. This sequence of commands follows the given directory structure.
23.
The symbol represents home directory is?
Correct Answer
A. ~
Explanation
The symbol "~" is commonly used to represent the home directory in various operating systems, including Unix and Unix-like systems. The home directory is the default directory for a user when they log in, and it typically contains their personal files and settings. Using "~" as a shortcut allows users to quickly navigate to their home directory without having to specify the full path.
24.
The symbol represents current directory is?
Correct Answer
B. .
Explanation
The symbol "." represents the current directory in a file system. It is commonly used in command line interfaces to refer to the current working directory. This symbol allows users to navigate and access files and directories within the current directory without having to specify the full path.
25.
__________ command used to create an empty file.
Correct Answer
B. Touch
Explanation
The touch command is used to create an empty file.
26.
You want to change the permissions on the file named “fifteen” so that owner has all permissions while all other users don't have any permissions. Which command should you use?
Correct Answer
C. Chmod 700 fifteen
Explanation
The correct answer is "chmod 700 fifteen". This command will change the permissions of the file named "fifteen" so that the owner has all permissions (read, write, and execute), while all other users (group and others) don't have any permissions. The number "700" represents the permission settings, where the first digit (7) represents the owner's permissions, the second digit (0) represents the group's permissions, and the third digit (0) represents the permissions for others.
27.
How would you show a list of files and directories that are inside the current directory?
Correct Answer
B. Ls
Explanation
The correct answer for this question is "ls". In Unix-based systems, the "ls" command is used to list the files and directories that are inside the current directory. It provides a simple and concise way to view the contents of the current directory without displaying any additional information. This command is widely used by users to navigate and explore the file system.
28.
Which command to use for complete details of a command on the shell?
Correct Answer
C. Man
Explanation
The correct answer is "man". The "man" command is used to display the manual page for a given command on the shell. It provides detailed information about the command, including its syntax, options, and examples. By using the "man" command, users can access comprehensive documentation and get a complete understanding of how a specific command works.
29.
tail file
Correct Answer
B. Show bottom 10 lines
Explanation
The correct answer is "show bottom 10 lines" because the command "tail file" is used to display the last few lines of a file. By default, it displays the last 10 lines of the file. Therefore, the command "tail file" is equivalent to "show bottom 10 lines".
30.
head file
Correct Answer
B. Show top 10 lines
Explanation
The correct answer is "show top 10 lines" because the command "head" is used to display the beginning or top portion of a file. By typing "head file", it will show the first 10 lines of the file "file".
31.
mv file1 file2
Correct Answer
A. Rename or move file 1 to file 2
Explanation
The given command "mv file1 file2" is used to rename or move file1 to file2. It does not delete the files or copy file1 to file2.
32.
cp -r dir1 dir2
Correct Answer
C. Copy dir1 to dir 2, create dir 2 if it doesn't exist
Explanation
The given command "cp -r dir1 dir2" is used to copy the directory "dir1" and all its contents to the directory "dir2". If "dir2" does not exist, it will be created. This command does not involve copying or deleting individual files, it specifically deals with copying directories.
33.
pwd
Correct Answer
B. Show current directory
Explanation
The command "pwd" is used to show the current directory in a command line interface. It displays the full path of the current working directory, allowing the user to see where they are located within the file system. This can be helpful for navigating and organizing files and directories.
34.
ls -al
Correct Answer
C. Formatted listing with hidden files
Explanation
The command "ls -al" is used to display a formatted listing of files and directories in the current directory. The "-a" option includes hidden files in the listing, while the "-l" option provides detailed information about each file or directory, such as permissions, owner, size, and modification date. Therefore, the correct answer is "formatted listing with hidden files".
35.
ps
Correct Answer
C. Display currenty active processes
Explanation
The correct answer is "display current active processes" because out of the given options, it is the only one that pertains to showing the currently running processes on a system. The other options, such as displaying the date and time or showing a monthly calendar, are unrelated to displaying active processes.
36.
You want to the command foo to take its input from the file foobar and send its
output to the program bar. Which of the following command lines will do this?
Correct Answer
B. Foo < foobar > bar
Explanation
Command> file : Redirect the standard Output to file.
Command>>file : Append the standard output to file.
Commandfile à Redirect the standard error to file.
Command 2>>file à Append the Standard Error to file.
In B foo taking the input from foobar using < symbol and redirecting the output to >bar
file.
37.
You have just typed the following three commands and got the following output:
prompt> echo $PATH
/usr/bin:/usr/local/bin:usr/sbin:opt/kde/bin
prompt> pwd
/home/anna/games
prompt> ls
game1 game2 game3
You want to run the program game1, but get the response that it is not found.
What did you forget to do?
Correct Answer
A. To type ./game1 rather than game1.
Explanation
/home/anna directory is not set on path. So to execute the program
from the directory not set in path, should execute by givin full path or use the ./ .
If you are in /home/anna use ./ means under current directory.
To set the directory on path
PATH=$PATH:/home/anna/
38.
You want to search the file myfile for all occurrences of a string containing at leastfive characters, where character number 2 and 5 are "a" and character number 3 isNOT "b". Which command would you use?
Correct Answer
B. Grep .a[^b].a myfile
Explanation
String Processing Tools like grep, sed, awk uses wildcard characters.
. Ã Any Single character from the range
[abc] Ã Any Single Character from the set
[a-c] Ã Any Single Character from the Range
[^abc] Ã Any Single Character except from the set.
[^a-c] Ã Any Single Character except from the range.
According to QUESTION, in 2nd and 5th position must be a and in 3rd position not b.
B. . means any single character in first postion., a means a must be in second postions,
[^b] means b must not be in third postion, . means any single character in fourth position
and a in fifth position.
39.
In order to append the output of ls to a file called bazz, which of the following
command lines would you use?
Correct Answer
D. Ls >> bazz
Explanation
The correct answer is "ls >> bazz". This command line appends the output of the "ls" command to a file called "bazz". The ">>" symbol is used for appending output to a file, while ">" symbol is used for overwriting the file with the new output. The other options are incorrect because they either redirect the output to a file without appending it (">" and ">&") or use the incorrect syntax ("&>").
40.
You want to view a listing of previously entered commands. What command wouldyou use?
Correct Answer
D. History
Explanation
history command lists all commands in history. All history commands
stored in ~/.bash_history file.
41.
Which command will list the contents of a directory, listed by file modification time, in reverse order (last modified file shows up at the bottom of a listing)?
Correct Answer
D. Ls -lart
Explanation
The command "ls -lart" will list the contents of a directory, listed by file modification time, in reverse order. The "-l" option displays the files in a long format, including the modification time. The "-a" option includes hidden files in the listing. The "-r" option reverses the order of the listing, so that the last modified file shows up at the bottom. Finally, the "-t" option sorts the files by modification time.
42.
What is the command to take you to your home directory?
Correct Answer
D. All the above.
Explanation
The command "cd ~" takes you to your home directory by using the tilde symbol (~) as a shortcut for the home directory. The command "cd $HOME" also takes you to your home directory by using the environment variable $HOME, which represents the path to the home directory. Finally, the command "cd" without any arguments also takes you to your home directory, as it is the default behavior of the "cd" command when no directory is specified. Therefore, all the given options are correct ways to navigate to your home directory.
43.
How would you remove a directory that is not empty?
Correct Answer
A. Rm -r
Explanation
The correct answer is "rm -r". The "rm" command is used to remove files and directories in Unix-like operating systems. The "-r" option stands for "recursive", which means it will remove the specified directory and its contents, including any subdirectories and files within it. By using "rm -r", you can remove a directory that is not empty.
44.
How do you see hidden files in your home directory?
Correct Answer
B. Ls -la
Explanation
The correct answer is "ls -la". This command lists all files and directories, including hidden ones, in a detailed format. The "-l" option displays the files in a long format, showing permissions, owner, size, and other details. The "-a" option shows all files, including hidden ones that start with a dot. Therefore, using "ls -la" allows you to see hidden files in your home directory.
45.
How would you avoid accidentally removing files?
Correct Answer
A. Rm -i
Explanation
The option "rm -i" is the correct answer because it prompts the user for confirmation before deleting each file. This allows the user to double-check and avoid accidentally removing files. The other options, "rm -chk," "rm -a," and "rm -r," do not provide any confirmation and can lead to unintentional file removal.
46.
How do you copy an entire directory structure? E.g. from Project to Project.backup
Correct Answer
C. Cp -r Project Project.backup
Explanation
To copy an entire directory structure from "Project" to "Project.backup", the correct command is "cp -r Project Project.backup". The "-r" flag is used to recursively copy all files and directories within the "Project" directory to the "Project.backup" directory. This ensures that the entire directory structure is copied over. The other options, "cp Project Project.backup" and "mv Project Project.backup", do not include the "-r" flag and would only copy or move the top-level directory, without its contents. The option "mv -r Project Project.backup" is incorrect as the "-r" flag is not valid for the "mv" command.
47.
Which one of the following commands is equivalent to the following command for
user jdoe whose home directory is /home/jdoe?# chmod 754 ~/file1
Correct Answer
A. Chmod u=rwx,g=rx,o=r /home/jdoe/file1
Explanation
a. User mode 7 is the same as u=rwx, group mode 5 is the same as g=rx, and other mode 4 is the same as o=r. The ~/ syntax implies the user's home directory.
48.
Which command will display the last lines of the text file file1?
Correct Answer
D. Tail file1
Explanation
d. The tail command is used for checking the last lines of a text file. By default, it displays 10 lines.
49.
What two commands display the status of processes on a Linux system?
Correct Answer
B. Ps and top
Explanation
b. Both ps and top yield process status. None of the other listed commands are related to processes.
50.
Which one of the following statements correctly describes the > and
>> symbols in the context of the bash shell?
Correct Answer
B. > writes standard output to a new file, and >> appends standard output to an existing file.
Explanation
b. The > character opens and writes to a new file, while >> appends to an existing file, unless that file doesn't exist, in which case it is opened first.