QueHow

A How-To and wiki Blog

  • Operating System
    • Windows
      • Windows 10
      • Windows 7
    • Linux
  • Software
    • Application Software
    • Microsoft Office
      • Outlook
      • Word
      • PowerPoint
  • Internet
    • Browsers
      • Mozilla Firefox
      • Google Chrome
    • CMS
    • Tips & Tricks
  • Website
    • ecommerce
    • Google
    • Social Networking
    • General Websites
  • Mobile
  • Email
    • Gmail
  • Wiki

How to Create a Text File using Command Line in Ubuntu 14.04 ( 2 Methods)

By Neha T 1 Comment

Do you want to create a text file using command line?. Yes, you can simply create a text file by using some easy codes as shown in the steps below.

Here, we described two methods to do so. Just have a glance at this article in order to find out how to create a text file using command line in Ubuntu 14.04.

Steps to create a text file using command line interface:

Method 1 of 2: Using cat command

Step 1: First, go to the Unity dash and type ”Terminal’‘. You’ll see a terminal icon, just click on it to open.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

 

Step 2: Under ‘Terminal’, type: “cat > your filename.txt” and then press enter, for eg. “cat > test.txt”. The “cat” command is used to create a file. Here, you can enter your text and after that press “Ctrl + D” to exit and return to the command prompt.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

Step 3: Now, type; “ls-l your filename.txt” and press enter, where ‘ls’ command displays the list of files. It displays file creation time and date as well as the file directory.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

 

Step 4: The “cat” command is also used to view the contents of the file. Type: “cat your filename.txt” and press enter, for eg. “cat test.txt”.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

 

Method 2 of 2: Using touch command

Step 1: Under terminal, type: “touch your filename“ and press enter. The touch command creates an empty text file, that is why if you would use the ‘cat’ command then you’ll not get any output. So, in this scenario you must use some text editor to add your text.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

 

Step 2: Type: “vi your filename“ and press enter, here “vi” stands for the text editor.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

Step 3: Type your text in the “vi editor” and press “:q” to exit and return to the command prompt.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04

 

Step 4: Now, you can use “cat command” to see your text file.

How-to-Create-a-Text-File-using-Command-Line-in-Ubuntu-14.04
That’s all friends, Keep reading.

You Might Also Like:

How to create a zip file using terminal in Ubuntu 14.04 How to convert pdf file to text file in Ubuntu 14.04 How to use ‘tar’ command to create archives in Ubuntu 14.04 how-to-use-sed-command-in-ubuntuHow to Use SED Command in Ubuntu How to batch convert text documents in Ubuntu 14.04 How to use VIM Editor in Ubuntu? How to Install VIM editor in Ubuntu ? How to Display your Password while using Terminal in Ubuntu 14.04

Comments

  1. krishna says

    February 10, 2016 at 10:52 am

    Thank you very useful information

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Viewed

  • How to Install and Use TELNET in Ubuntu
  • How to install Hindi fonts in MS Word
  • How to Change a File Extension in Windows 10?
  • How to create a flipkart account in 3 simple steps
  • How to Change Monitor Refresh Rate in Windows 10?
  • How to install IIS on Windows 10
  • How to Insert Clickable Checkbox in MS Word 2016?
  • How to Set Auto Reply in Outlook 2016?
  • How to Login as Administrator in Windows 10?
  • How to Check RAM Size and System Type in Windows 10?

Recent Additions

  • How to Add Hyperlink to Another Sheet in Excel?
  • How to Add and Remove Watermark in Excel
  • How to use Relative and Absolute Cell Reference in Excel?
  • How to Enable and Disable Scroll Lock in Excel?
  • How to Use INDEX and MATCH Functions in Excel?
  • How to Make Bar Graph in Excel?
  • How to Count Duplicate Values in Excel?
  • How to Wrap Text in Excel?
  • How to Round off Numbers in Excel?
  • How to Create a Bell Curve in Excel?

Related Searches

  • How to Install VMware Workstation in Windows 7 ?
  • How to Archive Emails or Folders in Outlook 2007
  • How to extract images from pdf file in Ubuntu 14.04
  • How Create a Pie Chart in Excel?
  • How to convert web page to PDF file

Copyright © 2023 · QueHow · Contact Us