Start course
Overview
Difficulty
Intermediate
Duration
53m
Students
153
Ratings
5/5
starstarstarstarstar
Description

This course will get you up to speed with the fundamentals of Linux and prepare you for further study. You'll learn how to navigate your way through the Linux directory structure and the permissions for doing so. We'll also cover files and the multitude of ways in which they can be created, managed, and deleted.

Learning Objectives

Gain a foundational understanding of how to create and modify files in Linux.

Intended Audience

  • Anyone with little to no knowledge of Linux who wants to learn more about the operating system
  • Professionals who want to learn about Linux to enhance their career prospects

Prerequisites

This is a beginner-level course so there are no prerequisites, but an interest in Linux and programming knowledge in general would be beneficial.

Transcript

In today's lesson, we will be learning how to use the Emacs editor. Emacs like Vi is a powerful editor. Some people prefer Vi others prefer Emacs. My recommendation to you is to experiment with the Emacs editor and the Vi editor, and see which one you feel more comfortable with. You can't make a bad choice.

To edit a file with Emacs, run Emacs and provided the file name that you wish to edit. When you look at the Emacs documentation, you'll see C dash character. This means to hold down the control key while pressing that character. For example, C dash H means to hold down the Ctrl key, while pressing the H key. If you see C dash H space T, that means to hold down the Ctrl key while pressing the H key release the Ctrl key, and then type the letter T.

When you see M dash character, that means to hold down the Meta key. The Meta key is the Alt key. You can also substitute the Escape key for the Alt key. For example, M dash F translates to holding down the alt key and pressing F, or pressing and releasing Escape, followed by the F key. You may need to use the Escape key as the Meta key, since all can sometimes be intercepted by your terminal program for instance. If you wanna simplify things, just always use the Escape key for the Meta key.

Use Ctrl+H to get help, type Ctrl+x followed by Ctrl+C to exit Emacs, Ctrl+X Ctrl+S saves the file, Ctrl H T we'll start the Built-in tutorial, Ctrl H K followed by a key will describe that key. You can use this to get help on a specific key command or key combination. Ctrl+P will take you to the previous line, while Ctrl+N will take you to the next line. Ctrl+B is to go backward one character, Ctrl+F is to go forward one character, Meta F will move you forward one word, and Meta B will take you back one word. Ctrl+A will take you to the beginning of the line, Ctrl+E will take you to the end of a line. 

Meta less than will take you to the beginning of the file, and Meta followed by the greater than symbol, will take you to the end of the file. To delete a character, type Ctrl+D to delete a word it's Meta D. Ctrl+K will kill the rest of the current line, to kill the entire line just position the cursor at the beginning of the line and type Ctrl+K. In Vi, Yank means to copy. And Emacs, Yank means to paste. So Ctrl+Y is to Yank or paste from the previously killed text.

To undo type Ctrl X U. Ctrl+S will start a forward search, type the text you're looking for, and type Ctrl+S again to move to the next occurrence of that text. Press enter when you're done searching. Ctrl+R starts a reverse search. Like Vi Emacs provides a way to repeat commands. For instance to kill three lines of text, type Ctrl+U three Ctrl+K.

Let's edit a file with Emacs, we'll do filed our text, to navigate, we can use Ctrl+N to go to the next line, and Ctrl+F we'll go forward one character, Ctrl+P we'll go previous line, Ctrl+B we'll go back a character, to get to the beginning of the line type Ctrl+A, and to the end Ctrl+E. And you can just start typing text wherever your cursor is.

Let's delete a character with Ctrl+D. To delete a word, type Meta D, can I can use Alt+D or Esc D. Let's kill a line of texts with Ctrl+K, and I'll move to the bottom of the file and Yank it or paste it in. Let's start a search, let's search for the. Ctrl+S will take you to the next occurrence, and then when you're done, you can just hit enter, and if we do a reverse search, we can do that with Ctrl+R, let's do the same thing, Ctrl+R takes you to the previous one, and when you're done you can hit enter. To exit Ctrl+X Ctrl+C, and I'm not going to save my changes.

Skip back into Emacs again, and we can save the file with Ctrl+X Ctrl+S. Again to exit Ctrl+X Ctrl+C. Emacs is a more powerful editor than nano. Emacs is also an alternative for Vi. Again some people prefer Vi others prefer Emacs. I suggest you try them both and see what you feel comfortable with. I also suggest that you take the tutorial by starting Emacs and pressing Ctrl H T.

About the Author
Avatar
Jason Cannon
Founder, Linux Training Academy
Students
3453
Courses
61
Learning Paths
8

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.

Covered Topics