Perform the following tasks in Linux
(i) Display the first 15 lines and last 20 lines of a text file (you need to create a text file)
(ii) Identify all files in your home directory which a group has written permission on it
(iii) What will be the output of the following commands:
- ls | head – 5 | tail -1 > myfile cat myfile
- ls –l / etc | tail – n + 2 | sort
(i) Display the first 15 lines and last 20 lines of a text file:
To create a text file and then display the first 15 lines and last 20 lines, you can follow these steps:
1. Open a terminal in Linux.
2. Create a text file, for example, "mytextfile.txt," and add some content to it. You can use a text editor like nano or vi, or simply use the `echo` command to add text.
```bash
echo "Line 1" > mytextfile.txt
echo "Line 2" >> mytextfile.txt
# Continue adding more lines as __________ _______ _____ ________ __________ _________.
____ ___ __________ __________ ____ ____.
_____ ________ _____ _______ _________.
______ ________ _____ __________ ______ ____.
___ ______ __________ ________ ________ _______ ________ ___ __________ ________.
___ _________ _________ _________ ______.
________ ___ ___ ___ ____.
__________ _____ ________ ____ ___ ___ ____ ____ _______ ________ ____ ___.
______ ______ ______ ____ ____ __________.
___ ___ ______ ________ _______ ___ ____.
____ ____ ___ ___ _______ _________.
___ ______ ________ _________ ______ _____ ________ _______ ______ ___ ____.
________ ________ ____ ________ ________ _________ ________ _______.
______ _______ ________ ____ _______.
___ ___ ______ ____ _________ ________ ____ __________ _________ ________ ____.
____ _________ _____ _________ ______ ______ ___ _____.
_____ ____ ____ ________ ___.
_______ ___ ________ _______ ______ ______.
_____ _________ __________ ____ _______ __________ __________.
_____ _______ __________ __________ ______ _______ _____ _____.
_____ ________ ____ _______ _______ ________ _______ ______.
_______ ________ ______ ___ __________.
________ ________ _____ ________ ______ ________ _____ _______ _____ _________.
____ _____ ______ __________ ___ ____ _____ ________ _____.
__________ ___ _________ ________ ________ _______ ____ _________ __________.
_____ ______ __________ __________ __________ _______ ______ ___.
_______ _______ _______ ______ __________ _______ _____ ______ ________ __________ ___.
____ _______ __________ ________ ___ ______ ________ __________ __________.
_______ ________ ____ _____ __________ _____ _______ ________ _________ ___ ______.
___ _______ __________ ______ ______.
_______ ___ _________ ___ ____ ____ ______ ____ ______.
___ ___ ________ __________ ________ _________ __________ _______ __________.
________ ______ _______ _______ ___ _______ ___ ___.
___ ______ _______ ___ ____ ________ ___ __________ ___ ___ __________.
_____ ______ _________ _________ ______ ________ __________ _____ _______ __________.
_________ _________ _______ _______ ___ _____ _______ ____ ____ ____ __________.
________ _________ _________ _____ ____ ___.
________ ____ ___.
Get Full Answer on WhatsApp