Linux LPI 117-101 # 4 Of 9

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 Tobyyy
T
Tobyyy
Community Contributor
Quizzes Created: 10 | Total Attempts: 1,406
Questions: 53 | Attempts: 120

SettingsSettingsSettings
Linux Quizzes & Trivia

Linux lpi testing


Questions and Answers
  • 1. 

    Type the command line to check the installed package mypackage for anyconfiguration file changes since install?

    Correct Answer
    rpm -V mypackage
    Explanation
    Verifying a package compares information about the installed files in
    the package with information about the files taken from the package metadata
    stored in the rpm database. Among other things, verifying compares the size, MD5
    sum, permissions, type, owner and group of each file. Any discrepancies are
    displayed.
    To verify the package:
    rpm -Va or -verify -a packagename

    Rate this question:

  • 2. 

    What command on an rpm-based system will upgrade any existing packages on asystem, but not add any packages? Type just the command and switch(es).

    Correct Answer
    rpm -F
    Explanation
    -U or -F both option is used to upgrade the package. -U option upgrade if
    lower version is installed otherwise install the new version package but -F option only
    upgrade if lower version package installed. As well as it doesn't add(install) any other
    packages.

    Rate this question:

  • 3. 

    What command on an rpm-based system will upgrade any existing packages on asystem, and add any packages needed? Type just the command and switch(es).

    Correct Answer
    rpm -U
    Explanation
    -U or -F both option is used to upgrade the package. -U option upgrade if
    lower version is installed otherwise install the new version package but -F option only
    upgrade if lower version package installed. As well as it doesn't add(install) any other
    packages.

    Rate this question:

  • 4. 

    Which command will allow you to find a specific installed package?

    • A.

      Rpm -- list rpmname

    • B.

      Rpm -qvl rpmname

    • C.

      Rpm rpmname

    • D.

      Rpm -qv rpmname

    • E.

      Rpm -f rpmname

    Correct Answer
    D. Rpm -qv rpmname
    Explanation
    To query the package whether, package is installed or not :
    rpm -qv rpmname
    example: rpm -qv ncurses à It shows rpm fullname, version if installed otherwise it will
    display package is not installed.
    Installed package options:
    rpm -qa à Lists all installed packages
    rpm -qf filename à Shows owning package
    rpm -qi rpmname à General Information of Package
    rpm -ql rpmname à Shows all files owning by this package

    Rate this question:

  • 5. 

    Which command will print to standard out only the lines that do notbegin with # (pound symbol) in the file foobar?

    • A.

      /bin/grep ^# foobar

    • B.

      /bin/grep -v ^# foobar

    • C.

      /bin/grep #$ foobar

    • D.

      /bin/grep -v #$ foobar

    Correct Answer
    B. /bin/grep -v ^# foobar
    Explanation
    rep stands for general regular processor, used to prints all lines
    where pattern matched.
    Achor symbol used by String Processor tools like sed, awk and grep
    ^ àLine begins with
    $ à Line ends with
    \word end with
    -v option in grep is non matching.

    Rate this question:

  • 6. 

    You have an updated RPM called screensaver-1.1.i386. rpm. Youhave version 1.0 installed. Using RPM, how do you view the changelog ofthis file to see if you should install the update?

    • A.

      Rpm -qp --changelog screensaver-1.1.i386.rpm

    • B.

      Rpm --changelog screensaver-1.1.i386.rpm

    • C.

      Rpm -qc screensaver-1.1.i386.rpm

    • D.

      Rpm -showchangelog screensaver-1.1.i386.rpm

    Correct Answer
    B. Rpm --changelog screensaver-1.1.i386.rpm
    Explanation
    Syntax of rpm command
    rpm [options] package
    -i à Install
    -U àUpgrade package if lower version is installed otherwise install the new package.
    -F à Upgrade package if only lower version is installed.
    -l à List all files belongs to package
    -p à Package Name
    -q à Query
    --changelog à Display change information for the package.

    Rate this question:

  • 7. 

    You want to preview where the package file,apache- xml.I386.rpm, will install its files before installing it. Whatcommand do you issue?

    • A.

      Rpm -qp apache-xml.i386.rpm

    • B.

      Rpm -qv apache-xml.i386.rpm

    • C.

      Rpm -ql apache-xml.i386.rpm

    • D.

      Rpm -qpl apache-xml.i386.rpm

    Correct Answer
    D. Rpm -qpl apache-xml.i386.rpm
    Explanation
    rpm -qpl apache-xml.i386.rpm

    Rate this question:

  • 8. 

    You see following output while trying to install an updated package:[root@example pub]# rpm -i gthumb-2.2.0.i386.rpm package gthumb-1.0.1.i386.rpm is already installed.Which command will allow you to install the updated version?

    • A.

      Rpm -i gthumb-2.2.0.i386.rpm

    • B.

      Rpm -ivh gthumb-2.2.0.i386.rpm

    • C.

      Rpm -U gthumb-2.2.0.i3S6.rpm

    • D.

      Rpm -qu gthumb-2.2.0.i386.rpm

    • E.

      Rpm -qiv gthumb-2.2.0.i386.rpm

    Correct Answer
    C. Rpm -U gthumb-2.2.0.i3S6.rpm
    Explanation
    Syntax of rpm command
    rpm [options] package
    -i à Install
    -U àUpgrade package if lower version is installed otherwise install the new package.
    -F à Upgrade package if only lower version is installed.

    Rate this question:

  • 9. 

    You have to test a new kernel version. Which of the following is thebest way to add a new linux kernel in your system?

    • A.

      Rpm -fvh kernel_package

    • B.

      Rpm -Uvh kernel_package

    • C.

      Rpm -u kernel_package

    • D.

      Rpm -u kernel_package && make

    • E.

      Rpm -u kernel_package && make

    Correct Answer
    B. Rpm -Uvh kernel_package
    Explanation
    Syntax of rpm command
    rpm [options] package
    -i à Install
    -U àUpgrade package if lower version is installed otherwise install the new package.
    -F à Upgrade package if only lower version is installed.

    Rate this question:

  • 10. 

    You want to search the file myfile for all occurrences of a string containing at leastfive characters, where character number 2 and 5 are "a" and character number 3 isNOT "b". Which command would you use?

    • A.

      Grep a*^b*a myfile

    • B.

      Grep .a[^b].a myfile

    • C.

      Grep .[a].*.[a] myfile

    • D.

      Grep .a*^b..a myfile

    Correct Answer
    B. Grep .a[^b].a myfile
    Explanation
    String Processing Tools like grep, sed, awk uses wildcard characters.
    . à Any Single character from the range
    [abc] à Any Single Character from the set
    [a-c] à Any Single Character from the Range
    [^abc] à Any Single Character except from the set.
    [^a-c] àAny Single Character except from the range.
    According to QUESTION, in 2nd and 5th position must be a and in 3rd position not b.
    B. . means any single character in first postion., a means a must be in second postions,
    [^b] means b must not be in third postion, . means any single character in fourth position
    and a in fifth position.

    Rate this question:

  • 11. 

    You installed a beta rpm package, but are experiencing some problems with it. Howcan you remove this package?

    • A.

      Rpm -qe rpmname

    • B.

      Rpm -V --remove rpmname

    • C.

      Rpm -r rpmname

    • D.

      Rpm -r rpmname

    • E.

      Rpm -ev rpmname

    Correct Answer
    D. Rpm -r rpmname
    Explanation
    To uninstall the package, we use the rpm -ev rpmname or rpm --erase
    rpmname
    To install package: rpm -ivh rpmname : where -I means install, -v means verbose, -h
    means display the Hash marks.
    To Upgrade rpm: rpm -Uvh rpmname: where -U means Upgrade.
    To Freshen Upgrade : rpm -Fvh rpmname

    Rate this question:

  • 12. 

    You wish to set your shell options so that the output from a redirect will NOToverwrite an existing file. Type the command including switches.

    Correct Answer
    set -o noclobber
    Explanation
    noclobber global option controls the file overwriting to an existing file.
    set -o : Lists all options with on/off status
    set -o noclobber : Set on the noclobber and restrict to use the redirect (>) symbol.
    set +o noclobber : Set off the noclobber and allow to use the redirect (>) symbol.

    Rate this question:

  • 13. 

    You wish to turn off the shell option that stops you overwriting exisiting files. Typethe command in that will do this including switches.

    Correct Answer
    set +o noclobber
    Explanation
    noclobber global option controls the file overwriting to an existing file.
    set -o : Lists all options with on/off status
    set -o noclobber : Set on the noclobber and restrict to use the redirect (>) symbol.
    set +o noclobber : Set off the noclobber and allow to use the redirect (>) symbol.

    Rate this question:

  • 14. 

    You have just typed the following three commands and got the following output:prompt> echo $PATH/usr/bin:/usr/local/bin:usr/sbin:opt/kde/binprompt> pwd/home/anna/gamespromt> lsgame1 game2 game3You want to run the program game1, but get the response that it is not found.What did you forget to do?

    • A.

      To type ./game1 rather than game1.

    • B.

      To switch the directory /home/anna first.

    • C.

      To unset your PATH before running the program.

    • D.

      To set execution permissions for the program game1.

    Correct Answer
    A. To type ./game1 rather than game1.
    Explanation
    /home/anna directory is not set on path. So to execute the program
    from the directory not set in path, should execute by givin full path or use the ./ .
    If you are in /home/anna use ./ means under current directory.
    To set the directory on path
    PATH=$PATH:/home/anna/

    Rate this question:

  • 15. 

    What is the name and full path of the file that contains the system wideEnvironment variables and Startup programs?

    Correct Answer
    /etc/profile
    Explanation
    The /etc/profile shell scrpt is first startup script run when a login shell
    is started. It only runs for the login shells, non-login shells do not invoke this script.
    This script will set a series of variables including PATH, USER, LOGNAME, MAIL,
    HOSTNAME, HISTSIZE, INPUTRC as well calls the startup programs to execute.

    Rate this question:

  • 16. 

    Type in just the name of the command that allows you to edit the command history,and will execute the contents of the buffer when exited.

    Correct Answer
    fc
    Explanation
    fc command allows the history command to edit as well as when you
    exit from the edit mode, It will executes the command.

    Rate this question:

  • 17. 

    You wish to find out more information on a file e.g. Last accessed, Modifiedchanged, Inode. What is the simplest command that would show this informationfor a file called certkiller?

    Correct Answer
    stat certkiller
    Explanation
    stat command displays the meta information of file.
    Example:
    stat file1
    File: file1
    Size: 5 Blocks:8 IO Block: 409 regular file
    Device: 30ch/780d Inode: 16217 Links: 2
    Access: (0644/-rw-r-r--) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2006-04-16 12:50:44.000000000
    Modify: 2006-04-16 12:50:44.000000000
    Change: 2006-04-16 12:50:44.000000000

    Rate this question:

  • 18. 

    Which command will output the exit status of the previous command (a 1 or a 0)?

    • A.

      Echo $?

    • B.

      Echo $1

    • C.

      Echo $EXIT

    • D.

      Exitstatus

    Correct Answer
    A. Echo $?
    Explanation
    $? is used to displays to catch the return value. When command
    executes it returns 0 or other value. 0 means command is executed successfully and
    other value means executed with error.
    Example:
    function test1()
    {
    echo "From test1 function"
    return 1
    }
    echo "Retrun Value is " $?

    Rate this question:

  • 19. 

    What 3 letter command will show you the values set by the /etc/profile script file forthe entire system?

    Correct Answer
    env
    Explanation
    env command is used to display the all environmentall variables as
    well as values. Where /etc/profile file is used to set the value into the environmental
    variable.

    Rate this question:

  • 20. 

    What 3 letter command will show you the values set by the /etc/bashrc script file forthe entire system?

    Correct Answer
    set
    Explanation
    set command is used to display the all shell as well as environmental
    variables as well as variables values. env command is used to display the all
    environmentall variables as well as values.

    Rate this question:

  • 21. 

    Your Linux machine has 2 monitors. Your second monitor is configures as thesecond screen of the first display. If you want the "netscape" program to bedisplayed on your second monitor, what command should you use before startingnetscape?

    • A.

      Export set display=:10; netscape

    • B.

      Export set DISPLAY=:0:0; netscape

    • C.

      Export set DISPLAY=:0:1; netscape

    • D.

      Export set DISPLAY=:1:0; netscape

    Correct Answer
    C. Export set DISPLAY=:0:1; netscape
    Explanation
    Answer C is correct because:
    export set DISPLAY=192.168.0.1:0 : means displays on first monitor of 192.168.0.1
    host.
    export set DISPLAY=192.168.0.1:1 : means on second monitor of 192.168.0.1 host.

    Rate this question:

  • 22. 

    You have a dual-head workstation with two monitors. Your secondary monitor isdefined as the second screen of the first display. You want to start Mozilla anddisplay its window on the second display. Which command line would you use toachieve this?

    • A.

      Export DISPLAY=:1.0; mozilla

    • B.

      Export DISPLAY=:0.1; mozilla

    • C.

      Export SECOND=1; mozilla

    • D.

      Export SECOND=2; mozilla

    Correct Answer
    C. Export SECOND=1; mozilla
    Explanation
    Answer C is correct because:
    export set DISPLAY=192.168.0.1:0 : means displays on first monitor of 192.168.0.1
    host.
    export set DISPLAY=192.168.0.1:1 : means on second monitor of 192.168.0.1 host.

    Rate this question:

  • 23. 

    Which of the following are executed ONLY during a Login session? Select all thatapply.

    • A.

      /etc/profile

    • B.

      /etc/bashrc

    • C.

      ~/.bashrc

    • D.

      ~/.bash_profile

    • E.

      ~/.bash_logout

    Correct Answer(s)
    A. /etc/profile
    D. ~/.bash_profile
    E. ~/.bash_logout
    Explanation
    Startup scripts: For Login shell
    /etc/profile
    /etc/profile.d
    ~/.bash_profile
    ~/.bashrc
    /etc/bashrc
    Non-Login Shell
    ~/.bashrc
    /etc/bashrc
    /etc/profile.d
    /etc/profile, ~/.bash_profile file calls when login shell provided users logged in.
    ~/.bash_logout: File calls when user logout from the shells, useful for backup, clearing
    /tmp etc.

    Rate this question:

  • 24. 

    In which file are you likely to find the settings for umask, path, and ulimit on a peruser basis?

    • A.

      /etc/profile

    • B.

      /etc/bashrc

    • C.

      ~/.bash_profile

    • D.

      ~/.bashrc

    Correct Answer
    C. ~/.bash_profile
    Explanation
    ~/bash_profile and ~/bashrc file for user specific settings, common to
    place variable settings, aliases, commands that places output to the screen, such as
    date command, should go in .bash_profile not .bashrc.

    Rate this question:

  • 25. 

    In Bash, inserting "1>&2" after a command redirects

    • A.

      Standard error to standard input

    • B.

      Standard input to standard error

    • C.

      Standard output to standard error

    • D.

      Standard error to standard output

    • E.

      Standard output to standard input

    Correct Answer
    C. Standard output to standard error
    Explanation
    Statndard Input use < symbol and 0 is the integer value
    Standard Output use > symbol and 1 is the integer value
    Standard Error use 2> symbol and 2 is the integer value
    Example:
    find / - name passwd >allresult 1>&2 : Redirects all standard output as well as standard
    error to allresult file. Where & is the logical operator.

    Rate this question:

  • 26. 

    What three letter command in Bash will display all environment variables?

    Correct Answer
    env
    Explanation
    env command displays all environmental variables as well as it's value. Where set is another command displays all shell variables.

    Rate this question:

  • 27. 

    Type in just the name of the default file that the command line history is stored infor a logged in user.

    Correct Answer
    .bash_history
    Explanation
    One environmental variable named HISTFILE carrying the name of
    file to store the history command. By default the history commands stores in
    ~/bash_histroy.
    You can displays using the variable:
    echo $HISTFILE

    Rate this question:

  • 28. 

    Type just the name of the file in a normal user's home directory that will set theirlocal user environment and startup programs on a default Linux system.

    Correct Answer
    .bash_profile
    Explanation
    ~/bash_profile and ~/bashrc file for user specific settings, common to
    place variable settings, aliases, commands that places output to the screen, such as
    date command, should go in .bash_profile not .bashrc.

    Rate this question:

  • 29. 

    On a default Linux system, what is the name of the file that sets users aliases andfunctions?

    Correct Answer
    .bashrc
    Explanation
    ~/bash_profile and ~/bashrc file for user specific settings, common to
    place variable settings, aliases, commands that places output to the screen, such as
    date command, should go in .bash_profile not .bashrc.

    Rate this question:

  • 30. 

    What is the name and full path of the file that contains the system wide aliases andfunctions for the default Linux shell?

    Correct Answer
    /etc/bashrc
    Explanation
    /etc/bashrc file sets the system wide aliases, functions as well as default
    permission umask value for root as well as non-root user.

    Rate this question:

  • 31. 

    What is the name of the file that runs on user logout, usually set to clear the screen?

    Correct Answer
    .bash_logout
    Explanation
    ~/bash_logout file execute when exiting a login shell, Useful for
    running programs automatically at logout ie, clear the screen, make backup files,
    delete temporary files, display date and time etc

    Rate this question:

  • 32. 

    You are in your home directory. You have made changes to your .bash_profile andincorporated a modified PATH variable. Type in the command that will reread the .bash_profile and set the changes you have made.

    Correct Answer
    source .bash_profile
    .bash_profile
    Explanation
    ~/.bash_profile executes when loggin shell provided users login. So, to
    bring the changes made on ~/bash_login either user should re-login or manually
    executest the shell scripts file ~/.bash_profile.

    Rate this question:

  • 33. 

    When a user executes the command "ps ax", what is shown on the console? Chooseall that apply.

    • A.

      Process's user-related information

    • B.

      Processes without controlling terminals

    • C.

      Processes used by the XFree86 System

    • D.

      All regular processes

    • E.

      Processes on remote machines

    Correct Answer(s)
    B. Processes without controlling terminals
    D. All regular processes
    Explanation
    Process are running in two different methods: one is terminal
    dependent (means controlled by terminal ) and second is terminal independent
    (terminal independent).
    ps -a: All process not including not controlled by terminal
    ps -x : All process including not controlled by terminal

    Rate this question:

  • 34. 

    Which shell built-in command can be used to create a shortcut orpseudonym for a longer command? Assume a modern bourne-like shell,such as bash.

    • A.

      Shortcut

    • B.

      Ln

    • C.

      Sudo

    • D.

      Link

    • E.

      Alias

    Correct Answer
    E. Alias
    Explanation
    Alias command is used to create like shortcut of long command.
    Example: alias back="tar -cvf mytar.tar /root/*", here back will be the alias (shortcut) of
    complete "tar -cvf mytar.tar /root/*" command.

    Rate this question:

  • 35. 

    Which of the following commands will send output from the programmyapp to both standard output (stdout) and the file file1.log?

    • A.

      Cat < myapp | cat > file1.log

    • B.

      Myapp 0>&1 | cat > file1.log

    • C.

      Myapp | cat > file1.log

    • D.

      Myapp | tee > file1.log

    • E.

      All the other alternatives are incorrect.

    Correct Answer
    E. All the other alternatives are incorrect.
    Explanation
    Answer should be like this: set | tee set.out àtee command helps to
    redirect the output to file while piping. Here output of set will display as well as
    output redirect to set.out file.

    Rate this question:

  • 36. 

    In order to append the output of ls to a file called bazz, which of the followingcommand lines would you use?

    • A.

      Ls > bazz

    • B.

      Ls >& bazz

    • C.

      Ls &> bazz

    • D.

      Ls >> bazz

    Correct Answer
    D. Ls >> bazz
    Explanation
    Common Redirection Operator:
    Command >file à Redirect the Standard Output of command into file.
    Command >>file à Append the Standard Output of command into file.
    Command file à Redirect the error message to file.
    Command 2>>file à Append the error message to file.

    Rate this question:

  • 37. 

    You have two shell scripts, foo and bar. You wish to have bar execute if foo returnsan exit status of 0. Select the correct command:

    • A.

      Foo; bar

    • B.

      Foo || bar

    • C.

      Foo && bar

    • D.

      Foo % bar

    Correct Answer
    C. Foo && bar
    Explanation
    && à Logical AND Operator

    || à Logical OR Operator
    ! à Logical NOT Operator
    Correct Answer is C because first tried to execute foo. If foo executes without any error
    then executes bar. If any error occurs in foo then exit from command.

    Rate this question:

  • 38. 

    Which command will print line numbers before each line in a file?

    • A.

      Ln

    • B.

      Nl

    • C.

      Cat -n

    • D.

      Numline

    Correct Answer
    C. Cat -n
    Explanation
    cat command is used to display the contents of file in standard output.
    Syntax: cat [option] filename.
    Options: -n, -b à Display the line number before each line
    -A à Show all characters including control characters.
    -s à Squeeze multiple adjacent blank lines into one line

    Rate this question:

  • 39. 

    You want to repeat command number 3 in your history. How would you do this?

    • A.

      Repeat 3

    • B.

      !3

    • C.

      Show 3

    • D.

      #3

    Correct Answer
    B. !3
    Explanation
    bash shell stores the history commands later we can re-execute the
    commands from the history.
    !! : To repeat the last entered command
    !n : To execute the command from history having n numbered.
    !-n : To execute the command entered n command back
    !c : To execute the command started from history started by c character.

    Rate this question:

  • 40. 

    What is the correct format for a proper command in the shell?

    • A.

      Option Argument Command

    • B.

      Command Argument Option

    • C.

      Command Option Argument

    Correct Answer
    C. Command Option Argument
    Explanation
    Syntax of executing the command in shell is
    command [options] argument
    example: ls -l /etc : Where ls is command, -l is option and /etc/ is the parameter or
    argument for ls command.

    Rate this question:

  • 41. 

    Which of the following will allow both the commands to execute, regardless of theirindividual exit status?

    • A.

      Command1 | command2

    • B.

      Command1 $ command2

    • C.

      Command1 & command2

    • D.

      Command1 ; command2

    • E.

      Command1 ^ command2

    Correct Answer
    D. Command1 ; command2
    Explanation
    ; helps to execute the multiple commands in order.
    example: clear;ls : First execute clear then ls.
    && is AND logical Operator
    || is OR logical operator
    ! is NOT logical Operator

    Rate this question:

  • 42. 

    Which of the following will cause command2 not to execute if command1 fails?

    • A.

      Command1 & command2

    • B.

      Command1 && command2

    • C.

      Command1 || command2

    • D.

      Command1 | command2

    • E.

      Command1 ; command2

    Correct Answer
    B. Command1 && command2
    Explanation
    && is the Logical AND operator, whiche means second command
    executes if first command excuted successfully.
    Example: cat a && ls : if cat a executes successfully then only ls command will execute
    other wise exit from the cat command.

    Rate this question:

  • 43. 

    How can you execute two commands, the second one being executed only if the firstreturns a nonzero (program execution failed) exit status?

    • A.

      Command1 || command2

    • B.

      Command1 && command2

    • C.

      Command1 $$ command2

    • D.

      Command1 @@ command2

    Correct Answer
    A. Command1 || command2
    Explanation
    || is called the Logical OR Operator, which means either in sense eiher
    first or second. If first command exited with error then only second executes.
    Example: cat a || ls : if cat command return the error code then start to execut the ls
    command.
    Remember that if command executes successfully then it returns zero value and if
    command executes with error it returns the error code.

    Rate this question:

  • 44. 

    You want to repeat the last command you entered. How would you do this?

    • A.

      #

    • B.

      !!

    • C.

      #l

    • D.

      ##

    Correct Answer
    B. !!
    Explanation
    !! re-excutes the last entered command.
    !n : executes the command from history n numbered in history list. You can use the
    history command to list all history commands.

    Rate this question:

  • 45. 

    You want to view a listing of previously entered commands. What command wouldyou use?

    • A.

      Hist

    • B.

      Histfile

    • C.

      Showbuff

    • D.

      History

    Correct Answer
    D. History
    Explanation
    history command lists all commands in history. All history commands
    stored in ~/.bash_history file.

    Rate this question:

  • 46. 

    You want to run three commands one after the other, but don't care what exit theyhad. What command line would do this?

    • A.

      Cmd1 cmd2 cmd3

    • B.

      Cmd1, cmd2, cmd3

    • C.

      Cmd1: cmd2: cmd3

    • D.

      Cmd1; cmd2; cmd3

    Correct Answer
    D. Cmd1; cmd2; cmd3
    Explanation
    ; symbol helps to separate the multiple commands. It never checks the
    retrun value so not like the logical operator.
    Example: cat a;ls;date : three commands are combined first executes cat command then ls
    and then date.

    Rate this question:

  • 47. 

    Type in the command line that will execute cmd2 regardless of exit status of cmd1.Assume these commands are on the systems PATH and the command names arecmd1 and cmd2.

    Correct Answer
    cmd1;cmd2
    cmd1 ; cmd2
    cmd1; cmd2
    cmd1 ;cmd2
    Explanation
    symbol helps to separate the multiple commands. It never checks the
    retrun value so not like the logical operator.
    Example: cat a;ls;date : three commands are combined first executes cat command then ls
    and then date.

    Rate this question:

  • 48. 

    What command would execute cmd1 followed by cmd2, regardless of the exit statusof cmd1?

    • A.

      Cmd1 cmd2

    • B.

      Cmd1 | cmd2

    • C.

      Cmd1 ; cmd2

    • D.

      Cmd1 && cmd2

    • E.

      Cmd1 || cmd2

    Correct Answer
    C. Cmd1 ; cmd2
    Explanation
    ; symbol helps to separate the multiple commands. It never checks the
    retrun value so not like the logical operator.
    Example: cat a;ls;date : three commands are combined first executes cat command then ls
    and then date.

    Rate this question:

  • 49. 

    Which keystrokes will move the cursor 3 lines down and 4 characters to the right?

    • A.

      3j4l

    • B.

      3k4m

    • C.

      3h4j

    • D.

      3l4k

    • E.

      3m4k

    Correct Answer
    A. 3j4l
    Explanation
    Cursor Movement in vi editor:
    h : Left
    j : down
    k : up
    l : right
    Example: when you press the h key it moves the cursor in left of one character.
    3h: moves the cursor in 3 characters left

    Rate this question:

  • 50. 

    You want to repeat a command that began with the letters 'ab'. How would you dothis?

    • A.

      !ab

    • B.

      List ab

    • C.

      #ab

    • D.

      Show ab

    Correct Answer
    A. !ab
    Explanation
    bash shell stores the history commands later we can re-execute the
    commands from the history.
    !! : To repeat the last entered command
    !n : To execute the command from history having n numbered.
    !-n : To execute the command entered n command back
    !c : To execute the command started from history started by c character.

    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 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 02, 2009
    Quiz Created by
    Tobyyy
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.