Will creating a text file in vi change my computer?

Writing a text file isn't going to "change the way that your computer functions".

In particular, in order to do something like that, you'd have to do one of

  • overwrite some important file
  • write your file to a special protected location like a *.d directory in /etc; you won't have permission to do this
  • mark the file executable and put it in your path

Since you're not going to explicitly be doing anything like this, there is nothing to be worried about. In particular, the other answer goes to unnecessary lengths by suggesting your text files need to begin with hashes on every line. Of course they don't. Just storing a text file somewhere within a normal home directory is not going to do anything.


You can save all the commands you have learned in a file but some important points to note:

  • Don't make the file executable
  • Never source the file
  • The best way would be to put a # in the beginning of all the commands to comment out all the commands so they don't get executed accidentally. This way you can actually search for the command you need and also would be risk free. You can add # at the start of each line by the following command:

    sed -i 's/^/#/' <file_name>

EDIT: I have given the third point as an extreme security measure, as "neon_overload" and "David Z" pointed out that putting hashes in all the lines is too extensive and hence not needed, i would second with them in this context. Also as pointed out by "random832", a far better alternative to my third point would be to start the file with exit, as no later commands will be executed then.

EDIT-2: "Rinzwind" has mentioned two important points:

  • Do not overwrite an existing file

  • Store the file in the user's home directory (/home/$USER/).


neon_overload has a very good answer.

I'll expand a bit on a certain facet of your question - I would make this a comment, but I don't have enough reputation on here.

Linux, as an operating system, is very much NOT based on text-files. That said, I can kind of see where you are coming from. To an outside observer, there is a fair bit of going on with editing and launching "text" files, especially compared to Windows.

This has several reasons, some of which are:

  • There is no registry system in Linux, like is in Windows. Therefore, it is common for applications to store their settings in textfiles, and you would be instructed to edit them, rather than edit registry like in Windows.
  • Linux is very widely used as a server system, and many of those, who use it on desktops do work with server systems. Unlike Windows Server, Linux servers usually run without a graphical interface. Therefore, products that are expected to run on Linux servers, and, indeed, their users and administrators, are expected to work without a graphical interface. Products (and system features, worth saying) that are only expected to run on Windows are usually more GUI centered (like, say MS SQL)
  • Linux scripting system is somewhat more common and more transparent than Windows. You would see scripts on Windows - but they would be called something.vbs or another.bat. You wouldn't neccesarily realize they are text files - but, considering what is in my second point, it is much more common in Linux to go snooping around .sh files.
  • Lastly, many users of Linux are accustomed to working without graphical interface, and will, for many things, rather edit the files directly as they would without GUI, rather than fumbling around with graphical tools. I know that when I want to do something deeper in the system, I just start the terminal, and so do many of my colleagues.

The short answer is, no, you won't change your computer by creating a text file in vi. However, if you aren't careful, creating that first text file just might change your life. Learning the Unix way can be a deeply rewarding practice.