• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About Us
    • About CSEStack:
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • Campus Ambassador
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • C/C++
    • Python
    • Java
    • HTML CSS
    • SQL
  • CSE Subject
    • Compiler Design
    • Computer Network
    • COA
    • Data Structure
    • DBMS
    • Operating System
    • Theory of Automata
    • Web Technology
  • Linux
  • Trend
    • Artificial Intelligence (AI)
    • Big Data
    • Cloud Computing
    • Machine Learning (ML)
  • GATE CSE 2020
    • Self Study Plan
    • Complete Syllabus
    • FREE Test Series
    • Topper Interview (AIR 15)
    • Recommended Books by Topper
  • Career
    • Placement Interview
    • Jobs
    • Aptitude
    • Quiz
  • Material
    • Recommended Books
    • Software Installation
  • Contribute to Us
    • Write for Us
    • Submit Source Code or Program
    • Share Interview Experience
  • Tools

6 Commands to Edit File even if there is no vi, vim on Your Linux

Aniruddha Chaudhari/09 May, 17/29439/2
Misc

Many times you have to create a file, write the content on your Unix-line or Linux systems. Sometimes you require to write a program and run it. For all this, you need a text editor to read and write in the file.

So let’s see one by one different command for creating and editing the files even if you don’t have vi or vim editor.

File handling using vi and vim editor:

The vi and vim are two widely used command line editors on the Unix-like systems (including Linux). And many of the users know about vi and vim editor.

Following are the simple commands you can use to create the file and edit it.

#1 Using vi editor

vi fileName

There are two modes of opening file in vi editors. One is command mode and other is insert mode. As it’s not the part of this discussion. And it’s a big topic to discuss in full fledge. We will describe it in the upcmoming article.

#2 Using vim editor

vim fileName

What if you don’t have vi or vim editor installed on your system?

Here are some commands to edit file if there is no vi, vim…

You can use cat or touch command.

#3 Using cat as text editor

Using cat command to create file

cat  fileName

Write the content and once it is done press ctrl+D.

It will save the contents to the file.

Note: Every time when you run this command, it will erase all the contents and write newly entered content. So, be careful if you have any important data in your file.

#4 Using touch command

You can also create the file using touch command.

touch fileName

#5 using ssh and scp commands

If you are working on the Linux server, you can see there are limited packages installed on the server. There may be a restriction of using resources and so installed packages.

If none of the commands work, follow the steps give bellow.

  • Login into Linux server using ssh command.
  • Download the file on the local machine from server.
  • Update the file on the local machine.
  • Copy the file back to the server. You can use scp command (Secure Copy Paste command) to copy a file from local machine to the server.

#6 Using other Programming Language

If you have scripting or any other programming language installed on your system, you can use that to create and edit the file. For example…

  • Create and edit a file in C
  • File handling using Python

It is pretty easy to edit the file using vi and vim editor. But sometimes you may need to edit the file without vi and vim editor. Hope these commands will help you to edit file if there is no vi, vim.

If you have any doubt or if you have any another alternative to vi and vim to edit the file, feel free to write in a comment below.

linuxlinux cmd

Related Posts

Linux

Step-by-Step Commands to Write Your First Vim Function Example | Rules | Uses

Linux

Vim Case-Insensitive Search in Linux [Step-By-Step Commands]

Linux

7 Linux Hostname Commands with Example | You should Know

Aniruddha Chaudhari
I am complete Python Nut, love Linux and vim as an editor. I hold Master of Computer Science from NIT Trichy. I dabble in C/C++, Java too. I keep sharing my coding knowledge and my own experience on CSEstack Portal.

Comments

  • Reply
    Marwal D
    April 13, 2018 at 12:19 pm

    If you are working in networking domain, you need lots of such commands to master Linux and networking.

    Thanks for such a nice overview of these basics. I would like to read more of such, Thanks!

    • Reply
      Aniruddha Chaudhari
      April 13, 2018 at 1:52 pm

      You are right, Marwal!

      Thanks for your kind words.

      I will keep adding more of these commands in future. Stay tuned…

Leave a Reply Cancel reply

Interview Experiences

AccentureAgriChain Akamai Amazon Amdocs American Express Attra Infotech BARC Barclays BlockGrain BYJUS Cisco Cognizant Coupon Dunia Credit Suisse DE Shaw Druva Experis IT Eze Software Factset Fiorano General Electric Incture Technologies Infosys Kasmo Cloud Microsoft MindTree Mu Sigma Numerify Opteamix Oracle Persistent Pole to Win Qualcomm Reliance Riverbed Syntel TCS Tech Mahindra Teradata Terralogic Virtusa Wipro

Interview Questions



You can share your interview experience.

Don’t Miss !

Latest Articles

Cisco Online Test Pattern and Interview Questions for Freshers


[7 Best Tips] How to Make Daily Study Timetable and Stick to It?


Persistent Written Test and Technical Coding Questions [Paper Pattern]


10 Top Website Design Tips for Small Business to Boost Up Your Sales


Main Difference Between remove del and pop in Python List


Tech Mahindra Placement (Online Test | Essay Writing | Interview Questions)


Importance of Career Exploration for High-School Students | Why?


Favorite Topic

AI algorithm array bigdata bit manipulation career Code Computer Network cpp data analytics database data scientist Data Structure db DBMS difference between Django education GATE GATE Topper Interview HTML ibm IBM ISDL interview IP address Java JavaScript Jobs Linked List linux linux cmd nit OOPs Concept os Programming Python python list Qualcomm SOAP sorting stack string vim webbrowser web development

Contribution to Community

  • Contribute to CSEstack Portal
  • Submit Your Source Code or Program
  • Share Your Interview Experience
  • CSEStack Leadership Board
  • Campus Ambassador Program by CSEstack

About CSEstack Portal

  • About CSEStack:
  • Contact Us
  • CSEStack Campus Ambassador
  • Recommended Books by Expert

© 2019 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About Us
    • About CSEStack:
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • Campus Ambassador
  • LeaderBoard