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.
- [Fix] Linux - bash: useradd: command not found
- Calculate days between dates using dateutils ddiff command
- pwd Command - Print Working Directory
- Rename a directory using Linux/Unix command
- How to go to the End of File in Nano Editor
- How to tar.gz a directory or folder Command
- How to remove/delete a directory in Linux/macOs
- How to Display content of a file in Terminal Screen?
- ls command sort by file size [Linix/UNIX/macOS/bash]
- How to Copy Entire Directory to another Directory in Linux
- 3 ways to clear screen on Linux Terminal
- Command to check Last Login or Reboot History of Users and TTYs
- How to check uptime of Linux/Unix/macOS system/server using console command?
- How to backup a file in Linux/Unix
- Command to know the installed Debian version?
- Check SSH/OpenSSH version Command
- 3 Commands to stop Nginx Server
- Linux: Create a New User and Password and Login Example
- How to install npm on Ubuntu
- How to List All Users in Linux
- How to Get the List of Shells on Linux
- Fix - ssh-copy-id no identities found error
- Installing and using unzip Command to unzip a zip file using Terminal
- scp: ssh: connect to host xxxx port 22: Connection refused Error
- zsh hello world example
- Docker - Error response from daemon: You cannot remove a running container - Docker
- How to disable Microsoft teams from startup Windows 10 - Teams
- How to turn off Stage Manager - macOS Ventura - MacOS
- Clear Screen shortcut macOS Terminal - MacOS
- macOS: Change Weather App Temperature unit from Fahrenheit to Degree - MacOS
- Java: The value of the local variable string is not used - Java
- [Error] There was an error connecting to the apple id server - HowTos