For Linux, everything is considered a file, including regular
files, directories and hardware devices. In this question, you are
asked to carry out some practical activities to manipulate files
using Linux. Include either screenshots or output from the command
line to document your answers.
a.Outline how you would approach working out how to achieve a
task through the command line when you don’t know the appropriate
commands.
(4 marks)
b.Use a command to print the current date. Control the format so
that on New Year’s Day the date would be displayed as 01 Jan
2022.
(4 marks)
c.Create a script mydate.sh containing your command
from part (b). Display your script file in the command-line
interface and demonstrate its output.
(4 marks)
d.The file input.txt is provided with this assignment.
Use a command to find how many lines of text and how many words it
contains.
(2 marks)
e.Describe what this command does:
tr <input.txt "[:punct:]" " " | tr "[:space:]" "\n"
>temp.txt
(6 marks)
f.Use the file temp.txt you created in the previous
step. Using the command line, sort this, remove duplicate lines,
and save the result in output.txt. Can you describe what this file
now contains?
(8 marks)
g.How many words does it contain? And what does this tell
you?
(2 marks)
For Linux, everything is considered a file, including regular files, directories and hardware devices. In this question,
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am