Mastering Linux Command Line File Manipulation

RefinedBowenite avatar
RefinedBowenite
·
·
Download

Start Quiz

Study Flashcards

49 Questions

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?

a-c

What is the purpose of using quotes in shell scripting?

To access variable values inside the quotes

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

a) s

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

b) d

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

expr

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

c) a

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

To get the shell process ID

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

d) i

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

kill -9 pid

What does the SIGHUP signal indicate?

The disconnection of a user's terminal

What does the 'disown' command do?

Detaches a process from the current terminal

What is the default behavior for the SIGHUP signal?

Stop executing processes

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

$ tmux new-window

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

All of the above

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

To save and restore tmux sessions

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

read

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

To evaluate arithmetic expressions

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

To resume a suspended job and run it in the background

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

To measure the execution time of a command

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

jobs

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

To control the priority of a process

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

0

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

The process will receive less CPU time

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

sed '/^$/d' file.txt

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

Prints lines that start with 'apple' in the file.txt

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

Prints the second column of a space-separated file

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

Suppresses auto-display of pattern space

Which command is used to start a new tmux session?

$ tmux new-session

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

$ tmux kill-session -t

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

$ tmux new-window

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

read

What is the purpose of using quotes in shell scripting?

To enclose strings that contain special characters

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

Searches for a pattern in a file

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

Resumes a suspended job and runs it in the background

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

sed '/pattern/d' file.txt

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

sed '/pattern/a\ ext' file.txt

What is the purpose of using quotes in shell scripting?

To group multiple commands together

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

Matches lines that start with 'apple'

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

jobs

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

To control the priority of a process

What does the SIGHUP signal indicate?

The disconnection of a user's terminal

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

The process receives less CPU time

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

renice

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

-20 to 19

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

Stops executing processes

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

Detach a process from the current terminal

Test your knowledge of Linux command line file manipulation with this quiz! Learn about using the 'ls' command to list files, exceptions to matching patterns, character classes, reversing matching, and using multiple patterns.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

CS131 Week 5 and Week 6
22 questions
Unix
10 questions

Unix

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