Part 2 - Configuration And The Environment
11 - The Environment
printenv - Print part or all of the environment
set - Set shell options
export - Export environment to subsequently executed programs
alias - Create an alias for a command
What is stored in the environment?
envirnoment variables and shell variables
Examining The Environment
What's In A Startup File?
Modifying The Environment
Which Files Should We Modify?
Text Editors
Using A Text Editor
12. A Gentle Introduction To vi
vi
:q
:q!
Entering Insert Mode
"i" key
Saving Our Work
:w
Moving The Cursor Around
Cursor Movement Keys
Basic Editing
insert mode
command mode
Opening A Line
Deleting Text
Text Deletion Commands
Cutting, Copying, And Pasting Text
Yanking Commands
Joining Lines
J command
Search-And-Replace
Searching Within A Line
f command
eg. fa
Searching The Entire File
/ command
eg. /Log n command get the next
Global Search-And-Replace
:%s/pattern/replace/g
Editing Multiple Files
vi files1 file2 file3...
Switching Between Files
:n To switch from one file to the next
:N To move back to the previous file use
:buffers
:buffer 2
Opening Additional Files For Editing
vi foo.txt
:e foo2.txt
Copying Content From One File Into Another
yy (copy)
p (paste)
Inserting An Entire File Into Another
:r
Saving Our Work
:w
:wq
:w filename This act like "Save As....."
13 – Customizing The Prompt
Anatomy Of A Prompt
echo $PS1
PS1='[\u@\h \W]\$' 的意思就是:[当前用户的账号名称@主机名的第一个名字 工作目录的最后一层目录名]
Trying Some Alternative Prompt Designs
Adding Color
Moving The Cursor
Saving The Prompt