Medha Cloud Logo

How to Print File Content to the Screen in CentOS?

In this post, we will see how to How to print file content to the screen using terminal commands in CentOS. CentOS is a Community Enterprise operating system which mainly focuses on the server. It is a part of Linux Operating System Distribution, and it is free to use. First, open the terminal

Total Time Needed: 30 Minutes

Required Tools:

CentOS

Steps to print file content to the screen in CentOS

Step 1 :To Print Contents of a File
Use the command cat . For example, to print contents of the file password which is in, etc. type the command cat /etc/passwd and press enter. You can see that the contents of the file are printed.

Step 2 : To Create a File
To create a new file use the command cat > file name and press enter. Now enter the content of the file , type ^C, and press enter again. For example, to create a file named tork.txt, type
cat > tork.txt, and press enter. Now type the content, type ^C, and press enter.

Step 3: To Check if the File is Created
Type the command cat tork.txt and press enters you can see the contents of the created file.

Step 4 : Rename Files:
To rename file, use the command cat old_name > new_name. For example, To change
the password to passwd.txt type the command cat /etc/passwd > passwd.txt and press enter.

Step 5: Check if the File is Renamed
Use the command ls to check if the file is renamed. Type ls and click enter to see that file name Is changed to passwd.txt

Conclusion:
To print file the content to the screen in CentOS please follow these steps. If you need any help please contact Medha Hosting.
Read Here: How To Move Files And Directories In CentOS?

Connect with Medha Cloud

Microsoft 365 Migration Form

I would like to send my contact information to MedhaCloud so that MedhaCloud can share additional information about products, services, thought leadership and invitations to flagship events with me by email. *

By submitting this form, I acknowledge that someone from MedhaCloud will contact me via email or phone to discuss my request.

Related Article

View All
chevron-down linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram