Linux Final Chapter 1

25 July 2022
4.7 (114 reviews)
66 test answers

Unlock all answers in this set

Unlock answers (62)
question
You have an executable file named ni that allows you to save a snapshot of your network information with the date and time into a log file. The file is in the /root directory, and the /root is the current working directory. How would you run the executable file? (select two.)
answer
./ni and /root/ni
question
Which of the following options is the standard shell for most Linux computers
answer
Bourne-again shell (bash)
question
What would you enter at the command prompt to start a new Bourne-again shell (bash) session?
answer
bash
question
What command should you enter to see a list of all the commands you recently used at the command prompt?
answer
history
question
You have the myapp executable file. It is found in the current directory, but not in the command path. What would you enter at the command prompt to start the myapp file and replace the shell with myapp process?
answer
exec ./myapp
question
What is the result of the uname -a command?
answer
All system information is displayed on the screen
question
What would you enter at the command prompt to display the present working directory?
answer
pwd
question
Which of the following commands could you use to search man pages for a specific keyword?
answer
apropos, whatis, man -k
question
You are working on a Linux system and need more information about the uname command. What would you enter at the command prompt to learn about the uname command syntax and options?
answer
uname --help
question
What command can be used on most Linux distributions to find the directories where the man pages are kept?
answer
echo $MANPATH
question
Following is a lost of the four sections typically found in a man page. Which of these shows a list of options available for a Linux command and explain what the options do?
answer
DESCRIPTION
question
If you are viewing the contents of a man page, which key can you press to get back to the beginning of the page?
answer
Home
question
Which of the following commands will create a shortcut to the tail -f /var/log/messages command?
answer
Alias sysmesg="tail -f /var/log/messages"
question
Which command will display a list of the currently defined aliases on the system?
answer
alias
question
What commonly predefined alias is configured to run the ls -l command?
answer
||
question
You must do which of the following to define a persistent alias?
answer
Add the command defining the alias to the appropriate shell configuration file.
question
The user mbrown has a directory named logs in her home directory that is regularly updated with new log files when certain systems events occur. She runs the following commands several times a week to check this directory: - cd /home/mbrown/logs - ls -al She wants a persistent alias named logcheck to be created to run these two commands. What command would you enter into her shell configuration file to create this persistent Alias?
answer
Alias logcheck="cd /home/mbrown/logs;ls -al"
question
You need to set the COMP variable to the value 1745. Which command will set the variable so it is available to other shell programs?
answer
export COMP to 1745
question
Two users should have identical settings, yet one is having problems with the display on his screen and you suspect there is a difference in their environment variable. Which command will display all the environment variables?
answer
env
question
Which of the following statements best describes the PATH environment variable?
answer
It contains the directory prefixes used to search for programs and files.
question
You want the directory /sbin/special to always be a part of the PATH. You also want to keep all the current entries in your PATH statement. Which of the following commands would you use?
answer
PATH=$PATH:/sbin/special
question
What line must you add to /etc/profile to make sure /sbin/custom is always part of the PATH environment variable for all users, without overwriting the current entries in the PATH statement?
answer
PATH=$PATH:/sbin/custom; export PATH
question
Which command shows the value of the LANG environmental variable currently set for the language the operating system uses?
answer
echo $LANG
question
You want to view the number of commands your HISTSIZE environment variable is set to save. You don't want to have to scroll through all the environment variables. Which command shows you the value for the HISTSIZE variable?
answer
echo $HISTSIZE
question
Which of the following presents the greatest security risk?
answer
The PATH statement includes . (period)
question
Which command will display all the environment variables on the system?
answer
set
question
Which command will display only the environment variables applied to child sessions?
answer
env
question
You recently used the HOST=FS4 command. What command should you use to make the environment variable to apply to all child sessions?
answer
export HOST
question
Which environment variable affects the number of past commands used in the current shell session?
answer
HISTSIZE
question
Which of the following commands will configure the shell to retain 300 recently used commands in the ~/.bash_history file for multiple shell sessions?
answer
HISTFILESIZE=300
question
All users at your site are using the Bash shell. You want to set a variable that will apply to every user and always have the same value. Which file would you place this variable in?
answer
/etc/profile
question
A user is requesting that each time she logs in, a particular entry be written to a log file. This will only apply to her and she is using the Bash shell. In which configuration file would you make an entry for this action to take place?
answer
.profile
question
Which of the following files would you use to create aliases that are applied when a specific user starts a BASH session? (select two)
answer
~/.profile and ~/.bashrc
question
After a user starts a BASH session and the scripts in /etc/profile are applied, what is the next file that could affect the shell session?
answer
~/.bash_profile
question
Your default target on your Linux system is set to multi-user mode; however, you want the X Windows System to launch when you log into the system. Which file should you edit?
answer
~/.bash_login
question
You are trying to debug a shell script called myscript and to aid you in this task you would like to have output of the script be recorded in a text file. Which of the following commands would satisfy your requirements?
answer
myscript >>testfile.txt
question
What will be the effect of the following command? ls -l /usr/bin >> /tmp/list.txt
answer
The contents of the /usr/bin directory will be redirected into a file called /tmp/list.txt, inserted after previous contents of the file.
question
You are trying to debug a shell script that has the command ls -s in it. You suspect an error is occuring here and want to send the results of the operation (success or error) to a file named Friday in order to examine it later. Which of the following commands should you use?
answer
ls -s> Friday 2>&1
question
Which of the following commands will give the same results as cat < turbo?
answer
cat turbo
question
Which of the following commands sorts the contents of wordlist1 and wordlist2 and sends the result to standard output?
answer
cat /usr/wordlist1 /usr/wordlist2 | sort
question
Which symbol uses the output of one command as the input of another command?
answer
|
question
Which command reads from standard input and writes to standard output and files?
answer
tee
question
Which of the following commands displays the contents of wordlist1 and wordlist2 then sorts the combined contents, then sends the results to the monitor and a file named sortedwordlist?
answer
cat /usr/wordlist1 /usr/wordlist2 | sort | tee sortedwordlist
question
Which command overcomes the 128 KB shell command size restriction by breaking up long lists of arguments?
answer
xargs
question
Which of the following commands redirects standard output to standard error?
answer
cat txtfile 1>&2
question
You need to create the directory /var/oracle/database/9i. Only the directory /var currently exists. From the root of the filesystem, which command will create the directory path?
answer
mkdir -p /var/oracle/database/9i
question
In the /var directory is a subdirectory called backup. You need to delete the directory backup and any files. You change directory focus to /var. Which command will delete the directory backup and its files?
answer
rm -rf backup
question
You need to make an expanded listing of all the files in /etc. Which command will produce the listing?
answer
ls -al /etc
question
You need to view the contents of the /home/jerrys directory. What would you enter at the command prompt to show all the contents, including hidden files and directories?
answer
ls -al /home/jerrys
question
Which of the following command copies the entire /temp directory with all of its files, sub-directories, and files in the sub-directories to the /home/gshant directory. (Select two)
answer
cp -R /temp /home/gshant and cp -r /temp /home/gshant
question
The /home/gshant/smp directory is empty and needs to be removed. You change directories to /home/gshant. What would you enter at the command prompt to remove the smp directory?
answer
rmdir smp
question
The /home/gshant/smp directory contains several files. The directory and files need to be removed. You change directories to /home/gshant. What would you enter at the command prompt to remove the smp directory and the files it contains?
answer
rm -r smp
question
Which of the following commands combines three files into a single text stream?
answer
cat
question
You are logged in as root. You have the file, letter.doc, on a CD in the first compact disk drive. Which command will copy the file from the CD to your home directory.
answer
cp /mnt/scd0/letter.doc /root
question
Which command would you use to rename the /home/pmallory/reports file to reports.bak?
answer
mv /home/pmallory/reports /home/pmallory/reports.bak
question
Which command would you use to move a file from one location to another?
answer
mv
question
Which command prints the attributes of a /boot/grub/grub.conf file?
answer
lsattr /boot/grub/grub.conf
question
Which of the following commands will change the /home/gshants/smile file's modification and last accessed times to the current time?
answer
touch /home/gshants/smile
question
What would you enter at the command prompt to display a file's type?
answer
file
question
You want to view the contents of a directory, but the output of the ls -l command scrolls beyond the limit of one console window. Which of the following commands would allow you to see the full listing of the directory?
answer
ls -l | less
question
Which of the following would be the result of the command ln -b ~/file1 /data/file1?
answer
A copy of the file ~/file1 would be replaced in /data.
question
You previously created symbolic links in your home directory to a set of files in the /data directory using the ln -s command. The system admin has just deleted those files. What happens to the links that you created?
answer
The symbolic links would still exist in your home directory but they would now be broken.
question
Drag the permission string on the left to the category on the right.
answer
Symbolic Link: lrwxrwxrwx Hard Link: -rwxr-xr-x
question
Which of the following is not a characteristic of symbolic links?
answer
Valid inode for the file data even if the original file is deleted.
question
Which of the following is not a characteristic of hard links?
answer
Distinct inode
question
After using the ls command in the current working directory, you notice the following files: lrwxrwxrwx 1 root root 4 2010-11-05 myfile - > shantsgems -rwxr-xr-x 1 root root 382 2010-10-05 shantsgems What is true about the files?
answer
myfile is a symbolic link to shantsgems