Saltar al contenido
Contact : alejandrasalcedo0288@gmail.com

How to create a file in Linux

Cover page How to create a file in Linux

Today we are going to take some of our time to be able to express to our users how they can get to create a file in Linux, however we want to start the article by talking a little about what the Linux system is, because this system He has gained a lot of fame today.

Therefore, Linux or also called as Gnu / Linux (This being its initial and true name), is considered as a type of Unix, multitasking, multiplatform and even multi-user free operating system; which turns out to be a combination of different types of projects highlighting the Linux and GNU kernel

However, many experts have considered that the development of Linux represents one of the clear examples of the most prominent free software in our days, where all your source code may be modified, used and also freely redistributed by any user having a license

Create file in Linux

Linux file 1.The best thing about this operating system is so simple, is that anyone can use it without being an expert.

You can say that all distribution from Linux has been initially designed to make this be managed through a console or even through a command line, because it becomes very practical to know several ways to manage any task in it

Likewise, one of the great tasks of the Linux operating system will consist of be able to carry out different types of text files that have a type of information that becomes useful and the best options to accomplish this task through the Cat command.

Steps to follow for a user to create a file on their PC with Linux operating system using the Cat command

Thanks to the method that will be used next, the user will have the great possibility of create text files with that command, this being much more practical than you want to add and immediately add text to the new file that is made.

  1. The first step to be performed by a user will be to enter the command of their terminal Cat Txt File.
  2. Then, you have to press on the key Enter so you will not return to the indicator of the distribution terminal that the user has already selected, so the cursor will be located on the next line and there it will be possible to start with the entry of the text that is directly in the File.
  3. When the following steps have been completed, the user from there will have to enter the lines of the text that he wishes to add by pressing on Enter after each line; next, you have to press on the combination of the keys Ctrl + D so you can exit the file.

This will also return to the message already created. In order for users to know how to verify that their file has been created, they will have to use the command Ls to be able to display a directory list for your file Ls l Txt File.

  1. The user will notice some details such as: the date and time of the creation of the file and each of the assigned permissions.

Thanks to this great command Cat can also be very useful to observe the content of the file already made and for that you only have to execute the following command of Cat Txt File.

Create file in Linux touch

Linux touch fileIf you want to create a file in Linux quickly, maybe the “touch” command can help you.

We have reached the part of the article where the Touch command is going to be used, because this can allow its users to create a new file that does not contain data.

Likewise, in case the file specified after the command of said Touch command already exists in the system, any data that it contains it will not be modified, however the access time and modifications of the files will be changed.

However, one of the great advantages of this great and useful command for users to create a large number of file numbers at the same time is that it can also be used for users manage to update all access time with the objective of attending any automatic backup process.

Next, a series of steps will be demonstrated so that users can use the Touch command.

Short steps to use the Touch command

  1. In the first step the user has to write the command Touch Newfile Txt on the command line of the operating system terminal so that the user can create a new type of empty file known as Newfile Txt

In case the user does not want his file to be created in the system startup directory, he will have to provide an exact path for the selected file.

  1. Then, you must type the command Ls- The to verify that the file has already been created, and in turn you have to write the word of Exit so that with that you can close session of the terminal.

Create empty file in Linux

Empty linux fileTo create a file in Linux you don't need to be full of information, in fact, you can create a file even without any internal component.

There is a great possibility that users will get to ask the question of Cul could become the real objective of creating a file that is empty in Linux? Well, the answer is very simple, because these empty files in this operating system facilitate all practice of manipulation tasks.

So, when facilitating this practice, the manipulation of the different files will avoid any kind of delay where you even have to enter or access any type of content in the same empty files.

Also, thanks to the Touch command you will create a type of empty file known as File 1, which will be located within the user's directory; and for that you have to write Touch Personal / File 1.

In case the user wishes insert a content, you should know this:

  1. To be able to add a text string on the file that has already been created, you have to use the command called as Threw out, then use the same chain and redirection operator that is seen as a kind of a arrow pointing to the part of the file.
  2. This is going to be seen as Threw out (Personal / file 1), this being a very valid option to be able to initially create a file that has that already specified chain.
  3. In addition, for all types of users to add content to their file called File 1, this will also be able to use the command of Threw out, only this time the operator will have to be used Append which is reflected as a double arrow pointing to the right

Create file in Linux Ubuntu

Linux ubuntu fileUbuntu has such good compatibility with Linux, that creating a file on that computer is extremely simple.

We have reached the moment in which it can be expressed that having to create all kinds of files and directories on the Linux system, can be considered as one of the most successful and appropriate steps to start with all that learning so useful that they reflect the command lines.

Therefore, a series of steps will be demonstrated below for users to achieve make your own Linux files in Ubuntu:

  1. As a first step, the terminal has to be opened, and for that the user must click on the Men Looking for the Terminal app that can be seen as a type of black box with symbols inside it.

Usually this is in a bar that is located on the left side of the window. Men.

  1. Finally, you just have to make another click on the search bar located above the top of the window called Men and so you have to write the word of Terminal to find this application that allows you to create the files, and voila.

Create file in Linux command

Linux file 5.To create your Linux file, it is highly recommended that you use the operating system terminal.

For a user to create some files in the Linux operating system, it will be able to use the following commands:

Command Vi

The part of this great command will help the user to achieve this. select your entire text editor Vim as a type of program to use, where you will have to replace the name of the file with another one that you want to add to the new file made.

In this part it should be remembered that the user has to add to the name the letters of Txt.

Then, you have to press on the key Enter so that the file is created and thus opened in the editor of the Vim program, so it should be reflected in a window from the terminal completely blank but with a bullet in each corresponding line.

You have to press on the key I on the computer, so that this activates the mode of Inserted about the document and so it will be possible to add the text to the file.

Then, you have to write the text of the document, and when this has already been done the user will only have to press on the key Enter again to save the process and move on.

You must press on the key Esc, to enter the command mode and it is located in the upper left corner of the keyboard; at that moment the cursor will be noticed on the bottom of the window.

When you have finished with the previous step you have to write : w in the terminal and then press on Enter, to keep the document the same as est.

Emacs command

You must replace the name of the file as in the vi command, and then have to press on the Enter, and this command will open a new text file in its editor.

The user must know that this command has a lot of strong commands that will allow the browse all your documents, manage to manipulate texts, find information that is related to something or even allow you to understand some codes.

Also, Emacs control commands They are written with the letter C to execute this command, you have to press on the key Ctrl next to the command key specified, such as Ctrl + A.

Next, all the text of the document has to be written, and for that the user only has to write in a normal way, just as if he were editing any type of document with text; and to be able to save each of your lines of text you have to press on Enter.

The user will have to press on the key combinations of Ctrl + X and then press on the letter key S, so that this will save the entire file.

When that is finished, you have to press again on the combination of Ctrl + X and once upon a time Ctrl + C, so that the text editor of the command is closed and it returns to the terminal directory, so that the file is saved on the directory with the name that was selected.

Finally, you have to open the same file again, and for this you just have to write the word of Emacs In the terminal.

Therefore, as long as the user is on the same directory of his text file, at the time of writing the command the file is going to be reflected through where you can continue editing if desired.

Rate this post