---
# System prepended metadata

title: LF - Exercises 3

---

# LF - Exercises 3

##### 1. Explain the tar option to compress created tarballs, so you use only one command to do the packaging and compressing.

You must use the following options to package and compress: `c` to create, `z` to compress, aditional you can use `v` to see what is happening in a detailed way about the process, do not forget to use `f` to especify the file name.

Example: `tar -cvzf groupFiles.tar.gz file1 file2 file3`

##### 2. It is possible to gzip a group of ﬁles? How?

gzip by itself does not know anything about file structure. To do what you want, you need to first put the files into some kind of container file.

![](https://i.imgur.com/rshcpLW.png)

##### 3. Write a grep command to print the number of occurrences of pattern in ﬁle.

![](https://i.imgur.com/epNy57J.png)

##### 4. Write a grep command to print line numbers of occurrences of pattern in ﬁle.

![](https://i.imgur.com/vzw7zB0.png)

##### 5. vim - How would you cut and paste n lines?