This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Among these attributes, file names are stored in the directory but other attributes like file-size, permission, links, time-stamps are stored in the inode.
Links make the same file available in multiple directories at the same time Two types of Links:
1. Hard Link2. Soft Link or Symbolic Link
1. Hard Link A hard link is another name given to the existing file These names share the same inode UNIX command ln is used to create hard links:
ln file1 file2
2. Soft Link A soft link to a file has a separate inode than the file It stores the target file’s path in its inode UNIX command ln –s is used to create soft links:
Inode is a data structure containing useful information about an item in the Unix File System.
Inodes reside on disk and do not have names. Instead, they have indices (numbers) indicating their positions in the array of inodes as shown in the next slide.
Every item in the file system with a name can be specified with a pathname.
Pathname represents the path to the entry from the root of the file system. By following this path, the system can find the inode of the referenced entry.
Superuser Can also be referred to as a System Administrator Has an overall authority on Unix OS Responsible for OS maintenance, backup and recovery, user
management etc. Superuser login is root and prompt is #
Owner Is a user who creates a file For every Unix file there can be only one owner File owner can assign the file permissions to group and other
Group In Unix, groups can be formed based on area of work Superuser can create a group and assign members to it Owner of a file can decide what permissions to be given to
group members
Others User who is not a owner and does not belong to any specific
group is referred to as other user Owner of a file can decide what permissions to be given to
$ man command formats and displays online manual pages
The manual pages are divided into logical grouping of the commands called the sections. Sections are numbered from 1 through 9. For example, commands are 1, system calls are 2, library function are 3, file formats are 5, & management commands are 8.
If section is specified, man only looks in that section of the manual.
The command man 2 open displays the manual for the system call open.
$ date: command prints or sets the system date and time
For example,$ date$ date –r TestFileDisplays the last modification time of the file “TestFile”
This command can be used with suitable format specifiers as argument. Each format is preceded by a + symbol, followed by the % operator, and a single character describing the format.
find command is used for finding files and directories in the specified file tree based upon certain criteria
Command Syntax:$ find path criteria actione.g.
$ find /usr -name “ymess*” –print
Finds files recursively in the directory in path The path can be absolute or relative Multiple directories can be written in the path In the criteria, wild cards are allowed
umask command changes initial permission of newly created file
The value of argument can be calculated by subtracting the mode you want as default from the current default mode
Assume that the current default mode is 0666 and you want it as 0644 then 666 – 644 = 022 will be the parameter which we have to pass with “umask” command
It is a feature by which filters & other commands can be combined in such a way that the standard output of one filter or command can be sent as standard input to another filter
A vi session begins by invoking the command “vi” with a filename
$ vi [filename]
You can start vi without a filename, but when you want to save your work, you will have to tell vi which filename to save it into.
The last line in the screen is reserved for some commands that you can enter to act on the text. This line is also used by the system to display messages.
The three different modes of operations are: Command mode: This is the default mode where you can pass
the commands to act on the text, using most of the keys of the keyboard
You can switch to this mode using “Esc” key
Insert (Input) mode: To enter the text, you have to enter into input mode. Press key “i” to enter into insert mode from command mode
You can switch to command mode by pressing “Esc” key
ex mode or line mode: You have to save your file or switch to another file or make a global substitution in the file. You then have to use ex mode, where you can enter the instruction in the last line of the screen. To enter into this mode, press “Esc” key followed by “:”
i inserts text before cursor position a Appends text after cursor position I inserts text at beginning of line A Appends text after end of line o opens line below current line to insert text O opens line above current line to insert text
h left by one characterl right by one characterk up by one linej down by one linew right by one wordb left by one word0 or ^ beginning of line$ end of line
x character under cursorX character before cursor[n]dw delete n wordsd0 beginning to cursor positiond$ or D cursor position to end of line[n]dd n lines from current line[n]dd pp will paste deleted lines to current cursor
y0 beginning to cursor position y$ cursor position to end of line [n]yw copy n words [n]yy n lines from current line in to the buffer [n]yy p p will paste copied lines to
:set all displays all set option:set autoindent/ai does automatic indentation:set number/nu shows all line duly numbered:set showmatch helps to locate matching brackets:set tabstop=5 sets tab=5 for display:set ic ignore case while pattern matching
When the string “no” is prefixed to any option, it indicates that the option is inoperative