If you want to see content of a file in Terminal make use of the cat command,
Syntax: cat [file...]
Example:$ cat myfile.txt
This is my text file.
This file has multiple lines.
You can also use this command to concatenate and display content of multiple files as well,
Example:$ cat myfile.txt myfile1.txt
This is my text file.
This file has multiple lines.
This is file 2
βοΈNote that when you cat multiple files at a time the content are displayed as read-only and no files are written!
If you file is not at the current location, you can also provide absolute path as well,
$ cat /Users/c2c/Desktop/myfile.txt
This is my text file.
This file has multiple lines.
Display content of a huge file with more and less option
If you want to display the content of a file that has many lines, the whole content of the file is printed on the screen and many not be able to see all the data as the scroll will be enabled and you will end up at the bottom of the screen, in such case you can make you of more or less command,
Example:$ cat myfile.txt | more
This is my text file.
This file has multiple lines.
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
:
You can press spacebar to get more data displayed in screen (next batch) or q to quit and come back to the prompt.
- Command to know the Available Memory on Linux System
- How to install curl on Alpine Linux
- How to backup a file in Linux/Unix
- Install Java Runtime Environment (Oracle or open JRE) on Ubuntu
- What is the Default Admin user and Password for Jenkins
- How to tar.gz a directory or folder Command
- Copy entire directory using Terminal Command [Linux, Mac, Bash]
- Fix: bash: ipconfig: command not found on Linux
- Command to check Last Login or Reboot History of Users and TTYs
- Linux: Create a New User and Password and Login Example
- ls command to list only directories
- bash: cls: command not found
- How to exit from nano command
- Installing and using unzip Command to unzip a zip file using Terminal
- What does apt-get update command does?
- ls command: sort files by name alphabetically A-Z or Z-A [Linux/Unix/macOS/Bash]
- How to remove or uninstall Java from Ubuntu using apt-get
- scp: ssh: connect to host xxxx port 22: Connection refused Error
- Sort ls command by last modified date and time
- Create Nested Directories using mkdir Command
- How to Exit a File in Terminal (Bash/Zsh)
- Command to know the installed Debian version?
- How to connect to SSH port other than default 22
- How to save a file in Nano Editor and Exit
- Install OpenSSL on Linux/Ubuntu
- Fix: ReferenceError: require is not defined in ES module scope [Node] - JavaScript
- Fix - JioCinema Something Went Wrong Please Try Again Error 8001 while streaming IPL Cricket Live - HowTos
- Call a Stored Procedure using Java JDBC CallableStatement Example - Java
- Generate Maven Project Dependency Tree using MVN Command - Java
- What Java version is used for Minecraft 1.18 - Java
- Google Colab: How to read file from Google Drive - Google
- Shortcuts: How to Toggle Word Wrap in Visual Studio Code (VS Code) - Shortcuts
- How to Whitelist IP Address on GoDaddy Hosting? - HowTos