10. Emacs Manipulate Files

Lesson Content

In a lot (if not all) of Emacs documentation, you will see the syntax C-[letter]. This just means hit the Ctrl-letter, but for shorthand purposes, we’ll call Ctrl with C. If you see syntax such as M-[letter], that means use the Meta key, most commonly the Alt key.

Saving files

C-x C-s - Save a file
C-x C-w - Save file as
C-x s - Save all

The save file options will prompt you if you want to save each file.

Opening a file

C-x C-f

This will prompt you to type a filename to open. If you do not have a file that already exists, it will create a new file. You can load up a directory as well.

Exercise

Play around with opening files and saving files.

Quiz Question

# What command is used to open a file? > Use Ctrl-x f to open a file from within Emacs. Create a new file in the same way as opening a file by specifying the new filename. The new file will not be saved unless specified. Save a file that is currently open by entering the Ctrl-x Ctrl-s command. 1. [ ] C-x s 2. [ ] C-x C-w 3. [ ] C-x C-s 4. [x] C-x C-f