1.
Que comando será executado, cmd1 seguido por cmd2, independentemente do status de saída cmd1?
Correct Answer
C. cmd1 ; cmd2
Explanation
The correct answer is "cmd1 ; cmd2". The semicolon (;) is a command separator in the shell, which means that both cmd1 and cmd2 will be executed regardless of the exit status of cmd1. This allows for the sequential execution of multiple commands in the shell.
2.
Você tem dois scripts, foo e bar. Você deseja que o bar seja executado somente se foo retornar uma saída com status igual a 0. Selecione a alternativa correta.
Correct Answer
C. foo && bar
Explanation
The correct answer is "foo && bar". This is because the "&&" operator in shell scripting means "AND". So, the command "foo && bar" will execute the command "foo" first, and only if it returns a status of 0 (indicating success), the command "bar" will be executed.
3.
Qual a variável de ambiente é usada para exibir remotamente em outra máquina uma sessão X sua?
Correct Answer
A. DISPLAY
Explanation
The correct answer is DISPLAY. The DISPLAY variable is used to specify the remote machine and display number where X applications should be displayed. It is commonly used in Unix-like operating systems to enable X11 forwarding, allowing users to run graphical applications on a remote machine and have them displayed on their local machine.
4.
Você quer executar uma série de comandos de uma só vez. Qual a maneira mais rápida de fazer isto?
Correct Answer
C. Separar os comandos com ponto-e-vírgula (;) e pressionar enter
Explanation
Separating the commands with a semicolon (;) allows you to execute multiple commands in a single line, saving time and effort. By pressing enter after entering the commands, each command will be executed sequentially. This method is quicker than typing each command individually and pressing enter after each one or creating a script to execute the commands.
5.
No bash shell, executar o comando !! tem o mesmo efeito de qual dos seguintes comandos?
Correct Answer
B. Ctrl-P e Enter
Explanation
The command !! in the bash shell is used to execute the previous command. Similarly, Ctrl-P is a keyboard shortcut that is used to navigate to the previous command in the command history. Therefore, executing Ctrl-P and Enter will have the same effect as executing !!, which is to run the previous command.
6.
O que é descrito pelas variáveis PS1 e PS2?
Correct Answer
D. Prompt normal e prompt estendido.
Explanation
As per the given options, the variables PS1 and PS2 are described as the normal prompt and extended prompt. This means that these variables control the appearance and behavior of the command prompt in a Unix-like operating system. The PS1 variable defines the prompt displayed when waiting for a new command, while the PS2 variable defines the prompt displayed when a command is continued onto the next line.
7.
Depois de digitar um comando, você recebe uma mensagem de erro indicando sintaxe incorreta. Quem é o autor da mensagem?
Correct Answer
C. Comando ou Programa
Explanation
The correct answer is "Comando ou Programa". When you type a command, it is the command or program itself that is responsible for checking the syntax and providing an error message if it is incorrect. The shell, operating system, and kernel are all components of the system that facilitate the execution of the command, but they are not directly responsible for generating the error message.
8.
Você digitou o seguinte comando "ls -al /home/hadden". Quais teclas podem ser utilizadas para retirar o espaço entre a barra -/- e a palavra -hadden- sem redigitar o comando?
Correct Answer
B. Esc-b, Del
Explanation
The answer is "Esc-b, Del". Pressing the Esc key followed by the b key will move the cursor back one word. Then, pressing the Del key will delete the space between the slash and the word "hadden" without having to retype the whole command.
9.
Você está digitando uma linha de comando grande e complexa e você alcançou o fim da tela. Você quer continuar digitando, mas na linha abaixo. Quais as teclas que permitem isso?
Correct Answer
B. /, Enter
Explanation
The combination of the "/" key and the "Enter" key allows the user to continue typing on a new line below the current line.
10.
Você fez telnet em vários servidores ao mesmo tempo. Durante o dia você se sente perdido em qual sessão está conectado. Qual o comando no seu .profile resolveria este problema deixando claro em qual o servidor você está conectado?
Correct Answer
A. PS1="\h: \w>"
Explanation
The correct answer is PS1="\h: \w>". This command sets the prompt in the .profile file to display the hostname (\h) and the current working directory (\w). This will help the user easily identify the server they are connected to.
11.
Qual o programa que interpreta suas ações e comandos no sistema operacional?
Correct Answer
C. Shell
Explanation
A shell is a program that interprets user actions and commands in the operating system. It provides a command-line interface where users can interact with the system by typing commands. The shell takes these commands and executes them, allowing users to perform various tasks and control the system. Unlike utilities and applications, which are specific programs designed for particular functions, the shell acts as an intermediary between the user and the operating system, enabling them to access and manipulate system resources.
12.
Utilizando os conceitos de expressões regulares, descreva um metacharacter.
Correct Answer
B. Eles são caracteres de controle especiais usados na expressão regular.
Explanation
Metacharacters are special control characters used in regular expressions. They have special meaning and are used to define patterns and match specific characters or groups of characters in a string.
13.
Qual das respostas seguintes cria uma variável de ambiente VAR1 que possa estar presente em um processo bash filho?
Correct Answer
A. VAR1="fail" ; export VAR1
Explanation
This answer correctly creates a variable VAR1 with the value "fail" and exports it so that it can be accessed by a child bash process.
14.
Qual variável ambiental indica o caminho do seu diretório HOME?
Correct Answer
B. HOME
Explanation
The variable "HOME" indicates the path to the user's home directory in the environment. This directory is typically the default location where the user's personal files and settings are stored.
15.
Qual o comando você usaria para determinar qual o shell você está usando?
Correct Answer
D. echo $SHELL
Explanation
The correct answer is "echo $SHELL". This command will print the value of the SHELL environment variable, which typically contains the path to the current shell being used.
16.
Como você pode ler os conteúdos da variável PATH no bash shell?
Correct Answer
D. echo $PATH
Explanation
To read the contents of the variable PATH in the bash shell, you can use the command "echo $PATH". The "echo" command is used to display the value of a variable, and the "$" symbol is used to access the value of a variable. Therefore, "echo $PATH" will display the contents of the PATH variable in the bash shell.
17.
Qual variável de ambiente guarda a lista de diretórios que o shell usa para encontrar arquivos executáveis?
Correct Answer
PATH
Explanation
The correct answer is "PATH". The PATH environment variable stores a list of directories that the shell uses to search for executable files. When a command is entered in the shell, it checks each directory in the PATH variable in order to find the corresponding executable file. This allows users to run commands without specifying the full file path.
18.
Qual comando embutido no shell bash é utilizado para visualizar o histórico de comandos?
Correct Answer
history
Explanation
The correct answer is "history." In the bash shell, the "history" command is used to view the command history. It displays a list of previously executed commands, along with their line numbers. This command is helpful for recalling and reusing past commands, saving time and effort.
19.
A sua máquina Linux tem 2 monitores. Seu segundo monitor está configurado como a segunda tela da primeira apresentação. Se você quer que o programa "netscape" seja exibido em seu segundo monitor, Qual comando você deve usar antes de iniciar o Netscape?
Correct Answer
D. export set DISPLAY=:0:1; netscape
Explanation
The correct answer is "export set DISPLAY=:0:1; netscape". This command sets the display variable to ":0:1", which refers to the second monitor. By doing this, the program "netscape" will be displayed on the second monitor.
20.
Você deseja repetir o comando de número 3 em seu histórico de comandos. Como você faria isso?
Correct Answer
C. !3
Explanation
To repeat the command number 3 in the command history, you would use "!3". This is a shorthand notation that allows you to quickly rerun a specific command without having to retype it.
21.
Qual o arquivo que armazena o histórico de comandos do shell ?
Correct Answer
.bash_history
Explanation
The correct answer is ".bash_history". This file is responsible for storing the history of commands executed in the shell. It allows users to easily recall and reuse previously executed commands, making it a handy feature for productivity and troubleshooting purposes. By default, the .bash_history file is located in the user's home directory and can be accessed and edited using a text editor or the command line.
22.
Suponha que você tenha executado o seguinte comando: cp /etc/passwd /home/myuser , utilizando o histórico de comandos, como você faria para copiar o arquivo /etc/group para o diretório /home/myuser apenas substituindo a ocorrência do argumento passado no comando anterior?
Correct Answer
C. ^passwd^group
Explanation
The correct answer is "^passwd^group" because using the caret (^) symbol followed by the old and new strings, it allows you to replace the first occurrence of the old string with the new string in the previous command. In this case, it will replace "passwd" with "group" in the previous command "cp /etc/passwd /home/myuser".
23.
Qual comando history (Com parâmetro) irá limpar todo o histórico de comandos ?
Correct Answer
history -c
Explanation
The command "history -c" is used to clear the entire command history. By running this command, all previously executed commands will be removed from the history file, effectively erasing the entire command history.
24.
Qual dos seguintes comandos substitui o bootloader localizado em /dev/sda sem substituir a tabela de partição ou quaisquer dados que lhe segue ?
Correct Answer
C. dd if=/dev/zero of=/dev/sda bs=440 count=1
Explanation
The correct answer is "dd if=/dev/zero of=/dev/sda bs=440 count=1". This command uses the dd command to copy zeros from the /dev/zero device to the /dev/sda device. The "if" parameter specifies the input file as /dev/zero, and the "of" parameter specifies the output file as /dev/sda. The "bs" parameter specifies the block size as 440 bytes, and the "count" parameter specifies that only 1 block should be copied. This command replaces the bootloader located in /dev/sda without affecting the partition table or any data following it.
25.
Qual dos seguintes comandos podem ser usados para criar uma mídia de armazenamento USB de uma imagem de disco?
Correct Answer
D. dd
Explanation
The command "dd" can be used to create a USB storage media from a disk image. "dd" is a command-line utility in Unix-like operating systems that is used to convert and copy files. In this case, it can be used to create a bootable USB drive by copying the disk image onto the USB drive bit by bit.
26.
Em uma estrutura de diretório aninhada, qual opção de linha de comando seria usado para restringir o comando find para procurar por um determinado número de subdiretórios ?
Correct Answer
B. -maxdepth
Explanation
The correct answer is "-maxdepth". This option is used in the command "find" to restrict the search to a specific number of subdirectories. By specifying a number after "-maxdepth", the command will only search for files or directories within that number of levels deep from the starting directory.
27.
Qual dos seguintes comandos mata o processo com o PID 123, mas permite "limpar" antes de sair?
Correct Answer
D. kill -TERM 123
Explanation
The correct answer is "kill -TERM 123". The "-TERM" option sends a termination signal to the process with PID 123, allowing it to clean up any resources before exiting. The other options, "-PIPE", "-KILL", and "-STOP", send different signals that do not provide the process with the opportunity to clean up before termination.
28.
Que sinal está ausente no comando a seguir; "killall -s _______ daemon" que é comumente utilizado para instruir um daemon reinicializar-se, incluindo a leitura de arquivos de configuração ?
Correct Answer
HUP
SIGHUP
1
Explanation
The correct answer is "HUP". In the command "killall -s HUP daemon", the "-s" option is used to specify the signal to send to the process. The signal "HUP" (Hang Up) is commonly used to instruct a daemon to restart itself, including reading configuration files. "SIGHUP" is the signal name for "HUP", and "1" is the signal number for "HUP".
29.
Qual é o valor nice máximo que um usuário regular pode atribuir a um processo com o comando durante a execução de um novo processo ?
Correct Answer
B. 19
Explanation
A regular user can assign a maximum nice value of 19 to a process during the execution of a new process. The nice value is used in Unix-like operating systems to prioritize the execution of processes. A lower nice value indicates a higher priority for the process. Regular users typically have limited privileges and cannot assign extremely high priority to processes, hence the maximum value they can assign is 19.
30.
Imediatamente após a exclusão de 3 linhas de texto no vi e movendo o cursor para uma linha diferente, qual comando irá inserir o conteúdo excluído abaixo da linha atual?
Correct Answer
C. p (lowercase)
Explanation
After deleting 3 lines of text in vi and moving the cursor to a different line, the "p" command (lowercase) will insert the deleted content below the current line.
31.
Um usuário acidentalmente cria o subdiretório \dir no seu diretório home. Qual dos seguintes comandos irá remover esse diretório ?
Correct Answer
E. rmdir ~/\\dir
Explanation
The correct answer is "rmdir ~/\\dir". This command will remove the subdirectory named "dir" from the user's home directory. The tilde (~) represents the user's home directory, and the backslash (\) is used to escape the special character, so that it is interpreted as part of the directory name.
32.
Em conformidade com o FHS, em qual diretório as páginas de manuais (man pages) são encontradas?
Correct Answer
A. /usr/share/man
Explanation
According to the FHS (Filesystem Hierarchy Standard), the man pages are typically found in the "/usr/share/man" directory. This directory is commonly used to store the system's documentation, including the manual pages. It is a standard location for man pages in most Linux distributions. Other directories mentioned in the options, such as "/opt/man", "/usr/doc/", "/var/pkg/man", and "/var/man", are not the standard locations for man pages as per the FHS.
33.
Qual dos seguintes comandos irá enviar a saída do programa myapp tanto para a saída padrão (stdout) e para o arquivo file1.log ?
Correct Answer
D. myapp | tee file1.log
Explanation
The command "myapp | tee file1.log" will send the output of the program "myapp" to both the standard output (stdout) and the file "file1.log".
34.
Qual é o propósito do comando interno do bash chamado export ?
Correct Answer
D. Ele define as variáveis de ambiente para aplicações.
Explanation
O comando interno do bash chamado export é usado para definir variáveis de ambiente para aplicações. Isso significa que as variáveis definidas com o comando export estarão disponíveis para todos os processos que são executados a partir do shell atual. Isso é útil para configurar variáveis de ambiente que são necessárias para que um programa ou script funcione corretamente.
35.
Qual é o resultado da saída do comando a seguir; echo "Hello World" | tr -d aieou
Correct Answer
C. HllWrld
Explanation
The command "echo "Hello World" | tr -d aieou" is using the "tr" command to delete all occurrences of the letters "a", "i", "e", "o", and "u" from the input string "Hello World". Therefore, the resulting output is "HllWrld".
36.
Qual dos seguintes comandos é usado para alterar as opções e os parâmetros posicionais para uma bash em execução?
Correct Answer
C. set
Explanation
The "set" command is used to alter the options and positional parameters for a running bash. It allows the user to change various settings and configurations within the bash environment.
37.
A partir de um shell Bash, qual dos seguintes comandos executa diretamente as instruções do arquivo /usr/local/bin/runme.sh sem iniciar um subshell ? (Por favor, selecione duas respostas).
Correct Answer(s)
A. source /usr/local/bin/runme.sh
B. ./usr/local/bin/runme.sh
Explanation
The command "source /usr/local/bin/runme.sh" executes the instructions of the file "/usr/local/bin/runme.sh" without starting a subshell. The "source" command is used to read and execute commands from a file in the current shell environment. Similarly, the command "./usr/local/bin/runme.sh" also executes the instructions of the file "/usr/local/bin/runme.sh" without starting a subshell. The "./" prefix specifies that the file is in the current directory.
38.
Em relação ao comando; nice -5 /usr/bin/prog
Correct Answer
B. /usr/bin/prog é executado com nice lével 5.
Explanation
The correct answer is "/usr/bin/prog é executado com nice level 5." In the given command "nice -5 /usr/bin/prog", the option "-5" represents the nice level, which is a value ranging from -20 to 19. A lower nice level value indicates a higher priority for the process. Therefore, a nice level of 5 means that the process "/usr/bin/prog" is executed with a higher priority.
39.
No editor vi, qual dos seguintes comandos irá copiar a linha atual no buffer vi ?
Correct Answer
D. yy
Explanation
The command "yy" in vi will copy the current line into the vi buffer.
40.
Qual dos seguintes comandos irá reduzir todos os espaços consecutivos para um único espaço?
Correct Answer
A. tr '\s' ' ' < a.txt > b.txt
Explanation
The correct answer is "tr -s ' ' < a.txt > b.txt". This command uses the "tr" command to squeeze multiple consecutive spaces into a single space. The "-s" option tells "tr" to squeeze repeated characters, and the ' ' specifies the character to be squeezed, which in this case is a space. The command takes input from the file "a.txt" and redirects the output to the file "b.txt".
41.
Qual dos seguintes sinais são enviados para um processo quando a combinação de teclas CTRL+C é pressionada no teclado?
Correct Answer
B. SIGINT
Explanation
When the combination of keys CTRL+C is pressed on the keyboard, the signal SIGINT is sent to a process. This signal is used to interrupt the process and request it to terminate gracefully. It allows the process to clean up resources and perform any necessary actions before exiting.
42.
O que acontece após a emissão do comando vi sem quaisquer parâmetros adicionais ?
Correct Answer
D. vi começa no modo de comando e abre um novo arquivo vazio.
Explanation
After issuing the "vi" command without any additional parameters, it starts in command mode and opens a new empty file.
43.
Qual dos seguintes comandos define uma variável chamada TEST com o conteúdo FOO ?
Correct Answer
D. TEST="FOO"
Explanation
The correct answer is "TEST="FOO"". This is the correct command to define a variable called TEST with the content FOO. The other options either use incorrect syntax or do not follow the correct format for defining a variable.
44.
Qual dos seguintes comandos determina o tipo de um arquivo usando um arquivo de banco de dados de definição que contém informações sobre todos os tipos de arquivos comuns ?
Correct Answer
C. file
Explanation
O comando "file" determina o tipo de um arquivo usando um arquivo de banco de dados de definição que contém informações sobre todos os tipos de arquivos comuns.
45.
Qual é a ação padrão do comando split em um arquivo de entrada ?
Correct Answer
B. Ele vai quebrar o arquivo em novos arquivos de
1000 linhas.
Explanation
The correct answer is "Ele vai quebrar o arquivo em novos arquivos de 1000 linhas." This means that the split command will divide the file into new files, with each file containing 1000 lines.
46.
Quando canalizando a saída do comando find para o comando xargs, que opção é útil para encontrar nomes de arquivos que possuem espaços entre eles ?
Correct Answer
B. -print0
Explanation
The option "-print0" is useful when channeling the output of the "find" command to the "xargs" command to find file names that have spaces between them. This option separates the file names with a null character instead of a space, allowing the "xargs" command to correctly interpret the file names with spaces.
47.
Qual opção para o comando tee irá causar a saída para ser concatenado no fim do ficheiro de saída em vez de substituir o conteúdo do arquivo existente?
Correct Answer
A. -a
Explanation
The option "-a" for the tee command will cause the output to be appended to the end of the output file instead of replacing the content of the existing file.
48.
O que é que o símbolo "?" significa na seguinte expressão regular grep; grep '^d[aei]\?d$' /usr/share/dict/words
Correct Answer
C. Corresponde ao conjunto de caracteres anterior ([ aei ]) zero ou uma vez .
Explanation
The symbol "?" in the given regular expression "grep 'd[aei]?d$' /usr/share/dict/words" means that the character immediately preceding it, which is the set of characters [aei], can occur zero or one time. In other words, it allows for the possibility of that character being present or not in the matched string.
49.
Qual sinal é enviado para um processo em suspensão, a fim de ter que recomeçar a execução ?
Correct Answer
A. CONT
Explanation
The signal "CONT" is sent to a suspended process in order to restart its execution.
50.
Qual comando vi irá alterar os modos para que o texto possa ser digitado, digitando no teclado?
Correct Answer
B. i
Explanation
The correct answer is "i". In vi, the "i" command is used to switch to insert mode, allowing the user to type and edit text using the keyboard.