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.
![[root@localhost ~]# ls dos hello. c hello1.txt [root@localhost.~]# cat hello1.txt unix is an operating system. it is very eas](http://img.homeworklib.com/questions/0de34620-a0e7-11ea-ab38-155cef0cf5de.png?x-oss-process=image/resize,w_560)
head and tail command used with pipeline![rootalocalhost 15 dirldos hello.c hello1.txt [root@localhost ~]# cat hello1.txt unix is an operating system. it is very easy](http://img.homeworklib.com/questions/0ebc9660-a0e7-11ea-b9e9-370a81506cc6.png?x-oss-process=image/resize,w_560)
head and tail commands used with redirection.![[root@localhost ms] # root@localhost # head -5 hell01.txt tail -3 Rinux is also an operating system. it is open source. it is](http://img.homeworklib.com/questions/0fafb4c0-a0e7-11ea-b5d3-bf3b4889a50b.png?x-oss-process=image/resize,w_560)
sed command to delete a specific line.
![Susah ww [root@localhost ~]# sed d hell01.txt unix is an operating s it is very easy to learn. it is open source. it is very](http://img.homeworklib.com/questions/1081fcf0-a0e7-11ea-aec3-496a3a72a6f9.png?x-oss-process=image/resize,w_560)
Post-Lab 2: GNU and UNIX commands Keywords: • Sort • head tail • Pipe (D •...
Question 2 0/1 point (graded) What happens when you remove a directory using the command rm -r? You cannot remove a directory using the rm command. You permanently remove the entire directory, including all files and subdirectories. You move the entire directory to a trash folder, but it can be restored later. You get a warning message asking if you want to proceed, then you delete the directory. incorrect Answer Incorrect: Try again. Unix does not warn you before permanently...
The purpose of this lab assignment is to practice searching in Unix and using regular expressions. Task A: Use the find command to find all directories under /pub/cs/ whose name is cs160a. Be sure to only display the results that match, do not display any error output. Hint: use: 2>/dev/null. Task B: Create a one-line command, using he famous.dat file, to add the word " STREET" to the address, for all who live on 2nd or 3rd. For example: '2nd'...
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...