7 Linux Tips for Displaying Contents of File in Linux
Tamizh Tech Tutorial
7 Linux Tips for Showing File Contents in Unix / Linux
Linux Tips
Here you can find several tips for displaying file contents in unix / linux terminal with examples. They are
- Using cat command
- Using head command
- Using tail command
- Using more command
- Using less command
- Using nl command
- Using nano command (pico command)
1. Using cat Command
- This command will take a file as an input and display it on the standard output which is the terminal output.
Syntax
cat filename
Example
2. Using head Command
- This command will take a file as an input and display the top ten lines by default on the terminal.
Syntax
head filename
Example
3. Using tail Command
- This command will take a file as an input and display the bottom ten lines by default on the terminal.
Syntax
tail filename
Example
4. Using more Command
- This command will take a file as an input and display the file contents in pager form, displaying one screen at a time in case the file is too large.
Syntax
more filename
Example
5. Using less Command
- This command will take a file as an input and display the file contents in pager form
- To exit, press q symbol from keyboard.
Syntax
less filename
Example
6. Using nl Command
- This command will take a file as an input and display the file contents with line numbers
Syntax
nl filename
Example
7. Using nano Command (Nano Editor)
- This is actually editor used in linux terminal
- This command will take a file as an input and display the file contents in its terminal window.
- To exit from this editor, press CTRL + X key.
Syntax
nano filename
Example
Tamizh Tech Tutorial
Video Demo
Comments
Post a Comment