LPI 101 - Comandos GNU/Linux 1- Marcus Vinicius Braga Alcantara

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Viniciusalcantar
V
Viniciusalcantar
Community Contributor
Quizzes Created: 11 | Total Attempts: 6,093
Questions: 100 | Attempts: 856

SettingsSettingsSettings
LPI 101 - Comandos GNU/Linux 1- Marcus Vinicius Braga Alcantara - Quiz

.


Questions and Answers
  • 1. 

    Qual o uso correto do comando mkdir para se criar a estrutura de diretórios dir/subdir1/subdir2 ?

    • A.

      mkdir -m dir/subdir1/subdir2

    • B.

      mkdir -p dir/subdir1/subdir2

    • C.

      mkdir -Z dir/subdir1/subdir2

    • D.

      mkdir dir/subdir1/subdir2

    Correct Answer
    B. mkdir -p dir/subdir1/subdir2
    Explanation
    The correct answer is "mkdir -p dir/subdir1/subdir2". The "-p" option is used to create parent directories if they do not exist. In this case, it will create the directory "dir" if it doesn't exist, then create the directory "subdir1" inside "dir" if it doesn't exist, and finally create the directory "subdir2" inside "subdir1" if it doesn't exist. This ensures that the entire directory structure "dir/subdir1/subdir2" is created.

    Rate this question:

  • 2. 

    Qual o correto comando usado para copiar o diretório de origem /etc e seus subdiretórios para o diretório de destino /tmp/etcbkp preservando os atributos originais dos arquivos ?

    • A.

      cp -r /etc /tmp/etcbkp

    • B.

      cp -uvi /etc/* /tmp/etcbkp/

    • C.

      cp -pR /etc /tmp/etcbkp

    • D.

      cp -i /etc/* /tmp/etcbkp/

    Correct Answer
    C. cp -pR /etc /tmp/etcbkp
    Explanation
    The correct answer is "cp -pR /etc /tmp/etcbkp". This command copies the directory /etc and its subdirectories to the destination directory /tmp/etcbkp while preserving the original attributes of the files. The "-p" option preserves the file attributes, including timestamps and permissions, and the "-R" option recursively copies the directory and its subdirectories.

    Rate this question:

  • 3. 

    Qual é a variável de ambiente que indica a quantidade de linhas que podem ser mantidas no histórico de comandos do shell Bash ?

    • A.

      HISTLIMIT

    • B.

      HISTORY

    • C.

      HISTLINES

    • D.

      HISTSIZE

    Correct Answer
    D. HISTSIZE
    Explanation
    HISTSIZE is the correct answer because it is the environment variable that indicates the maximum number of lines that can be stored in the command history of the Bash shell. By setting this variable to a specific value, users can control the size of their command history and limit the number of lines that are saved.

    Rate this question:

  • 4. 

    No diretório home do usuário user1 foi digitado o seguinte: "ln file1 file2 ; rm file1" . O que acontece em seguida?

    • A.

      file2 seria acessado normalmente.

    • B.

      file2 ficaria inacessível.

    • C.

      Seria pedido confirmação da ação.

    • D.

      file1 e file2 ficariam inacessíveis.

    Correct Answer
    A. file2 seria acessado normalmente.
    Explanation
    Após os comandos "ln file1 file2 ; rm file1" serem digitados no diretório home do usuário user1, o arquivo file2 seria acessado normalmente. O comando "ln file1 file2" cria um link simbólico chamado file2 que aponta para o arquivo file1. Em seguida, o comando "rm file1" remove o arquivo file1, mas o link simbólico file2 ainda permanece apontando para o mesmo local de armazenamento. Portanto, o arquivo file2 ainda pode ser acessado normalmente.

    Rate this question:

  • 5. 

    Qual é o resultado do comando a seguir ? sort -ur lista.txt | tr 'a-z' 'A-Z'

    • A.

      Ordena alfabeticamente o arquivo lista.txt invertendo o resultado, não exibindo conteúdo duplicado e convertendo caracteres minúsculos em maiúsculos.

    • B.

      O comando sort irá exibir o conteúdo do arquivo lista.txt de forma invertida por ordenação numérica. O resultado é passado para o comando tr que converte caracteres minúsculos em maiúsculos.

    • C.

      A ordenação alfabética é anulada pela opção -r do comando sort. As linhas do arquivo lista.txt terão caracteres minúsculos convertidos para maiúsculos.

    • D.

      Ordena alfabeticamente o arquivo lista.txt, não exibindo conteúdo duplicado e convertendo caracteres minúsculos em maiúsculos.

    Correct Answer
    A. Ordena alfabeticamente o arquivo lista.txt invertendo o resultado, não exibindo conteúdo duplicado e convertendo caracteres minúsculos em maiúsculos.
    Explanation
    The given command "sort -ur lista.txt | tr 'a-z' 'A-Z'" sorts the file "lista.txt" in alphabetical order, reverses the result, removes duplicate content, and converts lowercase characters to uppercase. The "sort" command with the options "-ur" sorts the file in reverse order and removes duplicate lines. The sorted result is then passed to the "tr" command, which translates lowercase characters to uppercase using the specified character mapping 'a-z' to 'A-Z'.

    Rate this question:

  • 6. 

    Qual o parâmetro do comando man que possui funcionalidade similar ao comando whatis quando desejamos obter páginas de manuais sobre o termo “Xorg” ?

    • A.

      man -f Xorg

    • B.

      man -w Xorg

    • C.

      man -a Xorg

    • D.

      man -K Xorg

    Correct Answer
    A. man -f Xorg
    Explanation
    The correct answer is "man -f Xorg". The "-f" parameter in the "man" command is used to search for manual pages that contain a specific keyword. In this case, it is used to search for manual pages related to the term "Xorg".

    Rate this question:

  • 7. 

    Qual comando abaixo exibe o contéudo do diretório /etc ?

    • A.

      /bin/ls -l /etc 1>/dev/null

    • B.

      /bin/ls -l /etc > /dev/null 2>&1

    • C.

      /bin/ls -l /etc >/dev/null

    • D.

      /bin/ls -l /etc >&1

    Correct Answer
    D. /bin/ls -l /etc >&1
    Explanation
    The command "/bin/ls -l /etc >&1" will display the content of the directory /etc. The "&>1" at the end redirects both the standard output and standard error to the file descriptor 1, which represents the standard output. This means that any output or error message generated by the command will be displayed on the console.

    Rate this question:

  • 8. 

    Qual comando abaixo concatena tanto a saída padrão e qualquer erro gerado ao arquivo saida.txt ? (Selecione 2 respostas).

    • A.

      ls -ltrR /usr 1>2 >> saida.txt

    • B.

      ls -ltR /etc 2>1 saida.txt

    • C.

      find / -exec ls -ld {} \; >> saida.txt 2>&1

    • D.

      find / -exec ls -ld {} \; 2>&1 >> saida.txt

    Correct Answer(s)
    C. find / -exec ls -ld {} \; >> saida.txt 2>&1
    D. find / -exec ls -ld {} \; 2>&1 >> saida.txt
    Explanation
    The correct answers are "find / -exec ls -ld {} \; >> saida.txt 2>&1" and "find / -exec ls -ld {} \; 2>&1 >> saida.txt". These commands redirect both the standard output and any errors generated to the file "saida.txt". The ">>" operator appends the output to the file, while "2>&1" redirects the standard error to the standard output.

    Rate this question:

  • 9. 

    Qual a correta sintaxe do comando man quando desejamos exibir uma página de manual que pertence a seção de número 6 ?

    • A.

      man -D 6 games

    • B.

      man -k 6 games

    • C.

      man -s 6 games

    • D.

      man -w 6 games

    Correct Answer
    C. man -s 6 games
    Explanation
    The correct syntax of the "man" command to display a manual page belonging to section number 6 is "man -s 6 games".

    Rate this question:

  • 10. 

    Qual é o argumento que é valido tanto para os comandos cp, mv e rm que ativa o chamado “modo interativo” ?

    • A.

      -f

    • B.

      -r

    • C.

      -i

    • D.

      -p

    Correct Answer
    C. -i
    Explanation
    The argument "-i" is valid for the commands cp, mv, and rm because it activates the "interactive mode." This means that before performing any action, the command will prompt the user for confirmation, allowing them to decide whether to proceed or not. This is a useful feature as it helps prevent accidental overwriting or deletion of files.

    Rate this question:

  • 11. 

    O seguinte resultado: 40 58 1815 /tmp/arquivo.txt pertence a qual comando ?

    • A.

      nl /tmp/arquivo.txt

    • B.

      uniq -c /etc/passwd

    • C.

      cat -vET /tmp/arquivo.txt

    • D.

      wc /tmp/arquivo.txt

    Correct Answer
    D. wc /tmp/arquivo.txt
    Explanation
    The given result "40 58 1815" is the output of the "wc /tmp/arquivo.txt" command. The "wc" command is used to count the number of lines, words, and characters in a file. In this case, the numbers 40, 58, and 1815 represent the number of lines, words, and characters respectively in the file "/tmp/arquivo.txt".

    Rate this question:

  • 12. 

    Qual afirmativa abaixo melhor descreve o programa xargs ?

    • A.

      Utiliza a saída de erros de um comando e redireciona tanto para um arquivo definido como para o terminal.

    • B.

      É um substituto do caracter pipe na união de dois comandos.

    • C.

      É utilizado em scripts de forma a controlar argumentos passados pela linha de comando.

    • D.

      Utiliza dados da saída padrão de um programa alimentando argumentos de um outro programa.

    Correct Answer
    D. Utiliza dados da saída padrão de um programa alimentando argumentos de um outro programa.
    Explanation
    The correct answer describes the program xargs as a tool that takes data from the standard output of one program and uses it as arguments for another program. This means that xargs can be used to pass the output of one command as input to another command, allowing for more complex and efficient command line operations.

    Rate this question:

  • 13. 

    Qual é o comando que possui a função de redirecionar a saída padrão de um comando em terminal e simultaneamente a isto em um arquivo ? (Especifique somente o comando) 

    Correct Answer
    tee
    Explanation
    The command "tee" is used to redirect the standard output of a command in a terminal and simultaneously save it to a file.

    Rate this question:

  • 14. 

    Qual comando abaixo exibe somente as linhas referente aos logins root e daniel do arquivo /etc/passwd ? 

    • A.

      egrep "(root:&daniel:)" /etc/passwd

    • B.

      fgrep root daniel /etc/passwd

    • C.

      egrep '^(root|daniel):' /etc/passwd

    • D.

      grep -E root:|daniel: /etc/passwd

    Correct Answer
    C. egrep '^(root|daniel):' /etc/passwd
    Explanation
    The correct answer is "egrep '^(root|daniel):' /etc/passwd". This command uses the egrep command with a regular expression pattern to match lines that start with either "root:" or "daniel:". It searches the file /etc/passwd and displays only the lines that match this pattern, which are the lines referring to the logins "root" and "daniel".

    Rate this question:

  • 15. 

    Qual dos comandos abaixo não exibe as linhas de comentário do arquivo /etc/services ? (Selecione 3 respostas).

    • A.

      egrep '^[^#]' /etc/services

    • B.

      grep -v '^#' /etc/services

    • C.

      grep “^#” /etc/services

    • D.

      sed -e “/^#/d” /etc/services

    Correct Answer(s)
    A. egrep '^[^#]' /etc/services
    B. grep -v '^#' /etc/services
    D. sed -e “/^#/d” /etc/services
    Explanation
    The given answer options (egrep '^[^#]' /etc/services, grep -v '^#' /etc/services, sed -e “/^#/d” /etc/services) are all commands that can be used to exclude or remove lines starting with a "#" symbol from the file /etc/services. The first command, egrep '^[^#]' /etc/services, uses the extended grep command to match lines that do not start with a "#". The second command, grep -v '^#' /etc/services, uses the grep command with the -v option to invert the matching and exclude lines that start with a "#". The third command, sed -e “/^#/d” /etc/services, uses the sed command to delete lines that start with a "#".

    Rate this question:

  • 16. 

    Qual das afirmativas sobre os comandos cat e tac são verdadeiras ? (Selecione 2 respostas).

    • A.

      cat exibe o conteúdo de um arquivo e tac faz o mesmo porém de trás para frente.

    • B.

      tac e cat possuem a opção -n que serve para numerar as linhas de saída de um arquivo.

    • C.

      tac é um link simbólico para o comando cat.

    • D.

      cat e tac podem ser usados para criar novos arquivos.

    Correct Answer(s)
    A. cat exibe o conteúdo de um arquivo e tac faz o mesmo porém de trás para frente.
    D. cat e tac podem ser usados para criar novos arquivos.
    Explanation
    The first statement is true because the "cat" command is used to display the content of a file, while the "tac" command does the same but in reverse order. The fourth statement is also true because both "cat" and "tac" can be used to create new files.

    Rate this question:

  • 17. 

    Qual programa utiliza o arquivo /usr/share/file/magic para determinar o tipo de um arquivo informado como parâmetro ? (Informe somente o comando).

    Correct Answer(s)
    file
    Explanation
    O programa "file" utiliza o arquivo /usr/share/file/magic para determinar o tipo de um arquivo informado como parâmetro. Ele analisa a estrutura interna do arquivo e fornece informações sobre o seu formato, como se é um arquivo de texto, imagem, áudio, etc.

    Rate this question:

  • 18. 

    Qual comando irá retornar quantas contas de usuários existem no arquivo /etc/passwd ?

    • A.

      count /etc/passwd

    • B.

      nl /etc/passwd

    • C.

      wc --users /etc/passwd

    • D.

      wc --lines /etc/passwd

    • E.

      expand --lines /etc/passwd

    Correct Answer
    D. wc --lines /etc/passwd
    Explanation
    The command "wc --lines /etc/passwd" will return the number of lines in the file /etc/passwd, which corresponds to the number of user accounts in the file.

    Rate this question:

  • 19. 

    Qual comando irá facilmente converter tabulações em espaços dentro de um arquivo ?

    • A.

      fmt

    • B.

      convert

    • C.

      expand

    • D.

      tr

    • E.

      sed

    Correct Answer
    C. expand
    Explanation
    The command "expand" will easily convert tabs into spaces within a file.

    Rate this question:

  • 20. 

    Qual o comando irá imprimir o número da linha antes do início de cada linha em um arquivo ?

    • A.

      ln

    • B.

      nl

    • C.

      tr

    • D.

      Numline

    Correct Answer
    B. nl
    Explanation
    The "nl" command is used to number lines in a file and can be used to print the line number before the start of each line in a file.

    Rate this question:

  • 21. 

    Qual comando built-in que pode ser usado para criar um atalho ou pseudonimo para um comando mais longo? Assumindo que o shell usado é um shell moderno como Bourne shell.

    • A.

      shortcut

    • B.

      ln

    • C.

      sudo

    • D.

      link

    • E.

      alias

    Correct Answer
    E. alias
    Explanation
    The correct answer is "alias". In a modern shell like Bourne shell, the "alias" command can be used to create a shortcut or pseudonym for a longer command. This allows the user to use a shorter and more convenient command to execute the longer command without having to type it out in its entirety every time.

    Rate this question:

  • 22. 

    Você quer que o comando foo pegue a entrada padrão a partir do arquivo foobar e envie a saída padrão para o programa bar. Qual das seguintes linhas de comando irá fazer isso?

    • A.

      foo < foobar | bar

    • B.

      foo < foobar > bar

    • C.

      foo | foobar > bar

    • D.

      foo | bar >> foobar

    Correct Answer
    A. foo < foobar | bar
    Explanation
    The correct answer is "foo < foobar | bar" because the "

    Rate this question:

  • 23. 

    Para evitar que um comando executado como root envie ambas saídas padrão (stdout e stderr) para saída em qualquer terminal, arquivo ou dispositivo. Qual das opções abaixo estaria correta ?

    • A.

      > /dev/null

    • B.

      > /dev/null 1>&2

    • C.

      > /dev/null 2>&1

    • D.

      1>&2 > /dev/null

    Correct Answer
    C. > /dev/null 2>&1
    Explanation
    The correct answer is "> /dev/null 2>&1". This command redirects both the standard output (stdout) and standard error (stderr) to the null device (/dev/null). The "2>&1" part of the command redirects stderr to the same location as stdout, which is /dev/null. This ensures that both stdout and stderr are discarded and not displayed in any terminal, file, or device.

    Rate this question:

  • 24. 

    Qual dos comandos abaixo irá listar os atributos do arquivo foobar ?

    • A.

      ls -attr foobar

    • B.

      lsattr foobar

    • C.

      printattr foobar

    • D.

      fileattr foobar

    Correct Answer
    B. lsattr foobar
    Explanation
    The correct answer is "lsattr foobar". This command is used to list the attributes of a file in Linux. The "lsattr" command is specifically designed for this purpose, allowing users to view and modify the attributes of a file, such as whether it is immutable or undeletable. Therefore, using "lsattr foobar" will display the attributes of the file named "foobar".

    Rate this question:

  • 25. 

    Qual a correta interpretação do comando seguinte ? test -f /etc/ldap.conf && mail -s 'Cliente LDAP' root < /etc/ldap.conf || /etc/init.d/slurpd stop

    • A.

      Se o arquivo /etc/ldap.conf existir ou não, root receberá uma cópia ou não do mesmo. Logo após o script /etc/init.d/slurpd será executado com o parâmetro stop.

    • B.

      Se o arquivo /etc/ldap.conf existir o script /etc/init.d/slurpd será executado com o parâmetro stop.

    • C.

      Se o arquivo /etc/ldap.conf não existir, o root receberá um e-mail de contéudo vazio.

    • D.

      Se o arquivo /etc/ldap.conf existir, o root receberá uma cópia do mesmo. Caso contrário, o script /etc/init.d/slurpd será executado com o parâmetro stop.

    Correct Answer
    D. Se o arquivo /etc/ldap.conf existir, o root receberá uma cópia do mesmo. Caso contrário, o script /etc/init.d/slurpd será executado com o parâmetro stop.
    Explanation
    If the file /etc/ldap.conf exists, the root user will receive a copy of the file. If the file does not exist, the script /etc/init.d/slurpd will be executed with the parameter stop.

    Rate this question:

  • 26. 

    Qual comando pode ser usado para dividir um determinado arquivo em 4 partes iguais ?

    • A.

      cat

    • B.

      fmt

    • C.

      split

    • D.

      join

    Correct Answer
    C. split
    Explanation
    The command "split" can be used to divide a specific file into four equal parts.

    Rate this question:

  • 27. 

    Qual o comando que é possível alterar o modo de edição do shell Bash para o modo de edição no estilo vi ?

    Correct Answer
    set -o vi
    Explanation
    The correct answer is "set -o vi" because this command allows the user to change the editing mode of the Bash shell to the vi-style editing mode. In this mode, the user can use vi-like commands and shortcuts to edit and navigate through the command line.

    Rate this question:

  • 28. 

    Logo após a instalação de um novo GNU/Linux, o Administrador do Sistema abre um shell e digita o seguinte comando: "cat /etc/passwd | head -c 4". Qual o resultado produzido ?

    • A.

      Será exibido toda primeira linha do arquivo /etc/passwd.

    • B.

      A string root

    • C.

      Somente as colunas de 1 a 4 do arquivo /etc/passwd são exibidas.

    • D.

      Será exibido as quatro primeiras linhas do arquivo /etc/passwd.

    Correct Answer
    B. A string root
    Explanation
    O comando "cat /etc/passwd | head -c 4" exibe apenas os primeiros 4 caracteres do conteúdo do arquivo /etc/passwd. Neste caso, a resposta correta é "A string root", pois os primeiros 4 caracteres do arquivo /etc/passwd são "root".

    Rate this question:

  • 29. 

    O seguinte comando: "cut -f1,5,6 -d ':' --output-delimiter ' - ' /etc/passwd" possui qual resultado ? 

    • A.

      Será exibido o login do usuário, campo de comentário e diretório home. Todos os campos serão exibidos usando o caracter ‘ - ‘ como separador.

    • B.

      O comando cut irá filtrar somente os campos login do usuário, UID e shell do usuário usando o caracter separador ‘ - ‘.

    • C.

      O comando cut irá exibir o login do usuário, GID, campo de comentário e irá reclamar de uma opção inválida que foi usada.

    • D.

      Será exibido os campos login do usuário, GID e diretório home conforme o delimitador usado.

    Correct Answer
    A. Será exibido o login do usuário, campo de comentário e diretório home. Todos os campos serão exibidos usando o caracter ‘ - ‘ como separador.
    Explanation
    The given command "cut -f1,5,6 -d ':' --output-delimiter ' - ' /etc/passwd" will display the login of the user, comment field, and home directory. All fields will be displayed using the character '-' as a separator.

    Rate this question:

  • 30. 

    Qual comando é usado para remover um diretório vazio ? (Especifique somente o comando)

    Correct Answer
    rmdir
    Explanation
    The command "rmdir" is used to remove a directory that is empty.

    Rate this question:

  • 31. 

    Qual o uso correto do comando find quando desejamos procurar em todo sistema por arquivos com o bit de execução SUID ativo ?

    • A.

      find / -perm +4000 -exec ls -ld {} \;

    • B.

      find / -perm 4000 -exec ls -ld {} \;

    • C.

      find -path / -perm +4000 -print

    • D.

      find / -perm 4000 -print

    Correct Answer
    A. find / -perm +4000 -exec ls -ld {} \;
    Explanation
    The correct answer is "find / -perm +4000 -exec ls -ld {} \;". This command uses the "find" command to search the entire system ("/") for files with the SUID (Set User ID) permission bit active. The "-perm +4000" flag specifies that it should search for files with any of the SUID, SGID (Set Group ID), or sticky bits set. The "-exec ls -ld {} \;" part of the command executes the "ls -ld" command on each file found, displaying detailed information about the file.

    Rate this question:

  • 32. 

    Qual dos comandos abaixo realiza cópia em baixo nível ?

    • A.

      cpio

    • B.

      od

    • C.

      dd

    • D.

      cpp

    Correct Answer
    C. dd
    Explanation
    The command "dd" is used to perform low-level copying in Unix-like operating systems. It is commonly used for tasks such as creating disk images, copying data between devices, and backing up data. The "dd" command allows for precise control over the copying process, including options for specifying block sizes, input and output file locations, and data conversion. It is a powerful tool that can be used for various data manipulation tasks at a low level.

    Rate this question:

  • 33. 

    Qual comando pode ser usado para formatar um arquivo para ser impresso ?

    • A.

      cat

    • B.

      expand

    • C.

      pr

    • D.

      nl

    Correct Answer
    C. pr
    Explanation
    O comando "pr" pode ser usado para formatar um arquivo para ser impresso. O "pr" é um utilitário de linha de comando que permite a formatação e a paginação de arquivos de texto para impressão. Ele pode ser usado para ajustar o layout do texto, adicionar cabeçalhos e rodapés, e controlar a formatação geral do documento antes de ser impresso.

    Rate this question:

  • 34. 

    Qual dos comandos abaixo é a forma correta de se criar um backup dos arquivos de configuração do diretório /etc usando o comando tar ?

    • A.

      ls /etc/*.conf | tar czf backup.tar.gz -

    • B.

      ls /etc/*.conf | xargs tar czf backup.tar.gz

    • C.

      tar -Afz backup.tar.gz /etc/*.conf

    • D.

      tar -czf /etc/*.conf backup.tar.gz

    Correct Answer
    B. ls /etc/*.conf | xargs tar czf backup.tar.gz
    Explanation
    The correct answer is "ls /etc/*.conf | xargs tar czf backup.tar.gz". This command correctly lists all the files with the .conf extension in the /etc directory and then uses xargs to pass the file names as arguments to the tar command. The tar command then creates a compressed backup file named backup.tar.gz.

    Rate this question:

  • 35. 

    Qual comando irá remover linhas duplicadas de um arquivo ordenado?

    • A.

      uniq

    • B.

      trim

    • C.

      filter

    • D.

      wc

    Correct Answer
    A. uniq
    Explanation
    The command "uniq" is used to remove duplicate lines from a sorted file. It compares adjacent lines and removes any duplicates, keeping only one occurrence of each line. This command is commonly used in combination with other commands to filter and manipulate data in a file.

    Rate this question:

  • 36. 

    Como root você já navegou para o diretório /B. Você deseja mover todos os arquivos e diretórios do diretório /A para o diretório /B. Qual das seguintes opções seria o comando mais adequado para executar esta tarefa?

    • A.

      cp /a/* .

    • B.

      mv -f /A/* .

    • C.

      mv -Rf /a/* .

    • D.

      cp -rf /A/* /b/

    • E.

      cp -f /a/* ..

    Correct Answer
    B. mv -f /A/* .
    Explanation
    The correct answer is "mv -f /A/* .". This command uses the "mv" command to move all files and directories from directory /A to the current directory (denoted by the dot "."). The "-f" flag forces the move operation, overwriting any existing files with the same name in the destination directory.

    Rate this question:

  • 37. 

    Qual comando exibe por padrão apenas as linhas que não começam com # (símbolo) no arquivo foobar?

    • A.

      /bin/grep #$ foobar

    • B.

      /bin/grep -v #$ foobar

    • C.

      /bin/grep -v ^# foobar

    • D.

      /bin/grep ^# foobar

    Correct Answer
    C. /bin/grep -v ^# foobar
    Explanation
    The correct answer is "/bin/grep -v ^# foobar". The "-v" option in the grep command is used to invert the matching, meaning it will display lines that do not match the specified pattern. "^#" is a regular expression that matches lines starting with the "#" symbol. Therefore, the command will display only the lines that do not start with "#".

    Rate this question:

  • 38. 

    Você deseja pesquisar no arquivo myfile todas as ocorrências da string que contenham pelo menos cinco caracteres, onde o caracter de número 2 e 5 são ‘a’ e o caracter de número 3 não é ‘b’. Qual comando você usaria?

    • A.

      grep .[a].*.[a] myfile

    • B.

      grep .a[^b].a myfile

    • C.

      grep .a*^b..a myfile

    • D.

      grep a*^b*a myfile

    Correct Answer
    B. grep .a[^b].a myfile
    Explanation
    The correct answer is "grep .a[^b].a myfile". This command uses regular expressions to search for occurrences of the string that have at least five characters, where the second and fifth characters are 'a' and the third character is not 'b'. The '[^b]' part of the regular expression ensures that the third character is not 'b'.

    Rate this question:

  • 39. 

    Qual dos seguintes comandos faria o mesmo que o comando cat < file1.txt > file2.txt ?

    • A.

      cat < file1.txt | file2.txt

    • B.

      cat < file1.txt file2.txt

    • C.

      cat file1.txt > file2.txt

    • D.

      cp file1.txt > file2.txt

    • E.

      cat file1.txt | file2.txt

    Correct Answer
    C. cat file1.txt > file2.txt
    Explanation
    The correct answer is "cat file1.txt > file2.txt". This command redirects the output of the "cat" command, which displays the contents of "file1.txt", and saves it into "file2.txt". This means that the contents of "file1.txt" will be copied and overwritten onto "file2.txt".

    Rate this question:

  • 40. 

    Qual dos seguintes comandos irá mostrar as linhas que contêm letras maiúsculas do arquivo ” turkey.txt ” ?

    • A.

      cat turkey.txt | wc -w [A-Z]

    • B.

      cat turkey.txt | wc -|

    • C.

      grep -n [A-Z] turkey.txt

    • D.

      for [A-Z] in turkey.txt | count

    • E.

      grep -v [A-Z] < turkey.txt

    Correct Answer
    C. grep -n [A-Z] turkey.txt
    Explanation
    The command "grep -n [A-Z] turkey.txt" will search for and display the lines in the file "turkey.txt" that contain uppercase letters. The "-n" option is used to display the line numbers along with the matching lines, and "[A-Z]" is the regular expression pattern that matches any uppercase letter.

    Rate this question:

  • 41. 

    Considerando o Shell Bash, inserindo "1>&2" após um comando de redirecionamento, qual será o resultado deste redirecionamento?

    • A.

      Envia a entrada padrão para o erro padrão.

    • B.

      Envia o erro padrão para a entrada padrão.

    • C.

      Envia a saída padrão para o erro padrão.

    • D.

      Envia o erro padrão para a saída padrão.

    • E.

      Envia a saída padrão para a entrada padrão.

    Correct Answer
    C. Envia a saída padrão para o erro padrão.
    Explanation
    In Bash Shell, when "&1>&2" is added after a redirection command, it redirects the standard output (stdout) to the standard error (stderr). This means that any output generated by the command will be sent to the error stream instead of the normal output stream.

    Rate this question:

  • 42. 

    Qual dos comandos seguintes poderia ser usado para mudar todos os caracteres de maiúsculo para minúsculo no meio de um pipe?

    • A.

      grep

    • B.

      egrep

    • C.

      wc

    • D.

      tr

    • E.

      pr

    Correct Answer
    D. tr
    Explanation
    The command "tr" can be used to change all uppercase characters to lowercase within a pipe.

    Rate this question:

  • 43. 

    Qual dos comandos a seguir copia arquivos com a extensão .txt de /dir1 para dentro do /dir2 e, ao mesmo tempo, preserva atributos de arquivo?

    • A.

      mv --copy /dir1/*.txt /dir2

    • B.

      mv /dir1/*.txt /dir2

    • C.

      cp -k /dir1/*.txt /dir2

    • D.

      cp -p /dir1/*.txt /dir2

    • E.

      cp -p /dir2 < /dir1/*.txt

    Correct Answer
    D. cp -p /dir1/*.txt /dir2
    Explanation
    The correct answer is "cp -p /dir1/*.txt /dir2". This command copies files with the .txt extension from /dir1 to /dir2 while preserving file attributes. The "-p" option in the cp command preserves the original file attributes such as permissions, timestamps, and ownership.

    Rate this question:

  • 44. 

    O que o comando pr faz?

    • A.

      Imprime arquivos.

    • B.

      Exibe uma lista de processos ativos.

    • C.

      Modifica a prioridade de execução de um processo.

    • D.

      Pagina arquivos de texto.

    • E.

      Modifica a linha de comandos

    Correct Answer
    D. Pagina arquivos de texto.
    Explanation
    The correct answer is "Pagina arquivos de texto." This means that the command "pr" is used to paginate or display text files.

    Rate this question:

  • 45. 

    Qual expressão regular a seguir pode ser capaz de filtrar as palavras "Linux" e "linux", mas não "linux.com" e "TurboLinux"?

    • A.

      [L/linux]

    • B.

      ?inux

    • C.

      \L\linux

    • D.

      [Ll]inux

    • E.

      [Ll]inux?

    Correct Answer
    D. [Ll]inux
    Explanation
    The expression [Ll]inux uses a character class to match either "L" or "l", followed by the string "inux". This allows it to match both "Linux" and "linux", but not "linux.com" or "TurboLinux".

    Rate this question:

  • 46. 

    Qual comando copiaria a árvore de diretório inteira, enquanto inclui todos os subdiretórios abaixo de /home/gpaula para /tmp?

    • A.

      cp /home/gpaula /tmp

    • B.

      cp -a //home/gpaula /tmp

    • C.

      cp -r /home/gpaula /tmp

    • D.

      xcp -s /home/gpaula /tmp

    • E.

      mv -cr /home/gpaula /tmp

    Correct Answer
    C. cp -r /home/gpaula /tmp
    Explanation
    The correct answer is "cp -r /home/gpaula /tmp". This command uses the "-r" option, which stands for "recursive", to copy the entire directory tree, including all subdirectories, from /home/gpaula to /tmp. This ensures that all files and directories within the specified directory are copied to the destination directory.

    Rate this question:

  • 47. 

    Qual das declarações seguintes descreve corretamente os símbolos > e >> no contexto bash shell?

    • A.

      > junta a saída padrão a um arquivo existente, e >> escreve a saída padrão a um arquivo novo.

    • B.

      > escreve a saída padrão a um arquivo novo, e >> junta a saída padrão a um arquivo existente.

    • C.

      > escreve o erro padrão a um arquivo novo, e >> junta erro padrão a um arquivo existente.

    • D.

      > pipes para um arquivo novo, e >> pipes para um arquivo existente.

    • E.

      > pipes para um arquivo existente e >> pipes para um arquivo novo.

    Correct Answer
    B. > escreve a saída padrão a um arquivo novo, e >> junta a saída padrão a um arquivo existente.
    Explanation
    The correct answer states that ">" writes the standard output to a new file, while ">>" appends the standard output to an existing file. This means that ">" is used to create a new file or overwrite an existing file with the standard output, while ">>" is used to add the standard output to the end of an existing file without overwriting its contents.

    Rate this question:

  • 48. 

    Você precisa procurar em todos os diretórios para localizar um determinado arquivo. Como você fará isto e ainda continuar a chamar outros comandos?

    • A.

      find / -name filename &

    • B.

      find / -name filename

    • C.

      bg find / -name filename

    • D.

      &find / -name filename &

    Correct Answer
    A. find / -name filename &
    Explanation
    To locate a specific file in all directories and continue executing other commands, you can use the command "find / -name filename &". The "find" command is used to search for files and directories based on specified criteria. The "/" indicates that the search should start from the root directory. The "-name" option is used to specify the name of the file you are searching for. The "&" symbol at the end of the command allows the command to run in the background, so you can continue executing other commands while the search is ongoing.

    Rate this question:

  • 49. 

    Que comando pode exibir os conteúdos de um arquivo binário em uma forma de hexadecimal legível? Selecione a opção correta.

    • A.

      xd

    • B.

      hd

    • C.

      od

    • D.

      Xd

    • E.

      dump

    Correct Answer
    C. od
    Explanation
    O comando "od" pode exibir os conteúdos de um arquivo binário em uma forma de hexadecimal legível.

    Rate this question:

  • 50. 

    Qual comando exibirá as últimas linhas do arquivo texto arquivo1.txt ? Selecione a opção correta.

    • A.

      head -b arquivo1.txt

    • B.

      head --bottom arquivo1.txt

    • C.

      head -v arquivo1.txt

    • D.

      tail arquivo1.txt

    • E.

      tail -n 1 arquivo1.txt

    Correct Answer
    D. tail arquivo1.txt
    Explanation
    The correct answer is "tail arquivo1.txt". The "tail" command is used to display the last part of a file. In this case, it will display the last lines of the text file "arquivo1.txt".

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 09, 2016
    Quiz Created by
    Viniciusalcantar
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.