Mastering Linux Command Line File Manipulation
49 Questions
1 Views
3.5 Stars

Mastering Linux Command Line File Manipulation

Created by
@RefinedBowenite

Questions and Answers

Which command is used to start a new tmux session?

$ tmux new-session

What is the purpose of using sed in the UNIX environment?

To automate edits

What does the command 'sed -i 's/old/new/g' *.txt' do?

Replaces the word 'old' with 'new' in all files with the extension '.txt'

Which command is used to list files that don't match filea, fileb, or filec?

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

What is the purpose of using quotes in shell scripting?

<p>To access variable values inside the quotes</p> Signup and view all the answers

Which command is used to substitute a pattern with a replacement in a file using sed?

<p>a) s</p> Signup and view all the answers

Which command is used to delete lines containing a specific pattern in a file using sed?

<p>b) d</p> Signup and view all the answers

Which command is used to obtain command arguments from another command's output?

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

Which command is used to append text after lines containing a specific pattern in a file using sed?

<p>c) a</p> Signup and view all the answers

What is the purpose of the '$$' special variable in shell scripting?

<p>To get the shell process ID</p> Signup and view all the answers

Which command is used to insert text before lines containing a specific pattern in a file using sed?

<p>d) i</p> Signup and view all the answers

Which command is used to terminate a process with a specified pid?

<p>kill -9 pid</p> Signup and view all the answers

What does the SIGHUP signal indicate?

<p>The disconnection of a user's terminal</p> Signup and view all the answers

What does the 'disown' command do?

<p>Detaches a process from the current terminal</p> Signup and view all the answers

What is the default behavior for the SIGHUP signal?

<p>Stop executing processes</p> Signup and view all the answers

Which command is used to create a new window in tmux?

<p>$ tmux new-window</p> Signup and view all the answers

What is the purpose of the 'sed' command in the UNIX environment?

<p>All of the above</p> Signup and view all the answers

What is the purpose of the 'tmux-resurrect' plugin?

<p>To save and restore tmux sessions</p> Signup and view all the answers

Which command is used to assign input to variables in shell scripting?

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

What is the purpose of the 'expr' command in shell scripting?

<p>To evaluate arithmetic expressions</p> Signup and view all the answers

What is the purpose of the 'bg' command in UNIX?

<p>To resume a suspended job and run it in the background</p> Signup and view all the answers

What is the purpose of the 'time' command in UNIX?

<p>To measure the execution time of a command</p> Signup and view all the answers

Which command is used to run a command in the background in a shell script?

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

What is the purpose of the 'nice' command in Unix-like OS?

<p>To control the priority of a process</p> Signup and view all the answers

What is the default niceness value in Unix-like OS?

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

What is the effect of having a higher niceness value on a process's CPU time?

<p>The process will receive less CPU time</p> Signup and view all the answers

Which command is used to delete empty lines in a file using sed?

<p>sed '/^$/d' file.txt</p> Signup and view all the answers

What does the command 'grep '^apple' file.txt' do?

<p>Prints lines that start with 'apple' in the file.txt</p> Signup and view all the answers

What does the command 'awk '{print $2}' file.txt' do?

<p>Prints the second column of a space-separated file</p> Signup and view all the answers

What is the purpose of using the '-n' option with sed?

<p>Suppresses auto-display of pattern space</p> Signup and view all the answers

Which command is used to start a new tmux session?

<p>$ tmux new-session</p> Signup and view all the answers

Which command is used to terminate a tmux session with a specified session name?

<p>$ tmux kill-session -t</p> Signup and view all the answers

Which command is used to create a new window in tmux?

<p>$ tmux new-window</p> Signup and view all the answers

Which command is used to assign input to variables in shell scripting?

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

What is the purpose of using quotes in shell scripting?

<p>To enclose strings that contain special characters</p> Signup and view all the answers

What does the command 'grep' do in the UNIX environment?

<p>Searches for a pattern in a file</p> Signup and view all the answers

What is the purpose of the 'bg' command in UNIX?

<p>Resumes a suspended job and runs it in the background</p> Signup and view all the answers

Which command is used to delete lines containing a specific pattern in a file using sed?

<p>sed '/pattern/d' file.txt</p> Signup and view all the answers

Which command is used to append text after lines containing a specific pattern in a file using sed?

<p>sed '/pattern/a\ ext' file.txt</p> Signup and view all the answers

What is the purpose of using quotes in shell scripting?

<p>To group multiple commands together</p> Signup and view all the answers

What does the command 'grep '^apple' file.txt' do?

<p>Matches lines that start with 'apple'</p> Signup and view all the answers

Which command is used to run a command in the background in a shell script?

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

What is the purpose of the 'nice' command in Unix-like OS?

<p>To control the priority of a process</p> Signup and view all the answers

What does the SIGHUP signal indicate?

<p>The disconnection of a user's terminal</p> Signup and view all the answers

What is the effect of having a higher niceness value on a process's CPU time?

<p>The process receives less CPU time</p> Signup and view all the answers

Which command is used to change the priority of a running process in Linux?

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

What is the range of niceness values in UNIX for representing process priority?

<p>-20 to 19</p> Signup and view all the answers

What is the default behavior of the SIGHUP signal in UNIX?

<p>Stops executing processes</p> Signup and view all the answers

What is the purpose of the 'disown' command in UNIX?

<p>Detach a process from the current terminal</p> Signup and view all the answers

More Quizzes Like This

CS131 Week 5 and Week 6
22 questions
Unix
10 questions

Unix

ChivalrousClearQuartz avatar
ChivalrousClearQuartz
Use Quizgecko on...
Browser
Browser