Specific Linux Questions (copy)

0.0(0)
Studied by 3 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/56

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:08 PM on 8/9/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

57 Terms

1
New cards

You need to troubleshoot a hardware issue. Which command would let you view the kernel ring buffer to see what hardware was just added?

dmsg | less

2
New cards

In which directory could you add files so that a newly created user will automatically have them when they first log in?

/etc/skel

3
New cards

You are running the ping command to see if a particular host is up. How would you specify to the ping command that only five packets get sent to the remote host?

ping -c 5 host.example.com

4
New cards

You need to verify that a remote host with a hostname of dns2.linuxacademy.com is up and running. Which of the following commands would you enter at the shell prompt to do this?

ping dns2.linuxacademy.com

5
New cards

Which command would uncompress the contents of the file 'important.bz2'?

bunzip2

6
New cards

How would you add a new user account to a system?

useradd newguy

7
New cards

Which file(s) are used for DNS resolution? (Choose 2)

/etc/hosts

/etc/resolv.conf

8
New cards

How would you set permissions on a newly created script so that it could be executed.

chmod u+x script.sh

9
New cards

What is the proper syntax for creating a parent directory, followed by a child subdirectory?

mkdir -p dir1/dir2

10
New cards

You need to create a symbolic link from a file located at /usr/share/doc/manual to a link in your home directory named 'manual'. Which command would we use to achieve this?

ln -s/usr/share/doc/manual ~/manual

11
New cards

While working in the command line console, not running X Windows, you suddenly need access to another shell to do another task. You don't want to quit or halt the current application. What might you do to run both your other functions in a shell while still running your current application?

You can press ALT-F2 or CTRL-ALT-F2 to open an alternate console screen and access a new shell session.

12
New cards

You need to search for man pages that relate to the Postfix service. Which command will do this? (Choose 2 correct answers)

apropos postfix

man -k postfix (you must be root to use this)

13
New cards

Which directory contains filesystem management utilities such as cp or mv?

/bin and /usr/bin

14
New cards

What file might we look at to view our most recently entered shell commands?

~/.bash_history

15
New cards

We need to find a file named la.txt in our current directory. Which command would we use?

find . -name la.txt

16
New cards

Which file contains the encrypted passwords for the users on a system?

/etc/shadow

17
New cards

The users in your organization are having issues accessing the corporate e-mail server, hosted by a third-party vendor. You suspect that a router may be down somewhere within your organization's network. Given that the hostname of the e-mail server is pop.linuxacademy.com, which of the following commands would you enter at the shell prompt to test this? (Choose all that apply) Choose 2:

traceroute pop.linuxacademy.com

tracepath pop.linuxacademy.com

18
New cards

What is the syntax to change the group ownership on a file?

chgrp group file.txt

19
New cards

Which command would send the output of the 'who' command to a text file?

who > who.txt

20
New cards

You need to move a directory (dir1), along with all of its contents, to a new location (dir2). Which command would accomplish this task?

mv ~/dir1 ~/dir2

21
New cards

You need to delete the /APP directory within your user's home directory. Given that it has child folders and files in it, which is the best command to do this?

rm -rf ~/APP

22
New cards

Which command would copy all files ending in .pdf to the Documents directory?

cp *.pdf Documents/

23
New cards

From your current location on the file system, how would you change to three directories above the current directory?

cd ../../..

24
New cards

When it comes to bash configuration files, which of the following will be read/executed when logging into a shell that is considered to be a non-login shell?

~/.bashrc

25
New cards

Which of the files below will configure the path to the man page's files?

~/.MANPATH

/etc/man.conf

26
New cards

Which of the following shell commands will load the ssh client and connect as the 'stephen' user to an ssh server with an IP address of 172.16.10.123? (Choose all that apply) Choose 2:

ssh stephen@172.16.10.123

ssh -l stephen 172.16.10.123

27
New cards

How might we find out what directory paths are currently set up on our Linux file system? (Choose all that apply)Choose 2:

env

echo $PATH

28
New cards

What should the first line of a bash shell script contain?

#!/bin/bash

29
New cards

Whichi of the following permissions are set on the /tmp/directory?

