Understanding Shell Path Variable Quiz
18 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

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

  • useradd -m tux (correct)
  • defaultuser tux
  • useradd -o default tux
  • usercreate tux
  • What information is stored in the /etc/passwd file?

  • The numerical user ID
  • The user's storage space limit
  • The encrypted password and the user's default shell (correct)
  • The username
  • Which of the following tar options handle compression?

  • -g
  • -j and -z (correct)
  • -bz
  • -z
  • What keyword is used in a shell script to begin a loop?

    <p>for</p> Signup and view all the answers

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

    <p>tar -cf work.tar ./work/</p> Signup and view all the answers

    Which of the following permissions does CertyIQ r=read w=write x=execute t = means?

    <p>The file can be deleted only by the owner or root user</p> Signup and view all the answers

    What is the purpose of setting a variable in Shell scripting?

    <p>To allow the execution of commands without knowing the executable location</p> Signup and view all the answers

    Which command can be used to set the variable USERNAME to 'bob' in Shell scripting?

    <p>set USERNAME bob</p> Signup and view all the answers

    In Shell scripting, what does the operator '?' do in a regular expression?

    <p>Matches the preceding character zero or one time</p> Signup and view all the answers

    Which command should be used in a script to display the content of a variable MYVAR in Shell scripting?

    <p>$MYVAR</p> Signup and view all the answers

    What issue arises when executing the given script 'script.sh' with 'MYVAR=value ./script.sh'?

    <p>The script does not display the content of MYVAR</p> Signup and view all the answers

    Which special character is used for wildcard matching in Linux commands?

    <ul> <li></li> </ul> Signup and view all the answers

    What will the command ls ../ Documents/ do if executed in the /home/user/Downloads/ directory?

    <p>List the contents of the <code>/home/user/Documents/</code> directory</p> Signup and view all the answers

    Which command will copy all files ending with .txt to the /tmp/ directory?

    <p>cp *.txt /tmp/</p> Signup and view all the answers

    How can you split a long command across multiple lines in the shell?

    <p>Use the <code>\</code> backslash character at the end of each line</p> Signup and view all the answers

    Which command would move all files starting with text and ending with .csv to a new directory called data?

    <p>mv text*.csv data/</p> Signup and view all the answers

    What is the purpose of the chmod command?

    <p>Change the permissions (read, write, execute) of a file or directory</p> Signup and view all the answers

    Which command would list all files in the current directory, including hidden files?

    <p>ls -a</p> Signup and view all the answers

    More Like This

    Shell Command Output Redirection
    12 questions
    Shell-Light Structure Architecture
    39 questions
    shell scripting
    21 questions

    shell scripting

    CalmSerpentine8789 avatar
    CalmSerpentine8789
    Use Quizgecko on...
    Browser
    Browser