How to Create File and Folder on Linux using Terminal. | How to Rename the file and folder in linux.

Well the Linux operating system is the most lovely operating system, all over the world. Because you will get many more customization that you want. You can do what ever you want. But coming to the point is in Linux operating system most of use time is on a black and white or may be colourful terminal screen. In that terminal screen you have to do what ever you want. In your initial stage or you are a beginner you should know some basic Linux commands. That will helps you a lot by doing your daily life uses. 

how to rename file on linux.


Well in this blog i am going to discuss about some simple commands with uses in this blog and that is How to Create Folders and files on linux using terminal.  To start the process and for creating the file and folder on your terminal first open your terminal. If you are using a Ubuntu then simple press ctrl + Alt + T to open the terminal screen or if you are using any other version or Flavor of Linux then you can  going the Activities section on your top of your screen.

How to create a empty file? :- 

Open your terminal and press touch command to create a empty file. like this :-

touch ( filename.txt) not only .txt file you can create many more extension of different files.

cloudpradeep


How to create a file with some content?

  • We can perform this action by using different method like using the native like cat  command or we can perform by using the text editor commands.
  • Cat commands are used to view a file but we can perform the creating  a file action on it.
  • In linux there is mainly 4 types of text editor is there. 

    1. nano :- Smallest text editor on linux. It use CLI to operate.
    2. gedit:- One and only GUI text editor.
    3. vi 
    4. vim
Vi and VIm both are same text editor but Vim is a 3rd party text editor so it not including with os. we have to install for the use. Both Vi and vim can operate on CLI mode only.

    Using cat commands :- 

cat>filename.txt then it you can add your text after that for exiting from cat terminal simple press CTRL + C   to stop the process and exit back to normal terminal. 

 

How to Create File and Folder on Linux using Terminal

 Using the text editor :- 

Simple type nano filename.txt  and it will open a new text interface on that same terminal screen, then you can type your content and after that for exiting back to normal terminal simple press CTRL + X  .

 

How to Create File and Folder on Linux using Terminal



By using Gedit :- 

  Gedit filename.txt   then it will open a gui text editor similar like your windows notepad like this. It is only works when you are using a desktop gui varian of Linux machine. 

How to Create File and Folder on Linux using Terminal

 

    By using the Vi and Vim :-

vim/vi filename.txt  then it will open a new console thn press I to go inside the insert mode and after writing your content simple press the Esc to key to return back to Command mode then for saving your file simple press shift + :  and then (wq! ) to save and exit. like this :wq! . 

 

How to Create File and Folder on Linux using Terminal

How to create a folder in linux?

For creating a folder in your machine simple type on your terminal :- mkdir (folder name) .

you can create your folder in some other specific location like in Music or Downloads folder like this :

    mkdir /home/pradeep/Music/sahoo 

aqua color is the command to create. The yellow for specific path and the Red one is your folder name.

How to rename the file name?

For rename your file or folder we can use the move command like this :- mv file1 newfile-name  .
if i want to rename the file called simple to litu.txt then i will use :- mv simple.txt litu.txt . 

How to Create File and Folder on Linux using Terminal


That's all about how to move and create a file and folder on a Linux machine. 

1 comment: