Filtering IO/File
head
The head command in Linux is used to display the first few lines of a text file or the output of a command.
tail
The tail command in Linux is used to display the last few lines of a text file or the output of a command.
grep
The grep command in Linux is used to search for a specific pattern or regular expression in a file or a stream of data.
pipe
The pipe command in Linux can be used to chain together multiple commands to perform more complex operations on data. Here's an example of how to use the pipe command with the head and tail commands:
For example, let's say you have a file named data.txt
with 100 lines of text. You want to extract lines 21 to 30 from this file. You can do this using the following command:
find
The find
command in Linux is used to search for files and directories in a directory hierarchy based on various criteria, such as name, type, size, modification time, etc. It is a very powerful command that can perform complex searches.
more
The more
command in Linux is used to display the contents of a file one page at a time. It is often used to display large files or files that are too long to fit on a single screen.
less
The less
command in Linux is similar to the more
command, but it provides more advanced features and is generally considered a more powerful pager utility. Like more
, less
is used to display the contents of a file one page at a time.
cut
The cut
command in Linux is used to extract sections from each line of a file. It is particularly useful for extracting specific columns of data from a file.
sort
The sort
command in Linux is used to sort the contents of a file or the output of a command in alphabetical, numerical, or other specified order.
Last updated