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 (D)</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/ (C)</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 (A)</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 (D)</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 (B)</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 (C)</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 (A)</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 (B)</p> Signup and view all the answers

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

<ul> <li>(A)</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 (B)</p> Signup and view all the answers

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

<p>cp *.txt /tmp/ (B)</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 (D)</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/ (B)</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 (C)</p> Signup and view all the answers

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

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

More Like This

Shell Scripting Basics
15 questions

Shell Scripting Basics

HallowedMajesty avatar
HallowedMajesty
Shell Command Output Redirection
12 questions
Use Quizgecko on...
Browser
Browser