Note: This Question is unanswered, help us to find answer for this one
4. To assign the command ls -lah to the shortcut command lh, what command should you use?
Answer
Correct Answer:
Alias lh='ls -lah'
Note: This Question is unanswered, help us to find answer for this one
5. How can you copy a directory to another system with compression?
Answer
Correct Answer:
Tar cvzf - /wwwdata | ssh root@192.168.1.201
Note: This Question is unanswered, help us to find answer for this one
6. What are the results of the command with a user named jon? echo 'Hello, $(whoami)!'
Answer
Correct Answer:
Hello, $(whoami)!
Note: This Question is unanswered, help us to find answer for this one
7. To run a group of commands without spawning a subshell, which syntax would you use?
Answer
Correct Answer:
Command1; command2 )
Note: This Question is unanswered, help us to find answer for this one
8. When comparing items with case, what statement indicates an end to the evaluation block?
Answer
Correct Answer:
Esac
Note: This Question is unanswered, help us to find answer for this one
9. Wich operator sends the output of ls to a file for later use?
Answer
Correct Answer:
Ls > filelist.txt
Note: This Question is unanswered, help us to find answer for this one
10. How can you create a shared terminal in a Bash shell?
Answer
Correct Answer:
Screen
Note: This Question is unanswered, help us to find answer for this one
11. To make a Bash script named script.sh executable, what should you run?
Answer
Correct Answer:
Chmod +x script.sh
Note: This Question is unanswered, help us to find answer for this one
12. Which sed options should you use to change the second-to-last instance of variable to rock so it would read: A constant is a variable that is a rock that isn't variable var="A constant is a variable that is a variable that isn't variable" echo "$var" | sed _____
Note: This Question is unanswered, help us to find answer for this one
13. Which does the below command do? w
Answer
Correct Answer:
It displays information about the users currently on the machine.
Note: This Question is unanswered, help us to find answer for this one
14. Which one is true?
Answer
Correct Answer:
SELinux policy rules are checked after DAC rules.
Note: This Question is unanswered, help us to find answer for this one
15. What statement would you use to print this in the console? Shall we play a game? yes\no
Answer
Correct Answer:
echo "Shall we play a game? yes\\no"
Note: This Question is unanswered, help us to find answer for this one
16. What is the output of this code? VAR="This old man came rolling" echo "${VAR//man/rolling}"
Answer
Correct Answer:
This old rolling came rolling
Note: This Question is unanswered, help us to find answer for this one
17. What does this command sequence do? cat >notes -
Answer
Correct Answer:
It accepts text from the standard input and places it in the
Note: This Question is unanswered, help us to find answer for this one
18. The shell looks at the contents of a particular variable to identify which programs it can run. What is the name of this variable?
Answer
Correct Answer:
$PATH
Note: This Question is unanswered, help us to find answer for this one
19. What is the output of: VAR="This old man came rolling" echo "\${VAR//man/rolling}"
Answer
Correct Answer:
This old rolling came rolling
Note: This Question is unanswered, help us to find answer for this one
20. What does this command do? cat > notes -
Answer
Correct Answer:
Accepts text from standard input and places it in "notes"
Note: This Question is unanswered, help us to find answer for this one
21. In Bash, what does the comment below do? cd -
Answer
Correct Answer:
It moves you to the directory you were previously in.
Note: This Question is unanswered, help us to find answer for this one
22. What does the + signify at the end of the 10-digit file permissions on data.txt? ls -l -rwx------+ 1 user1 u1 0 Oct 1 10:00 data.txt
Answer
Correct Answer:
There is an access control list
Note: This Question is unanswered, help us to find answer for this one
23. When used from within a script, which variable contains the name of the script?
Answer
Correct Answer:
$0
Note: This Question is unanswered, help us to find answer for this one
24. When executing a command and passing the output of that command to another command, which character allows you to chain these commands together?
Answer
Correct Answer:
|
Note: This Question is unanswered, help us to find answer for this one
25. How would you find the last copy command run in your history?
Answer
Correct Answer:
History | grep cp
Note: This Question is unanswered, help us to find answer for this one
26. What will be the difference between the output on the screen and the contents of out.txt mysql < file.sql > out.txt
Answer
Correct Answer:
There will be no output on the screen as it's being redirected to out.txt.
Note: This Question is unanswered, help us to find answer for this one
27. What will be in out.txt? ls nonexistentfile | grep "No such file" > out.txt
Answer
Correct Answer:
Nothing, out.txt will be empty.
Note: This Question is unanswered, help us to find answer for this one
28. What file would match the code below? ls Hello[[.vertical-line.]]World
Answer
Correct Answer:
Hello|World
Note: This Question is unanswered, help us to find answer for this one
29. Which file allows you to save modifications to the shell environment across sessions?
Answer
Correct Answer:
~/.profile
Note: This Question is unanswered, help us to find answer for this one
30. What is the difference between the $@ and $* variables?
Answer
Correct Answer:
$@ treats each quoted argument as a separate entity. $* treats the entire argument string as one entity.
Note: This Question is unanswered, help us to find answer for this one
31. How can you gather history together for multiple terminals?
Answer
Correct Answer:
Shopt -s histappend
Note: This Question is unanswered, help us to find answer for this one
32. Which variable would you check to verify that the last command executed successfully?
Answer
Correct Answer:
$?
Note: This Question is unanswered, help us to find answer for this one
33. What Bash script will correctly create these files?
Answer
Correct Answer:
Touch file{1..10}.txt
Note: This Question is unanswered, help us to find answer for this one
34. What do you use in a case statement to tell Bash that you're done with a specific test?
Answer
Correct Answer:
; ;
Note: This Question is unanswered, help us to find answer for this one
35. What does this bash statement do? (( $a == $b ); echo $?
Answer
Correct Answer:
It tests whether the values of variables $a and $b are equal.
Note: This Question is unanswered, help us to find answer for this one
36. How could you get a list of all .html files in your tree?
Answer
Correct Answer:
Find . -name \*.html -print
Note: This Question is unanswered, help us to find answer for this one
37. Suppose your current working directory is your home directory. How could you run the script demo.sh that is located in your home directory? Find three correct answers. A. /home/demo.sh B. ./demo.sh C. ~/demo.sh D. bash /home/demo.sh E. bash demo.sh
Answer
Correct Answer:
B, C, E
Note: This Question is unanswered, help us to find answer for this one
38. What line of Bash script probably produced the output shown below? The date is: Sun Mar 24 12:30:06 CST 2019!
Answer
Correct Answer:
echo "The date is: $(date)!"
Note: This Question is unanswered, help us to find answer for this one
39. In order for a Bash script to be executed like an OS command, it should start with a shebang line. What does this look like?
Answer
Correct Answer:
#!/usr/bin/env bash
Note: This Question is unanswered, help us to find answer for this one
40. If prompted for text at the standard input, you can tell the command you're done entering text with what key combination?
Answer
Correct Answer:
Ctrl + D (Windows) or Command + D (Mac)
Note: This Question is unanswered, help us to find answer for this one
41. What is the output of this code? VAR="/var/www/html/website.com/html/"; echo "${VAR#*/html}"
Answer
Correct Answer:
/website.com/html/
Note: This Question is unanswered, help us to find answer for this one
42. How would you change your Bash shell prompt to the following? HAL>
Answer
Correct Answer:
export PS1="HAL>"
Note: This Question is unanswered, help us to find answer for this one
43. What is the result of this script? txt=Penguins [[ $txt =~ [a-z]{8} ]]; echo $?
Answer
Correct Answer:
1, representing 'false', because the variable "txt" does not contain eight lowercase letters between a and z
Note: This Question is unanswered, help us to find answer for this one
44. Which arithmetic expression will give the most precise answer?
Note: This Question is unanswered, help us to find answer for this one
45. What is the keyboard shortcut to call up the Bash history search as shown below? (reverse-i-search)`':
Answer
Correct Answer:
Ctrl + R
Note: This Question is unanswered, help us to find answer for this one
46. In order to extract text from the first column of file called textfile, which command would you use?
Answer
Correct Answer:
Cat textfile | awk '{print $1}'
Note: This Question is unanswered, help us to find answer for this one
47. How does the SUID or setuid affect executable commands?
Answer
Correct Answer:
When the command is executed, its running privileges elevate to the user owner of the command.
Note: This Question is unanswered, help us to find answer for this one
48. If file.sql holds SQL statements to be executed, what will be in file.txt? mysql < file.sql > file.txt
Answer
Correct Answer:
The non-error output of the MySQL command
Note: This Question is unanswered, help us to find answer for this one
49. Assuming that user1 existed, what would be the result of this command string? awk -F: '/user1/{print $1 "-" $3 "-" $6}' /etc/passwd
Answer
Correct Answer:
It would show the username, UID, and home directory of user1 separated by hyphens.
Note: This Question is unanswered, help us to find answer for this one
50. To permanently remove empty lines from a file called textfile, which command could you use?
Answer
Correct Answer:
Sed -i '/^$/d' textfile
Note: This Question is unanswered, help us to find answer for this one
51. The command below will search the root filesystem for files named "finance.db". In this context, what information is being sent to /dev/null? find / -name "finance.db" 1>results.txt 2>/dev/null
Answer
Correct Answer:
Information sent to the standard error-for example, errors that the find command displays as it runs
Note: This Question is unanswered, help us to find answer for this one
52. Using "awk", what would the output of this command string be? echo "1 2 3" | awk '{for (i=1; i<=NF; i++) s=s+$i};END {print s}'
Answer
Correct Answer:
6
Note: This Question is unanswered, help us to find answer for this one
53. To run a copy command in a subshell, which syntax would you use?
Answer
Correct Answer:
( command )
Note: This Question is unanswered, help us to find answer for this one