Testout Chapter 1 Linux Admin Midterm 2.19.19 1.1-1.11 10.3 7.9 2.3 6.1-6.3 9.1-9.3

¡Supera tus tareas y exámenes ahora con Quizwiz!

In the /etc/shadow file, which character in the password field indicates that a standard user account is locked?

! or !! ! or !! in the password field of /etc/shadow indicates the account is locked and cannot be used to log in

A friend sent you a shell script file that is 117 lines long. He says that he wants you to examine code on lines 82 through 87. What command would you enter while in vi command mode to go directly to line 82? (while in command mode)

#82

In the /etc/shadow file, which character in the password field indicates that the password is an encrypted entry?

$

Move the cursor in vi left,down,up,right

(left) Move the cursor one space to the left: h (down) Move the cursor down a line: j (up) Move the cursor up a line: k (right) Move the cursor one space to the right: l h moves the cursor one space to the left j moves the cursor down a line k moves the cursor up a line l moves the cursor one space to the right

You have a critical file called yearend.xls. You want to set file permissions so that only the owner of the file can modify it and only group owners can read it. Which permission listed below will accomplish that?

-rw-r----- 1 george acctg 26256 June 1 04:16 yearend.xls The permissions of -rw-r----- allows the user read or write to the file, the group to only read the file, and nobody else any rights to the file.

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 The .profile file exists within the user's home directory and is executed upon each login. Placing the entry here will allow for each time she logs in for a particular entry to be written to a file only for this user. While placing it in /etc/profile would make it applicable for all users.

Which path represents the root directory?

/ The forward slash (/) character represents the root filesystem of the Linux system.

What command would you enter while in vi command mode to find the term Sam?

/Sam or ?Sam Use /Sam to search forward for all instances of a term. Use ?Sam to search backward for all instances of a term.

under Filesystem Hierarchy Standard (FHS), what is the full path to the directory that contains the device files for a Linux system?

/dev /dev directory contains the device files for a Linux system.

What is the full path and filename of the file that is sued to schedule tasks for the anacron daemon? path for file to schedule tasks for anacron daemon

/etc/anacron

You want to keep the gshant user from using the at command, but still allow all other users to use it. What is the full path and filename of the file you should edit?

/etc/at.deny

Which file should you edit if you want to permit specific users to edit their crontab file, but deny all other users on the system from editing their crontab file?

/etc/cron.allow If /etc/cron.allow file exists only users in that file are allowed to edit /var/spool/cron/username

You need to change the default home directory value used by the useradd utility when creating a user account. What is the full path and filename of the file you should edit?

/etc/default/useradd

In which file would you find an entry similar to the following line: sales:x:510:pclark,mmckay,hsamson

/etc/group

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? .bash_profile /etc/profile .bash_login .bashrc

/etc/profile The values in /etc/profile are set for every user.

What is the full path to the directory that contains a set of configuration file templates that are copied into a new user's home directory when it is created?

/etc/skel The /etc/skel directory contains a set of configuration file templates that are copied into a new user's home directory when it is created, including the following files: .bashrc .bash_logout .bash_profile .kshrc

What is the full path to the directory that contains a set of configuration file templates that are copied into a new user's home directory when it is created?

/etc/skel The /etc/skel directory contains a set of configuration file templates that are copied into a new user's home directory when it is created, including the following files: .bashrc .bash_logout .bash_profile .kshrc

You are configuring a linux system for 5 different users. Before you create the user accounts, you need to ensure that specific commands execute clean up tasks when the user logs out of the Linux system. You want to reduce redundant actions by configuring the commands once for all users that will be created on the system. Where should you configure the commands?

/etc/skel/.bash_logout .bash_logout configuration (template in this case) file stores commands that execute when a user logs out. To reduce redundant actions by configuring the commands once for all users, you should add the commands to the /etc/skel/.bash_logout file.

What is the full path and file name of the file that stores BASH preferences (shell preferences) for the gshant user account?

/home/gshant/.bash_profile /home/gshant/.bash_profile stores (BASH) shell preferences for the gshant user account

