Question
1. Use the man command to view documentation of the more command. Find out what the option -d does. Use this option with the more
1. Use the man command to view documentation of the more command. Find out what the option -d does. Use this option
with the more command to view the rgb.txt file.
2. Use the type command to find out if the following commands are shell builtins: type, less, export, ls, bash, man.
4. On the command line, type cat > lab3-4 and return to quickly create a new text file. Enter your name and major as the file
content. Use Ctrl+d to end editing. Then use the cat command again to append some of your skills to (note NOT to replace)
the lab3-4 file. Check your file to make sure you do not overwrite the original content
5. When you use the redirect output symbol (>) with a command, the shell creates the output file even the command fails.
Demonstrate that. Hint: how to generate a failed command (i.e. a command that produces an error message)?
6. Perform the following tasks. Effectively use channel rerouting, pipe operator and filter commands
a) Given any directory, find out all directories in it (including the hidden ones, or not).
b) Given any directory, find out the number of all files (including directories, and all hidden items) in it
c) Given any directory, find out the number of all hidden items (files and directories) in it
e) Find out the first 20 commands executed and recorded in history.
f) Find all commands in command history that starting with ls, and save the result to a file. (This will be a bit challenging.)
7. Try the following and see what happens. Explains the behavior.
a) echo ".""."
b) echo "hello world"
c) echo hello world
d) echo "hello!1"; (how to display the text as is?)
8. Assume you have made the following variable assignment: person=zach
How can you produce the following outputs on the screen?
a) zach
b) $person
a) "$person"
9. Set var1 to the value as shown in the right figure. Whats
the difference between the following two statements?
How many arguments does each echo command see?
echo "$var1"
echo $var1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started