e.g.
If we run this command
ls /usr/bin


ls /usr/bin | less


Now to scroll the display one line at a time we can press Enter key. If we want to move forward one page, we can use the Space bar key and move backward one page by pressing b key. At the end of the file, we can press the q key to exit from the file.
Redirection (Input-Output Redirection)
By default, mostly all commands give output on the screen or take input from the keyboard. Linux however provides a way to send output to a file rather than sending on a computer screen similarly takes input from a file in place of the keyboard. this feature of sending the output to a file or getting input from a file is called redirection.
If we use a command
ls ./notes

ls ./notes > file.txt

After redirecting output we can display file.txt content on screen using cat command
E.g. cat file.txt

Types of redirection
- Output redirection ( > )
- Input redirection ( < )
Output Redirection
Using this redirection, we can send the output of Linux command to a file. If the file already exists then it will be overwritten and if does not exist then a new file is created with the given file name. If we do not want a file to be overwritten, then we should use >> operator instead of > operator.
![]() |
msg.txt |
E.g. cat msg.txt > msg2.txt

Above Linux command will send the output of cat msg.txt command to the file msg2.txt
Now we can check the redirected output using cat msg2.txt command.

Input Redirection
If we want to input from a file instead of the keyboard then we can use this type of redirection.
E.g. cat < msg.txt
E.g. cat < msg.txt
here, the contents of the file msg.txt will be used as input for command cat
UNIT-301
Network Operating System