01. Which of the following commands will send output from the program myapp to both standard output (stdout) and the file file1.log?
- cat < myapp | cat > file1.log
- myapp 0>&1 | cat > file1.log
- myapp | cat > file1.log
- myapp | tee file1.log
- tee myapp file1.log
02. Which of the following shell redirections will write standard output and standard error output to a file named filename?
- 2>&1 >filename
- >filename 2>&1
- 1>&2>filename
- >>filename
- 1&2>filename
03. Which of the following sequences in the vi editor saves the opened document and exits the editor? (Choose TWO correct answers.)
- esc ZZ
- ctrl :w!
- esc zz
- esc :wq!
- ctrl XX
04. Which of the following commands can be used to determine how long the system has been running? (Choose TWO correct answers.)
- uptime
- up
- top
- uname -u
- time Cup
05. Which of the following commands will reduce all consecutive spaces down to a single space?
- tr 's' ' ' < a.txt > b.txt
- tr -c ' ' < a.txt > b.txt
- tr -d ' ' < a.txt > b.txt
- tr -r ' ' '
- ' < a.txt > b.txt
- tr -s ' '< a.txt > b.txt
06. From a Bash shell, which of the following commands directly executes the instruction from the file /usr/local/bin/runme.sh without starting a subshell? (Please select TWO answers.)
- source /usr/local/bin/runme.sh
- . /usr/local/bin/runme.sh
- /bin/bash /usr/local/bin/runme.sh
- /usr/local/bin/runme.sh
- run /usr/local/bin/runme.sh
07. Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?
- fmt -f 1,4 /etc/passwd
- split -c 1,4 /etc/passwd
- cut -d : -f 1,4 /etc/passwd
- paste -f 1,4 /etc/passwd
08. When running the command
sed -e "s/a/b/" /tmp/file >/tmp/file
While /tmp/file contains data, why is /tmp/file empty afterwards?
- The file order is incorrect. The destination file must be mentioned before the command to ensure redirection.
- The command sed did not match anything in that file therefore the output is empty.
- When the shell establishes the redirection it overwrites the target file before the redirected command starts and opens itfor reading.
- Redirection for shell commands do not work using the > character. It only works using the | character instead.
09. Which of the following explanations are valid reasons to run a command in the background of your shell?
- The command does not need to execute immediately.
- The command has to run immediately but the user needs to log out.
- The system is being shut down and the command needs to restart execution immediately after the reboot.
- The command can run at a lower priority than normal commands run on the command line.
10. Which grep command will print only the lines that do not end with a / in the file foo?
- grep'/$' foo
- grep '/#' foo
- grep -v '/$' foo
- grep -v '/#' foo
Source: dumpsbase.com
0 comments:
Post a Comment