Linux 1
A friend sent you a shell script file that is 117 lines long. He says that he wants to examine code on lines 82 and 87. What command would enter while vi Command Mode to go directly to line 82?
#82
what files would you use to create aliases that are applied when a specific user starts a BASH session?
-/.profile ~/.bashrc
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?
.profile
What command would you enter while in vi command mode to find the term Sam?
/Sam
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?
/etc/profile
Anna, a system administrator, wants to set a global variable that can be used each time she logs. Currently, she has to set the variable each time a terminal is opened.What files would need to be modified to make a global variable persistent?
/etc/profile ~./bash_profile
A Linux user has an executable file named ni that can save a snapshot of network information with the date and time in a log file. The executable ni file is in the /root directory, and /root is the current working directory. Which of the following commands would run the executable file?
/root/ni and ./ni
Using the vi editor in Insert Mode, you made a few changes to the /boot/grub/grub.conf
1. Press the Esc key2. TypeP ":wq"
what commands utilize command substitution?
1. myvar=`sort -r names.txt` 2. myvar=$(sort -r names.txt)
After opening a file in vi, you want to switch from Command Mode to Command Line Mode. What key invokes Command Line Mode?
:
As an administrator, you are tasked with configuring an Apache web server by modifying the /etc/apache2/apache2.conf file. You open the file in vi. As you're looking at the file, you knock your spill-proof drink container onto the keyboard. It rolls over several keys as you try to pick it up. Now there are extra characters everywhere in the text buffer. Which of the following commands can you use to exit vi without saving any changes that were made to the text buffer?
:q!
what vi key combinations should you press while in Insert Mode to save the file you are working on and quit
<Esc>:wq
what actions can be used to define a persistent alias?
Add the command defining the alias to the appropriate shell configuration file.
what command displays a list of the currently defined aliases on the system?
Alias
Mary Brown is a Linux user with the username mbrown. Mary has a directory named logs in her home directory that is regularly updated with new log files when certain system events occur. She runs the following commands several times a week to check this directory:
Alias logcheck="cd /home/mbrown/logs;ls -al"
What is displayed when the uname -a command is run?
All system information
Tim, a system administrator, wants to simplify the provisioning and disabling of user accounts. What server roles should Tim install and configure?
Authentication server
Which of the following is the standard shell for MOST Linux computers?
Bourne-again shell(bash)
Your company recently setup a VPN and wants to use a digital certificate for authentication instead of a pre-shared key. What server roles would allow the company to provide this functionality internally instead of using an external provider?
Certificate Authority
Your company is running a critical business application. The executive team wants to endure the server is available at all times, even in the event of a server failure. What server roles would be used to provide a failover server in the event of a system failure?
Clustering
Your company develops applications to run on Linux systems. You currently have four teams working on a different aspect of the same application. what would you use to test all the code.
Containers
What man page sections shows a list of options available for a Linux command and explains what the options do?
DESCRIPTION
Users are complaining that they are unable to connect to any servers or the internet. Based on the symptoms they describe, you suspect that the users are not being assigned the correct IP addresses. What fixes this.
DHCP
Manages intelligent devices, such as automation and control equipment.
Embedded Linux
Alex, a webmaster, is implementing an order processing system on the company's website. What server roles should be used to provide a central location for users of both operating systems to share files?
File servers
what nano editor keyboard shortcuts will display help text which includes a list of all keyboard shortcuts.
G (Ctrl +G)
Move the cursor one space to the left
H
what commands configures the shell to retain 300 recently used commands in the ~.bash_history file for multiple shell sessions?
HISTFILESIZE=300
what environment variable specifies the number of past commands stored in memory in the current shell sessions?
HISTSIZE
f you are viewing the contents of a man page, which key can you press to get back to the beginning of the page?
Home
what statemnets BEST describes the PATH environment variable?
It contains the directory prefixes ti search for programs and files.
what nano text editor features makes it easier for beginners to learn that the vi test editor
Keyboard shortcuts are displayed at the bottom of the editor
Infrastructure as a Service
Linux and Cloud Computing
Used by Google on many of the physical products it sells
Linux on mobile devices
Running Linux and Windows on the same physical computer.
Linux virtualization
Increases response time to back-end servers by distributing the workload across the available servers
Load balancer
Capturing a timeline of events that have taken place on the computer in the form of a file.
Logging
Your company has been expanding the number of servers in the company's data center, and there is an increased need to gather metrics, watch process states, work with logs, watch services states and file system usage. Which of the following server roles should be installed to provide this functionality?
Monitoring
Users are complaining that the clocks for their operating systems do not match the current time for the location in which they live. What fixes this.
NTP
Resolves (or maps) the fully qualified domain names (FQDNs) to IP Addresses
Name server
You want the directory /sbin/special to be include in the PATH environment variable. You also want to keep all current directory entries currently in the PATH variable.
PATH=$PATH:/sbin/special
Which of the following server roles would you implement to provide services offered by CUPS and IPP?
Print server
A computer that provides indirect internet access to the computers in your network.
Proxy
a protocol used to communicate with and monitor network devices and servers.
SNMP
A protocol used to securely log on to remote systems using encryption.
SSH
Which of the following is the primary role of a mail transfer agent (MTA)
Store messages so they can be downloaded or send email to a destination MTA.
what describes the effects of the ls -l/usr/bin>>/tmp/list.txt
The contents of the /usr/bin directory are written to a file named /tmp/list.txt. Previous files contents are kept, and the new information is added at the end of the file.
A type of network that uses encryption to allow IP traffic to travel securely over the TCP/IP network.
VPN
what commands creates a shortcut that can be used to run the fail -f /var/log/messages?
alias sysmesg="tail -f /var/log/messages"
what commands stores the output of the ls -a command in a shell variable name allfiles?
allfiles=$(ls-a)
What would you enter at the command prompt to start a new Bourne-again shell (bash) session?
bash
what commands can be used to combine the content of three files into a single text stream?
cat
what commands sorts the combine contents of the wordlist1 and wordlist2 files and send the results to both the screen and a file named sortedwordlist?
cat / usr /wordlist1 / usr / wordlist2 | sort | tee sortedwordlist
what commands sorts the contents of the wordlist1 and wordlist2 files and sends the results to standard output?
cat /usr/wordlist1 /usr/wordlist2 | sort
what commands gives the same results as cat< turbo?
cat turbo
the vi mode the works with the file system.
command line mode
The initial vi mode used when vim is started.
command mode
what command copies the entire /temp directory ith all of its files, sub- directories, and files in the sub-directories to the /home/gshant directory.
cp -r /temp /home/gshant cp -R /temp /home/gshant
A Linux administrator is logged in as root and needs to copy a file name letter.doc from the USB flash drive mounted under /media/usb.
cp /media/usb/letter.doc /root
Tom, a shell script developer, knows that the date + %A command gives the current local weekday name(Sunday, Monday, Tuesday, ...). what commands will copy the authentication log file, /var/log/auth.log, to a new file that with a filename that includes the current local weekday name?
cp /var/log/auth.log ~/auth$(date +%A).log
You want to view the number of commands your bash shell is set to save by examining the current HIST SIZE environment variables.
echo $HISTSIZE
commands shows the value of the LANG environmental variable currently set for the language the operating system uses?
echo $LANG
the vi mode that vim uses to write and edit text in the file
edit mode
two users should have identical settings, yet one is having problems with the display oh his screen , and you suspect there is a difference in their environment variables?
env
As a Linux user, you have access to an executable file named myapp. It's 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?
exec ./myapp
ou need to set the COMP variable to the value 1745.What commands sets the variable so it is inherited by subsequent child shells?
export COMP=1745
You recently used the HOST=FS4 command.What commands should you use to change the HOST variable to a global variable that will be inherited by subsequent child sells and processes?
export HOST
Tim, a technician, created a local variable named val and set it to 5000 at the bash prompt. Tim wants to use the variable in a script. But when the script is executed, the value of val is not set to 5000.What commands would allow Tim to set a global variable that would be available to the script?
export val=5000
What would you enter at the command prompt to display a file's type?
file
Which of the following commands should a Linux user enter to see a list of all the commands the user recently ran at the command prompt?
history
Move the cursor down a line
j
Move the cursor up a line
k
Move the cursor one space to the right
l
what commands will display the attributes of a /boot/gub/grub.conf file?
lasttr /boot/grub/grub.conf
what commonly predefined alias is configured to run the ls -l command?
ll
You need to view the contents of the /home/jerrys directory. What would you enter at the command prompt to show all the contents, hidden files and directories?
ls -a /home/jerrys
what commands displays an expanded listing that includes the owner and size of all the files in the /etc directory?
ls -al /etc
A user attempts to view the contents of a directory, but the output of the ls -l command scrolls beyond the limit of one console window. what commands would allow the users to see the full listing of the directory?
ls -l | less
nn, a Linux script developer, is trying to debug a shell script that has the command ls -s in it. She suspects that an error is occurring, and she wants to send the results of the operation and any errors to a file name ~/Friday in order to examine it later.
ls-s &> ~/Friday
The /home/gshant/smp directory contains several files. The directory and files need to be removed. The current working directory is /home/gshant. What would you enter at the command prompt to remove the smp directory and all the files it contains?
m -r smpr
What commands searches man pages for a specific keyword
man -k and apropos and whatis
You are working on a Linux System and need more information about the uname command. What you enter at the command prompt to learn about the uname command syntax and options?
man uname
Fred, a Linux administrator, needs to create the directory /var/oracle/database/9i. Only the directory /var currently exists. The current working directory in the root of the filesystem. what commands will create the directory path?
mkdir -p /var/oracle/database/9i
what commands will move a file from one location to another?
mv
what commands will change the /home/pmallory/reportsfile's name to reports.bak?
mv /home/pmallory/reports /home/pmallory/reports.bak
Joe, a bash script developer, is trying to debug a shell script named my script. Which of the following commands would record the output of the script in a text file?
myscript >> testfile.txt
While in the vi Command Mode, you copy a whole line of text to the general buffer. You then navigate to a different location in the file. Which of the following commands will pastes the copied text?
p
Which command displays all environment variables defined in the shell?
printenv
What would you enter at the command prompt to display the current working directory?
pwd
Within the /var directory is a sub-directory named backup. Ken, a Linux administrator, needs to delete the directory and any files that it contains. He changes directory focus to /var. what commands deletes the directory named backup and any file it contains?
rm -r backup
The /home/gshant/smp directory is empty and needs to be removed. The current working directory is /home/gshant. What would you enter at the command prompt to remove the smp directory?
rmdir smp
A user, ljenkins, contacts the help desk about and error received while removing a file from their home directory. The user received the following error when trying to use the rm command to remove the file:
sudo chattr -i report.txt && rm report.txt
what command reads from standard input (stdin) and writes to both standard output (stdout) and a file?
tee
what commands will change the /home/gshants/smilefile's modification and last accessed times to the current time?
touch /home/gshants/smile
A program responsible for accepting HTTP (Hypertext Transfer Protocol) requests from clients.
web server
what command overcomes the 128 KB shell command size restriction by breaking up long lists of arguments?
xargs
A technician had been given a work order to install the Apache webserver on a system configured with a YUM repository. Which of the following commands will install the webserver?
yum install httpd
What command would you enter while in vi command mode to copy the entire line of text to the general buffer?
yy
what command operator pies the output of one command as the input of another command?
| not L not i this thing -> |
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?
~/.bash_profile