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
- How to turn off AirPods Nearyby notifications on macOS Big Sur? - Apple
- Fix: Jupyter Notebook: The port 8888 is already in use, trying another port. - Python
- Update Created By (Author) column of SharePoint document using PowerShell - SharePoint
- How to record PowerPoint slide show presentation on Mac - narration, slide timings, ink gestures - Microsoft
- Python: How to install YAML Package - Python
- How to Get or Set SharePoint Document ID _dlc_DocId using PowerShell - SharePoint
- TextEdit Get the count of lines in a file - MacOS
- Most Essencial AWS CLI 2 S3 ls Command Options - AWS