in

1. Create and Edit Text Files Part I – (LFCSA)

Let me introduce what this course is all about and what you gonna be learning here for a while. The whole course is related to “Creating Linux Basic Foundations”. LFCSA (Linux Foundation Certified System Administrator), For More search here

Why choose LFCSA?

  • The Linux Foundation is the non-profit organization that hosts the Linux project, employs Linux creator Linus Torvalds and hosts kernel.org (where all Linux kernel updates are released). So when you get our certifications, you’re getting certified from the source.
  • Because we’re so close to the Linux community, we are able to update our certifications regularly using feedback from the community to make sure our exams are using the most up-to-date information.
  • The Linux Foundation has the only performance-based certifications on the market today that is available in all the major Linux distributions: CentOS, Ubuntu, and SUSE.
  • We don’t sell any software or support services so we’re completely distribution-neutral. Our only goal is to help you advance your Linux career.

I am starting it from very basic part so that you can catch up things from the root of it. All of the stuff you learn from here, helps you to go further in Linux development fields etc.

Pre-Requisites:

  1. Any Linux OS (Preferred Ubuntu)
  2. Download Linux OS here

So, Let’s get Started 😉

In the very first chapter of our course, I am going to introduce you all about, how to create files and put some text in it with the help of terminal. For your information:

[quote text_size=”small”]

A terminal emulator is a program that allows the use of the terminal in a graphical environment.

[/quote]

Okay, Now we know the rules of the game and now we can fire up our terminal and start writing code in it. So open up the terminal you can find it in left dock section.

For creating files we use touch command:

[email protected]:~# touch test.txt

The above statement will create a blank file named “test.txt” in the current directory

“ls” command is used for listing the items in the directory. In the above image, we have successfully created a file using a terminal. Ohhh… Congrats now you’ve accomplished your first task…yeah…..:-)

Now let’s talk about some different types of creating files.

[email protected]:~# echo "Hello this is Louis William"
Hello this is Louis William

“echo” is used to print out the string on the terminal. We can also use echo for creating the files…yes you heard it right.

[email protected]:~# echo "Hi I am Louis Williams" > test2.txt
[email protected]:~# ls
Desktop    Downloads  hello.txt  Pictures  Templates  test.txt
Documents  eclipse    Music      Public    test2.txt  Videos
[email protected]:~# cat test2.txt
Hi I am Louis Williams

As you can see above how I used echo command to create a file with something given to it. This is another way of creating the files.

Okay, now we are done with creating files on Terminal in Linux. Let’s try to edit the existing files on Terminal.

For editing files on Terminal, we can use two editors:

  1. Vim Editor
  2. Nano Editor

You just need to type “vi” and following with the file name on the terminal and now you can see the content on the terminal screen. But you can’t simply edit that text, you need to press “i” in order to modify the text in it. After modifying the file you need to save it and quit it, for that pressing ESC(escape key) then press “:” and type “wq” to save and quit it. If you just want to save the file, the type “w” after pressing “:” and for only quit press “q“. That’s it.

The last one is Nano, which is better than Vim editor and has good interface as well.

[email protected]:~# nano test2.txt

When you type this command, nano editor will open up in the terminal. And you can edit your file content simply after you are done, then press Ctrl + o to save it will ask to change the file name, just hit enter there. And after it to exit press Ctrl + x.

Written by Anandesh

I am a #Linux lover and very much excited about technology and new thing. Love to #read_books. Curiosity is my best teacher. I am still☺️ understanding myself.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Best Operating System for Programmers in 2018

pentest-machine: Automates some pentest jobs via nmap xml file