Under Filesystem Hierarchy Standard (FHS), which directory contains information about the system state and processes?

/proc the /proc directory contains information about the system state and processes.

Which directory is the home directory for the root user account?

/root

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 (executable) file is in the /root directory, and /root is the current working directory. How would you run the executable file? (Select two.) /root/ni source ni ni ./ni

/root/ni ./ni To run an executable, you can either change to the directory where the script is held and use ./name Or use the absolute path to run the script from anywhere. You cannot just type the script name because the current working directory is not in your PATH variable. (current working directory is /root)

What is the full path to the directory that contains the locale configuration files on a Linux system?

/usr/share/locale /usr/share/locale contains the locale configuration files on a Linux distribution.

what is the full path to the directory that holds the man files on the system?

/usr/share/man or /usr/man

what is the full path to the directory that contains data files that change constantly, including email, print, jobs, and proxy cache files? data files that change constantly

/var The /var directory contains data files that change constantly. (/var/mail, /var/spool, /var/www)

anacron creates a timestamp file that tells you the last time a regularly scheduled job was run. What is the full path and name of the directory that contains these timestamp files?

/var/spool/anacron/ anacron creates a timestamp file in the /var/spool/anacron directory every time a regularly scheduled job is run so you can see the last time a job was run. the /var/ directory is the standard directory for log files of this nature.

You must create a root user account for the system. What user account number does this account use?

0 The root user has an account number of 0 and belongs to group number 1.

You are editing the crontab file and want an entry to run every hour at five minutes past the hour.

5 * * * * /home/emmett/example.sh To run the command every hour at a specific minute, place the minute value (5) in the first field.

The only other user that has been added to the system was root. What is most likely user id associated with the new user?

500 On most distributions of Linux accounts below 100 are used for system accounts, and user accounts begin with 500.

What is the UID in the line from the /etc/passwd file below? pmallory:x:514:550:Paul Mallory:/home/pmallory:/bin/bash

514 The UID (user ID) is in the third field of the line for the user. the format for the /etc/passwd file is as follows: name:password:UID:GID:GECOS:homedirectory:shell (GECOS is a field that allows a text description of the user account)

You are called into the office of a newly hired manager. He has copied a file from his old place of work onto his new workstation, but is now receiving an error message that access is denied each time he tries to access the file. He is not the owner of the file, and not a member of the group the file is associated with. Which of the following represents the least set of file permissions needed for himt o be able to read and write to the file?

666 Because he is not a member of the group, or the owner of the file, the only set of permissions applying to the manager is the last number. The ability to read the file has a value of 4, while the ability to write to the file has a value of 2. Adding the two together, the needed permission for the user is 6.

After opening a file in vi, you want to switch from command mode to command line mode. What key should enter?

: Typing : enters command line mode from command mode.

You have opened the /root/myscript file in vi. While looking at the file, your soda spilled, and you hit several keys on the keyboard trying to pick it back up. There are extra characters everywhere in the file, and you know you can't fix it. How do you exit vi without saving the changes?

:q! Use the :q! command to exit without saving the changes made to a file. You can exit vi without saving the changes using the :q command only if you didn't make any changes to the file.

Which key combination should you press in vi to save the file you are working on and quit?

:wq To enter command mode, you must press the colon (:) followed by the actions you want to take. The actions to take in this case are to write the file (save it), and quit.

Which of the following would be the result of the command ln -b ~/file1 /data/file1

A copy of the file ~/file1 would be placed in /data

You must do which of the following to define a persistent alias?

Add the command defining the alias to the appropriate shell configuration file.

What is the result of the uname -a command?

All system information is displayed on the screen. uname -a prints all system information.

A user calls with a concern about the display he is seeing after running the command: ps -ef. There are a number of processes that display getty and he is afraid that an unauthorized user is attached to the system. How should you respond?

Assure the user that this is normal A getty process represents a terminal that does not currently have a user. This is normal to see on a system that is configured for more than one terminal.

Which of the following options is the standard shell for most Linux computers? Korn Bourne-again shell (bash) Bourne shell tcsh C-shell

