Home
Flashcards
Preview
Linux Ch10 Editing Files
Home
Get App
Take Quiz
Create
Different editors
–Emacs–gedit–vi–pico–Nano–Kwrite and Kate
Plain Text Files
Viewable with any editor
No special formatting (no images or embedded features)
Used for configuration files and scripts
Use ASCII format (American Standard Code for Information Interchange)
Moving to Unicode format
Each line in a text file is usually no more than 80 characters long
Contents
: Human language files (README)
Source code for Programs
Formatted text files
Program and System configuration files
Log files and more
ASCII
–Date to 1960’s
Support only 7-8 bit codes
Maximum of 128-256 characters
Different variations
Difficult to support languages other than English
Unicode
More up to date coding scheme
Can represent any alphabet in common use on Earth
Different coding schemes within
UTF-8 used to represent ASCII
UTF-16 16 bit coding scheme
Text mode editors
vi
: Available on any Linux or Unix install
Installed by default
Runs in different modes
very common editor (questions on certification exams)
emacs
: Available on any Linux or Unix install
Installed by default
Runs in different modes
Can take a lot of resources
pico
: Small command-line editor
nano
: Clone of “pico”
Extra features
GUI Editors
emacs
: Both GUI and text-mode
gedit
: Available with GNOME desktop
Usually installed by default
Much like Windows Notepad
Kwrite and Kate
: Editors for K Desktop Environment
Nedit
: Like Kwrite
May have to be installed
Different ways to launch GUI editor
From a file-manager double click the file and the default GUI editor will launch
From a terminal session:
gedit filename
vi filename
vi” editor
Very powerful program
Available on virtually every Linux system
Not easy to use
Three modes within “vi”:
Command Mode
Ex Mode
Insert Mode
Editing Files with vi
Basic steps:
Open a file in vi
Enter into Insert mode
Add text to file
Edit text in file
Save file
Exit vi
vi commands
Edit a new file
: :e filename
Include an existing file
: :r filename
Execute an external command
: :!command
Quit
: :q or :q!
Write & Quit
: :wq
vi Insert Mode
This mode will allow you to actual make changes in the file
When finished all changes make sure you press the “Esc” to return to “Command Mode”
Then either save your changes and exit, or exit without saving.
To save and quit
: :wq
To quit without saving
: :q!
To save and continue editing
: :w
To save with filename :w filename
search for searchtext /searchtext
search again for searchtext /[Enter] or n
execute cmdName and return to vi
:!cmdName
To start “vi”:
Command
: vi myfile
The above command will begin “vi” session of the named file
To actually start editing the file you can press the “i” key (insert)
Majority of system configuration files found in
“/etc” or a subdirectory within
User’s configuration resides
in the user’s home directory
configuration files usually begin with a “.” (hidden)
Example
: .bashrc
Always make a copy before making any changes
Most configuration files contain
comments:
Used to explain specific functions or operations
Read all comments
Most comments usually begin with a “#” number sign
Example
: # The following routine sets a variable value
Other comments may begin with a “;” semicolon
Named Variables
$PATH
$PS1 used to create your display prompt
$HOSTNAME
localhost.localdomain is default set during the installation of this system
$HISTSIZE
$HOME
to see value echo $varName
Author
slc53
ID
329698
Card Set
Linux Ch10 Editing Files
Description
Linux Ch10 Editing Files
Updated
2017-03-22T00:20:13Z
Home
Flashcards
Preview