SIVA 99

Filter Commands in Linux

A filter is a program that takes plain text (stored in a file or generated by another program) as standard input, converts it to a meaningful format, and then returns it as standard output. Linux has several filters.

Head Command :

By default, it prints the first 10 lines If we need to print the more lines, then we need to specify the number of lines help of “-n” keyword.

Tail Command :

By default, it prints the last 10 lines If we need to print the more lines, then we need to specify the number of lines help of “-n” keyword.

Less Command :

Less command is a Linux utility that can be used to read the contents of a text file one page(one screen) at a time. It has faster access because if file is large it doesn’t access the complete file, but accesses it page by page.

Note : using "q" exit from file.

More Command :

the more command displays the first section of the file. By pressing the “ENTER” key, you can scroll line by line, all the way to the bottom of the file.

Sort Command :

SORT command in Linux is used to arrange the data in a specific order according to the option used. It helps in sorting the data in the file line by line.

Grep Command :

Grep command in Linux is the short form of ‘global search for the regular expression’.
The grep command is a filter that is used to search for lines matching a specified pattern and print the matching lines to standard output.

The grep command supports a number of options for additional controls on the matching:

Locate Command :

The locate command finds files in Linux using the file name. locate is used for obtaining instantaneous results, and it is an essential utility when speed is a priority.

Find Command :

The find command is a powerful utility to search for files or directories.
The search can be based on different criteria, and the matching files can be run through defined actions. This command recursively descends the file hierarchy for each specified pathname.

Liked This Article?

Conclusion

I’m sure that this tutorial would have helped you to get a good understanding of what is Filter Commands

Leave a Reply

Your email address will not be published. Required fields are marked *