rwxrwxrxt

30
New cards

Which command adds the new user tux and creates the user’s home directoy with default configuration files?

useradd -m tux

31
New cards

Which of the following commands sorts the output of the command export-logs?

export-logs | sort

32
New cards

Which of the following commands will search for the file foo.txt under the directory /home?

find/home -name foo.txt

33
New cards

Which of the following directories contains information, documentation and example configuration files for installed software packages?

/usr/share/doc/

34
New cards

A directoy contains the following 3 files:

texts 1.txt

texts 2.txt

texts 3.csv

Which command copies the 2 files ending in .txt to the /tmp/ directory?

cp*.txt/tmp/

35
New cards

Which of the following devices represents a hard disk partition?

/dev/sda2

36
New cards

Which files are the source of the information in the following output? Choose 2

uid=1000 (bob) gid=1000 (bob) groups=1000 (bob), 10 (wheel), 150 (wireshark), 989 (docker), 1001 (libvirt)

/etc/passwd

/etc/group

37
New cards

Which command copies the contents of the directory /etc/, including all sub-directories, to /root/?

cp -r /etc/* /root

38
New cards

Which of the following commands puts the lines of the file data.csv into alphabetical order?

sort data.csv

39
New cards

Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?

zip poems.zip *.txt

40
New cards

Which of the following commands will search for the file foo.txt under the directory /home?

find /home –name foo.txt

41
New cards

Which of the following commands output the content of the file Texts 2.txt? (Choose two.)

cat Texts\ 2.txt

cat 'Texts 2.txt’

42
New cards

The current directory contains the following file: -rwxr-xr-x 1 root root 859688 Feb 7 08:15 test.sh Given that the file is a valid shell script, how can this script be executed? (Choose two.)

./test.sh

bash test.sh

43
New cards

Which permissions are set on a regular file once the permissions have been modified with the command chmod 654 file.txt?

-rw-r-xr- -

44
New cards

Which of the following commands extracts the contents of the compressed archive file1.tar.gz?

tar -xzf file1.tar.gz

45
New cards

Which of the following values could be a process ID on Linux?

21398

46
New cards

The ownership of the file doku.odt should be changed. The new owner is named tux. Which command accomplishes this change?

chown tux doku.odt

47
New cards

Which of the following outputs could stem from the command last?

root tty2 Wed May 17 21:11 - 21:11 (00:00)

48
New cards

Reverse DNS assigns hostnames to IP addresses. How is the name of the IP address 198.51.100.165 stored on a DNS server?

In the PTR record for 165.100.51.198.in-addr.arpa.

49
New cards

Which of the following outputs comes from the command free?

total used free shared buff/cache available
mem: 16123128 12565680 2011624 412128 1545824 7180416

50
New cards

Which of the following commands creates an archive file work.tar from the contents of the directory ./
work/?

tar -cf work.tar ./work/

51
New cards

Running the command rm Downloads leads to the following error:
rm: cannot remove 'Downloads/': Is a directory
Which of the following commands can be used instead to remove Downloads, assuming Downloads is empty? (Choose two.)

rmdir Downloads
rm -r Downloads

52
New cards

Which of the following commands adds the directory /new/dir/ to the PATH environment variable?

export PATH=/new/dir: $PATH

53
New cards

A user is currently in the directory /home/user/Downloads/ and runs the command
ls ../Documents/ Assuming it exists, which directory's content is displayed?

/home/user/Documents/

54
New cards

Which of the following examples shows the general structure of a for loop in a shell script?

for file in *.txt
do
echo $i
done

55
New cards

The file script.shin the current directory contains the following content:

#!/bin/bash
echo $MYVAR

The following commands are used to execute this script:

MYVAR=value
./ script.sh

The result is an empty line instead of the content of the variable MYVAR. How should MYVAR be set in order to
make script.sh display the content of MYVAR?

export MYVAR=value

56
New cards

Which of the following commands finds all lines in the file operating-systems.txt which contain the term linux, regardless of the case?

grep -i linux operating-systems.txt

57
New cards

You need to search for man pages that relate to the Samba daemon. Which command will do this? Choose 2 correct answers:

apropos smbd

man -k smbd