Categories
Computer Technologies and O/S

FIT9018: Week 4

This weeks lecture was a continuation of ‘Operating System II: File Management”. Most of the concepts covered in this weeks lecture I had looked at in last weeks review.

Some of the new points introduced were:

  • When a file is accessed it has four id’s (I assume an example is real and sudo):
    • a real user id
    • an effective user id
    • a real group id
    • an effective group id
  • Standard Input, Output, Error – Every time a shell is started. 3 files are opened automatically:
    • stdin, (keyboard), 0
    • stdout, (screen), 1
    • sterr, (screen), 2
  • Example of how inode numbers and logical directory structures work.
  • How rwx Permissions work with directories: (Pearl of the Week)
    • Read- Processes can list names and subdirectories within directory
    • Write- Processes can alter the directory (create and remove files). To modify files write permission must be applied to the file.
    • Excecute- Allows the user to cd into the directory. To open a file or excerpter a program a user must have execute permission on all directories leading to the files absolute path name.
  • Hard and Soft(Symbolic) Links
  • Locks (not covered in detail yet)

Pearl of the week: vi/vim text editor

$ vi myfile
$ vim myfile

In the tut we worked with vi/vim text editor which is a tool I had struggled with before and had never bothered to read the tutorials on.

It turns out that it is a damn good editor as it is very very quick and easy once one becomes even moderately sufficient (2-3 hr tutorial). One of the primary advantages is that it runs within a command prompt environment so can be used via SSH with ease.

Some of the handy commands learnt in the tutorial are:

  • i -> insert mode
  • : -> comand mode
  • esc -> back to normal mode
  • CTRL + G -> End of the doc
  • /prase -> find phrase
  • n -> next phrase down
  • N -> next phrase up
  • :%s/word1/word2/gc -> replace all word1 with word2, gc adds confirmation for each occurance
  • u -> undo
  • d -> delete
  • put -> put was what just deleted
  • v -> visual select
  • w -> word (dw -> delete word)
  • $ -> end of line (d$ delete from cursor to end of line)
  • :set tabstop=2 -> set tab distance to 2
  • :set number -> show line numbers
  • :set nonumber -> hide line numbers
  • :1,4d -> delete lines 1,2,3,4

There are a great deal many useful examples of these which i shall add in as I use them.

Leave a Reply

Your email address will not be published. Required fields are marked *