Bourne-again shell (bash)

The mode that works with the file system. Use it to save files after editing them.

Command line mode

The initial vim mode used when vim is started. It has commands that cut and replace text, and it is the mode vi uses to enter the other modes.

Command mode

Following is a list 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? shows a list of options available for a Linux command and explains what the options do. NAME TITLE SYNOPSIS DESCRIPTION

DESCRIPTION

purpose of the Filesystem Hierarchy Standard (FHS)?

During installation, software can predict where to place configuration files. Individual users can predict where to find system configuration files.

The mode that vim uses to write and edit text in the file.

Edit mode

Which of the following commands will configure the shell to retain 300 recently-used commands in the ~/.bash_history file for multiple shell sessions?

HISTFILESIZE=300 Use HISTFILESIZE=300 to specify the number of past commands remembered between multiple sessions.

Which environment variable affects the number of past commands used in the current shell session?

HISTSIZE

Which statement best describes the PATH environment variable? It specifies the filename where past commands are stored. It contains the path of the current working directory. It contains the directory prefixes used to search for programs and files. It specifies the characters the shell uses to indicate normal user ($), root user (#), and similar items.

It contains the directory prefixes used to search for programs and files.

suspected that passwords are still kept in the /etc/passwd file. When viewing that file which entry below would indicate that the passwords are still there?

Kolton:34uyx:431:0:Back Door:/root:/bin/bash The second field doesn't have an x. The second field of the /etc/passwd file holds the password values if they are there usually an x these days. If passwords are stored elsewhere (in /etc/shadow), then an "x" will appear in this field.

You are piping data from the cat command to another program, but the data is garbled. You believe the locale is corrupting the output. Which variable setting should you change to avoid the problem described above?

LANG=C LANG=C, programs display output without passing it through locale translations. This is helpful when the output is being corrupted by the locale, and will help avoid some types of problems, such as when using piplines and scripts that pass on a program's data to another program in binary form.

Which environment variable overrides all other locale settings and sets all locales to the same setting?

LC_ALL

Match locale environmental variable name with description: LC_ALL LC_NAME LANG LANGUAGE 1. Specifies personal name format. 2. A special variable used for overriding all other settings. It sets all locales to the same setting. 3. Specifically used as an override for LC_MESSAGES 4. Defines all locale settings at once, while allowing further individual customization via the LC_* settings.

LC_NAME variable = specifies personal name format LANGUAGE = specifically used as an override for LC_MESSAGES LC_ALL = a special variable used for overriding all other settings. It sets all locales to the same setting. LANG = defines all locale settings at once, while allowing further individual customization via the LC_* settings.

You are editing a text file with vi and need to open a new line above the one you are currently working on. What key should you press to accomplish this?

O Pressing the capital O will open a new line above the one you are currently working on.

Which of the following best describes the effects of having only the gshant user account listed in the /etc/at.allow file?

Only gshant and root can use the at command.

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? is always part of the PATH environment for all users

PATH=$PATH:/sbin/custom; export PATH

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? PATH=$PATH:$/sbin/special PATH=PATH&/sbin/special PATH=/sbin/special PATH=$PATH:/sbin/special

PATH=$PATH:/sbin/special A colon separates entries in the PATH statement, so one must be added to the end of the existing PATH ($PATH), and then the new directory specification appended. Using the absolute path, /sbin/special, identify the path to the directory you want to add.

Symbolic Link permission string = Hard Link permission string =

Symbolic Link = lrwxrwxrwx (has an l in beginning of permission string) Hard Link = -rwxr-xr-x (has a - in beginning of permisson string)

Which of the following statements best describes the split -50 -d -a 3 AllNames FiftyNames- command if there are 103 lines and 240 bytes in the file? 103 lines in Allnames file

The Allnames file is split into three files containing 50 lines or less. The output is FiftyNames-001, FiftyNames-002, and FiftyNames-003. split -50 -d -a 3 Allnames FiftyNames- splits Allnames file into three individual files containing 50 lines each from the content of the Allnames file. The output is FiftyNames-001, FiftyNames-002, and FiftyNames-003 Use split to split lines of text from a file or text stream into segments of a specified number of lines. -d tells split to use numeric suffixes in the output files created rather than alphabetic -a specifies the number of characters in the suffix in the output files created

Which of the following presents the greatest security risk?

The PATH statement includes . (period)

What will be the effect of the following command? ls -l /usr/bin >> /tmp/list.txt

The contents of the /usr/bin directory will be redirected into a file called /tmp/list.txt, inserted after previous contents of the file.

You are viewing the /etc/passwd file, and you notice the following entry: pclark:x:501:501:Petunia Clark:/home/pclark:/bin/bash

The pclark password is stored in the /etc/shadow file

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 administrator has just deleted those files. What happens to the links that you created?

The symbolic links would still exist in your home directory but they would now be broken.

What would be the outcome of the following command? userdel -r jjones

The user account, jjones, would be deleted along with jjones' home directory. (not all files owned by him just home directory and user account)

You made a few changes to the /boot/grub/grub.conf file and now you need to exit out of insert mode, save the changes, and quit. What should you do? (Select two. Each answer is a required part of the solution.) Type :wq Type :w! Press Esc Type :q!

Type :wq Press Esc To exit out of edit mode and save the changes: Press Esc to enter the command mode from edit mode. Type :wq to enter command line mode from command mode, save the current document, and exit vim.

What are two methods to exit vi from command mode? (Select two. Each answer is an independent solution) Type :wq Type:e! Type yy Type ZZ

Type :wq Type ZZ Type ZZ or :wq to exit vi from command mode.

What is not a characteristic of symbolic links?

Valid inode for the file data even if the original file is deleted.

Which command will display a list of the currently defined aliases on the system?

alias

The user mbrown 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: 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?

alias logcheck="cd /home/mbrown/logs;ls -al" the two commands need to be inside quotes and separated by a semi-colon (;).

Which of the following commands will create a shortcut to the tail -f /var/log/messages command? export alias="tail -f /var/log/messages" env alias="tail -f /var/log/messages" export alias sysmesg="tail -f /var/log/messages" alias sysmesg="tail -f /var/log/messages"

alias sysmesg="tail -f /var/log/messages"

If a system is down at the time a recurring regularly scheduled task is supposed to run, which task scheduling service will run the task when the system is back up again?

anacron

What service does cron rely on to run scripts in the /etc/cron.daily, /etc/cron.weekly, and /etc/cron/monthly directories?

anacron The cron service relies on anacron to run the scripts in the daily, weekly, and monthly cron directories. cron and anacron work hand in hand to ensure that important recurring regularly scheduled tasks are being run, even if the system goes down when the tasks were schedule to run.

Which daemon must be running if you want to use the at command?

atd The at daemon (atd) schedules tasks to occur at a specific time with the at command.

Which command should you enter at the command prompt to list the tasks in the at queue for the current user?

atq or at -l

What should be entered at the command prompt to remove tasks 2 and 3 in the at queue?

atrm 2 3 or at -d 2 3

. You are using awk to print a sorted list of the user names in /etc/passwd. which command will accomplish the sorted output?

awk -F: '{print $1}' /etc/passwd | sort The -F: indicates that the file separator is a colon (:), the separator that is used in the /etc/passwd file.

What would you enter at the command prompt to start a new Bourne-again shell (bash) session?

bash

Which command combines three files into a single text stream?

cat Use cat to display the contents of the file in the shell. This can include displaying multiple files at once. for example, cat myfile yourfile ourfile displays the contents of the three files in a single text stream.

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? displays output AND sends results/standard output to file sortedwordlist

cat /usr/wordlist1 /usr/wordlist2 | sort | tee sortedwordlist cat wordlist1 wordlist2 | sort | tee sortedwordlist

Which of the following commands will give the same results as cat < turbo? cat 1> turbo cat 2> turbo cat turbo cat 1&2> turbo

cat turbo The cat turbo command performs the same function. The default operation of the cat utility is to read and display a file. (You get the same result whether you use the input operator or not)

Which of the following commands redirects standard output to standard error? cat txtfile | tee 2 cat txtfile | 2 cat txtfile 1>&2 cat txtfile 2>&1

cat txtfile 1>&2 1>&2 redirects standard output to standard error when executed with a command.

Which of the following commands sorts the contents of wordlist1 and wordlist2 and sends the result to standard output?

cat wordlist1 wordlist2 | sort cat /usr/wordlist1 /usr/wordlist2 | sort because same as cat < /usr/wordlist1 /usr/wordlist2 | sort

You must change ownership of a script called myscript so that only the user owner has read/write access to it and only the user owner and group owner have execute permissions. Which of the following commands would accomplish this? chmod 771 myscript chmod 750 myscript chmod 755 myscript chmod 611 myscript

chmod 750 myscript chmod 750 myscript is correct because it allows the user owner full read, write, and execute permissions and the group owner read and execute permissions.

There is a directory called projects owned by the user cmarcela and the group rd. cmarcela has left the company. You need to give ownership of the projects directory, its files, and subdirectories to the user ebates, who is a member of the mgmt group(irrelevant). Which command should you use to change the user ownership?

chown -R ebates projects The chown -R ebates projects command allows you to change the user ownership for the project directory recursively (-R).

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.

cp -R /temp /home/gshant and cp -r /temp /home/gshant

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? so home = /root

cp /mnt/scd0/letter.doc /roo copy from source to the destination. The identified scd0 is valid as the first SCSI compact disk drive; scd1 is the second compact disk drive.

Which command could you use to verify if a crontab file exists for user thobbs?

crontab -l -u thobbs crontab -l -u user (to see if crontab file exists for user.)

After logging in as root, you need to manage the crontab files for your Linux system. Which command should you use to edit the crontab file for the gshant user account?

crontab -ue gshant

You need to obtain specific information found in the columns of ~/smarts. Which of following commands should you use?

cut -f ~/smarts Use cut -f ~/smarts to obtain specific information found in the columns of ~/smarts. Use cut to remove characters and fields from lines of text in a text stream or file. The command uses its options to determine whether to cut characters or fields and sends the results to standard output. cut -f cuts fields

Which of the following commands will cut an entire line from a file while in vi command mode?

dd While in command mode, use dd to cut an entire line from the text.

What is NOT a characteristic of hard links?

distinct inode (different) [because they're duplicated in hard links.]

Which commands shows you the value for the HISTSIZE variable?

echo $HISTSIZE

Which command shows the value of the LANG environmental variable currently set for the language the operating system uses?

echo $LANG Use the echo command to see the value of a variable. To specify an environmental variable, precede the name of the variable with a dollar sign ($).

What command can be used on most Linux distributions to find the directories where the man pages are kept? find directories where man pages are kept?

echo $MANPATH the MANPATH environment variable contains a list of directories where man pages are stored.

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 variables. Which command will display all the environment variables?

env

Which command will display only the environment variables applied to child sessions?

env

Which command will display all the environment variables?

env Use the env utility to display a list of all the environment variables and their values

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?

exec ./myapp Use exec ./myapp to start the myapp executable file and replace the shell with myapp process. The exec command executes an executable not found in the command path. It will also replace the shell with the new process created by the executable file. The ./ indicates that the executable is in the current directory.

You need to change how the formatting displays the /home/varstown file. Specifically, you need to replace each tab character with 3 spaces when you print the file to the screen. What command should you enter at the command prompt? change the tab characters into custom amount of spaces

expand -t 3 /home/varstown

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? so it is available to other shell programs

export COMP=1745 Use the export COMP=1745 command to set the variable.

You recently used the HOST=FS4 command. What command should you use to make the environment variable to apply to all child sessions?

export HOST Use export HOST to make the variable apply to all child sessions.

What would you enter at the command prompt to display a file's type?

file The file command shows the file type.

You are accessing the /home/shants/depsmark text file through a terminal connection. The file has long lines of text, yet your terminal only shows 75 characters per line. What should you use to limit the lines in the file to the limits on the terminal?

fmt /home/shants/depsmark Use fmt filename to format lines in the file with a uniform length of 75 characters. -w specifies the number of characters for the width. The default is 75 Use fmt to format line in a file or text stream to a uniform length. This is useful to format files with long lines to fit in a terminal.

You are the administrator for a small company. You need to create a new group for users in the sales department. You need to name the group sales. Which command will accomplish this? groupadd sales addgrouop sales groupadd -r sales addgroup -x sales

groupadd sales Use the groupadd utility to add a group to the system.

You have a group named temp_sales on your system. The group is no longer needed, and you should remove the group. Which of the following commands should you use? remove a group command with group name?

groupdel temp_sales

The sales groups must be renamed to marketing. which of the following commands will accomplish this?

groupmod -n marketing sales groupmod -n newgroupname oldgroupname Use groupmod utility to modify existing groups. Use -n parameter to change the name of a group.

What would you enter at the command prompt to display the primary and secondary group memberships for the gshant user account?

groups gshant

Which command displays all lines in ~/smarts, omitting the last 10 lines?

head -n -10 ~/smarts (head -n -10 filename) Use head -n -10 ~/smarts to display all lines in the file, omitting the last 10 lines.

What command should you enter to see a list of all the commands you recently used at the command prompt?

history

If you are viewing the contents of a man page, which key can you press to get back to the beginning of the page?

home

Which command should you use to convert encoding from one type to another?

iconv Use iconv to convert encoding from one encoding type to another

What commonly predefined alias is configured to run the ls -l command?

ll The ll command is actually a commonly predefined alias that runs the ls -l command to list the contents of a directory in long form.

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? ALL the contents not expanded listing though

ls -a /home/jerrys ls -a Use the ls -a command to view (all) the contents of a directory, including the hidden content

You need to make an expanded listing of all the files in /etc. Which command will produce the listing? expanded listing + ALL the files (hidden too hence all)

ls -al /etc Use ls command with the -a switch for all files and -l switch for the long (expanded) listing.

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?

ls -l | less

You are trying to debug a shell script that has the command ls -s in it. You suspect an error is occurring here and want to send the results of the operation (successful or error) to a file named Friday in order to examine it later. Which of the following commands should you use? ls -s >> Friday ls -s Friday ls -s > Friday ls -s> Friday 2>&1

ls -s> Friday 2>&1 or ls -s > Friday 2>&1

Which command prints the attributes of a /boot/grub/grub.conf file?

lsattr /boot/grub/grub.conf

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? uname command syntax and options?

man uname (also info uname, uname --help)

You need to create directory /var/oracle/database/9i only /var currently exists. From the root of filesystem, which command will create the directory path?

mkdir -p /var/oracle/database/9i mkdir -p will create all the directories that do not exist in the path. The mkdir command without the -p switch will not create the directories that do not exist in-between.

Which command would you use to move a file from one location to another?

mv

Which command would you use to rename the /home/pmallory/reports file to reports.bak?

mv /home/pmallory/reports /home/pmallory/reports.bak

lrwxrwxrwx 1 root root 4 2010-1105 myfile -> shantsgems What does this mean?

myfile is a symbolic link to shantsgems

You are trying to debug a shell script called myscript and to aid you in this task you would like to have the output of the script be recorded in a text file. Which of the following commands would satisfy your requirements? myscript >>testfile.txt myscript | testfile.txt echo myscript >> testfile.txt myscript | echo | testfile.txt

myscript >>testfile.txt myscript >> testfile.txt myscript >>testfile.txt is the correct answer because the >> redirector redirects the output of a command, in this case a script called myscript, into a file.

Which of the following statements best describes the nl -s ": " myfile command?

nl adds the number, a colon, and a space to the front of each line in the file.

While in command mode, you copied a whole line of text to memory. You navigated to a different location in the file, and now you need to place the line of text. What command should you use?

p Use p to place text in from memory into the document while in command mode.

You suspect that the gshant user account is locked. What would you enter at the command prompt to see the status of the gshant user account?

passwd -S gshant passwd -S gshant displays the status of the gshant user account.

Which utilities would you use to lock a user account?

passwd and usermod passwd -l locks an account and usermod -L does also

Which command will merge two files on a line-by-line basis, and separate each line with a tab?

paste use paste to add the contents of one file to the contents of another file on a line-by-line basis. paste -d specifies a character to place between the conjoined lines of each file. The default is a tab.

You need to change the formatting of the /home/varstown file as it prints. Specifically, you need to add double-spacing to each line in the file. How should you enter the command at the command prompt? add double-spacing to each line in the file

pr -d /home/varstown Use pr -d /home/varstown to add double-spacing to the /home/varstown file for printing.

You answer a call from a number of users who cannot access the mail server. Which utility would you use to quickly see if the sendmail service is running?

ps Use ps utility to show the running processes and see if the sendmail service is running.

You want to view all currently-running processes that include getty in the process name. Which command would you use?

ps -A | grep getty Use the -A option to search all processes. Use grep to search the output of a command.

Which command displays in the most detail all processes that are running?

ps -ef the -ef option with ps to show all the processes that are running in the most detail.

Which command displays the PPID?

ps -f (-f= detailed information, -A= all processes, -u= user ID) the ps -f command shows all possible details for processes, including the PPID (parent process ID, the PID from which another process has been spawned) When used alone, ps returns process information associated with the current user and terminal.

They want to increase the security of their small network and one of the tasks you have been given to do is to move their passwords from the /etc/passwd file to the /etc/shadow file. Which utility would you use to accomplish this?

pwconv Use the pwconv utility to move passwords from the less-secure /etc/passwd file to the more secure /etc/shadow file.

What would you enter at the command prompt to display the present working directory?

pwd

Which set of permissions represent the minimal permissions required to allow a user to list the contents of a directory?

r-x To list the contents of a directory, a user must have the read (r) permission and the execute (x) permission.

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?

rm -rf backup The command rm -rf backup will delete the directories and all the files in it.

What would you enter at the command prompt to remove the smp directory and the files it contains.

rm -rf smp or rm -r smp

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?

rmdir smp or rm smp Use rmdir to delete an empty directory Use rm to remove a directory that still has contents

You want to issue a simple command to replace all occurrences of the string foo with the string bar in the file myfile.txt. You have decided to use sed Which line will work?

sed -e 's/foo/bar/g' myfile.txt the sed -e 's/foo/bar/g' myfile.txt command replaces all the occurrences of foo with bar in myfile.txt. The s means substitute /foo/bar/ foo with bar. the g means global. the file to act on is myfile.txt

Which command will display all the environment variables on the system? on the system

set The set command displays all the environment variables on the Linux system. The env command displays the values for environment variables applied to child sessions. set: system environment variables env: exported environment variables

Which command will display each line in a text file based on the alphabetical characters?

sort use sort to sort each line of text in a file or from a text stream alphabetically.

Which command reads from standard input and writes to standard output and files?

tee The tee command reads from standard input and writes to standard output and files.

Which command would you use to look for a potential resource hog on a workstation?

top

You need to see a listing of running processes and system status such as memory and CPU usage. Which command will produce this listing?

top The top command produces an interactive listing of top running processes plus the status of memory and CPU usage.

Which of the following commands will change the /home/gshants/smile file's modification and last accessed times to the current time? change file's last accessed time to current time

touch /home/gshants/smile

Which command transposes characters in a text stream?

tr Use tr to transpose characters in a text stream. The command uses two character sets. The first set specifies the characters to be changed and the second set specifies what they should be changed to.

You need to change how the /home/varstown file is displayed. Specifically, you need to replace 4 consecutive spaces with a tab when you print the file to the screen. How should you enter the command at the command prompt? change the consecutive spaces into tabs

unexpand -t 4 /home/varstown to replace 4 consecutive spaces in the file with 1 tab. unexpand changes spaces into a tab. The default is 8 spaces; however, the -t options specifies the number of spaces to change.

Which text stream processing command filters identical, adjacent lines from a single file?

uniq Use uniq to filter identical lines from a file. The lines must be adjacent.

Which useradd option displays the default values specified in the /etc/default/useradd file?

useradd -D useradd -D displays the default values specified in the /etc/default/useradd file.

An employee named Bob Smith, with a user name of bsmith, has left the company. You have been instructed by your supervisor to delete his user account along with his home directory. Which of the following commands would produce the required outcome?

userdel -r bsmith and userdel bsmith;rm -rf /home/bsmith userdel -r will delete a user's home directory along with the user account. The command userdel by itself will not delete a user's home directory along with the user account. Executing rm -rf on the user's home directory after executing userdel would remove the home directory.

Which command will disable or remove the user account from the system and remove his home directory?

userdel -r larry

Enter the command that will remove emcmann from all her secondary groups.

usermod -G "" emcmann

You have just created the lsmith user account and need to assign this new user to the secondary groups admin and acct. Enter the command you would use to add lsmith to the admin and acct secondary groups.

usermod -G acct,admin lsmith To assign secondary group memberships to a user account, you use the usermod command with the -G option. You can assign more than one group at a time by separating the group names with a comma but no spaces.

What command example will disable a user account?

usermod -L username in this case usermod -L joer

You need to modify the group membership for the user gmyrick to add the staff group to his list of secondary group memberships. He needs to keep his existing secondary group memberships. Which command option will add gmyrick to the staff group without removing him from the other groups?

usermod -aG staff gmyrick In order to append a new group to a user's secondary group memberships, you need to use the -a option along with the -G option.

One of your users Karen Scott has recently married and is now Karen Jones. She has requested that her username be changed from kscott to kjones, but no other values change. Which of the following commands will accomplish this?

usermod -l kjones kscott

Brandon calls with an issue. He is currently using the C shell each time he logs in but has been told by his manager to start using the Bash shell. Which command will change Brandon's shell to the desired setting?

usermod -s /bin/bash brandon Use the usermod utility to modify user settings. Use the -s flag to signal a change to the user's shell. The current syntax requires the new shell value be given, followed by the username.

You need to create a new text file with the name network.txt in the current directory. Which command starts vi and creates the file? vi -new network.txt vi network.txt vi :w network.txt vi -n network.txt

vi network.txt

At the command prompt, how would you enter a command that will print the line count, word count, and byte count in the /home/gshant/servepath file?

wc /home/gshant/servepath or wc -lwc /home/gshant/servepath

Which of the following commands could you use to search man pages for a specific keyword? search man pages for a specific keyword?

whatis man -k apropos

Which command overcomes the 128kb shell command size restriction by breaking up long lists of arguments

xargs The xargs command reads items from the standard input and breaks up long lists of arguments into smaller, usable lists.

What command would you enter while in vi command mode to copy an entire line of text?

yy Use yy while in command mode to copy an entire line of text into memory.

Which symbol uses the output of one command as the input of another command?

| The pipe (|) symbol redirects the output of one command into the input of another command.

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? when you login to the system

~/.bash_login

After a user starts a BASH session and the scripts in /etc/profile are applied, ~/.bash_logout ~/.profile ~/.bash_profile ~/.bash_login

~/.bash_profile Login shells execute the configuration scripts they use in the following order: 1. /etc/profile 2. ~/.bash_profile 3. ~/.bash_login 4. ~/.profile

Which of the following files would you use to create aliases that are applied when a specific user starts a BASH session? ~/.profile ~/.bash_logout ~/.bashrc /etc/profile

~/.profile ~/.bashrc


Conjuntos de estudio relacionados

Black Book: Reading RIGHT and WRONG Answers (p64-69)

View Set

Chapter 11 Push/Pull Factors and Reasons

View Set

10. Environmental Policy Instruments

View Set

Experiment 25, 26, and 27 Identification of Staphylococcus Species

View Set

Unit 13: Nursing Support of Fluid, Electrolyte, & Acid-Base Balance

View Set

PrepU Chp 28: Assessment of Hematologic Function and Treatment Modalities

View Set

King Henry VIII and the Dissolution of the Monastries

View Set

Nutrition: Food is more than something to eat

View Set