Answer:
To change a directory- cd dir1 ( this command is used to change a directory in unix)
2- With pipelines- head -5 hello1.txt | tail -3 (this command will extract lines from 3rd to 5th)
head -5 hello1.txt (this command will display starting 5lines of a file.)
tail -3 hello1.txt (this command will display last 3lines of a file.)
With redirection-
head -5 hello1.txt >sample.txt (this command will redirect lines in sample.txt file)
Tail -1 hello1.txt >sample.txt
3- cp my.txt hello2.txt (this command will create a redundant file of my.txt)
sed 3d hello2.txt (this command will delete 3rd line of a file)
sed ‘/is/d’ hello2.txt (this command will delete occurrence of is in a file)
sed ‘/^$/D’ hello2.txt (this command will display non-blank lines of a file.)
4- To delete a file type command - rm hello2.txt (after enter press it will prompt type 'Y' to remove or type 'N' not remove.
This is my file content. head and tail commands used separately.
head and tail command used with pipeline
head and tail commands used with redirection.
sed command to delete a specific line.
Post-Lab 2: GNU and UNIX commands Keywords: • Sort • head tail • Pipe (D •...
LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check the output) Display the command(s) used to do the following: create an empty file called history by using just a redirection operator. Verify and show. Show/verify all results (i.e., all commands and their corresponding outputs). Wait 1 minute or more and then display the command(s) used to do the following: change the timestamp on the history file you just created. Verify/display the change. Show/verify...