Week 2 notes
Concepts
Superblock/Inode tables - There is a hidden database for Unix filesytems made up of entries called inodes. These inodes contain all the information about a file that Unix needs.
Symbolic link - A special file that points to another file that may or may not exist. ln -s original_file pointer is used.
Commands
Text viewer/editor commands
- cat - concatenate/view files
- tail - read end of file
- head - read beginning of file
- more - read file with scrolling
- less - less is more
- vi - available everywhere, fast text editor
- emacs - very powerful and complex editor
vi
Vi has two modes editing mode and command prompt(ex mode.)
You are in editing mode by default. To add text you can press the a or i keys. To leave append or insert editing mode press the [esc] key.
In editing mode (when not using the a,o or r text inserting mode) these are some of the more useful commands you can use...
- e - skip to end of next word
- x - delete a character
- dd - delete line (save to buffer)
- yy - copy to buffer without deleting
- p - paste buffer contents on following line
- / - find pattern in text
- : - enter command prompt
At the command prompt ":" found at the lower left hand corner of the screen you can use these (and many other) commands. To return to editing mode hit [esc]
- q! - quit vi without saving
- wq - write and quit
- wq! - write read-only file overwriting permissions
- w filename - write to a different filename
- vi filename - edit new file
- set ruler - continuously display current coordinates
- linenumber p - paste buffer at linenumber
- linenumber,linenumber2 y - copy lines linenumber to linenumber2 into buffer
- linenumber,linenumber2s/old_pattern/new_pattern/g - search for old_pattern and replace with new_pattern between lines linenumber and linenumber2