0% found this document useful (0 votes)
39 views

Advanced Unix Syllabus

The document provides an overview of key concepts in the Advanced Unix syllabus including the Unix file system structure, paths, permissions, directories, and basic commands. It discusses the hierarchical structure of the Unix file system with directories and files. It also covers setting and viewing permissions on files, changing directories, listing directory contents, and using basic commands like cat, head, tail and pipes to view files.

Uploaded by

Mantosh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Advanced Unix Syllabus

The document provides an overview of key concepts in the Advanced Unix syllabus including the Unix file system structure, paths, permissions, directories, and basic commands. It discusses the hierarchical structure of the Unix file system with directories and files. It also covers setting and viewing permissions on files, changing directories, listing directory contents, and using basic commands like cat, head, tail and pipes to view files.

Uploaded by

Mantosh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Advanced Unix syllabus

Organization of Unix. User interface, Programmer interface. The environment of Unix process System calls. Process control, File related system calls. Process related system calls. Signals programming using system calls. Advanced I/O multiplexing. Memory mapped I/O. Inter process communication: Pipes, shared memory, semaphores, messages. Advanced inter-process communications. Streams, Pipes, Open server

File System
All the stored information on a Unix computer is kept in a file system. Anytime you interact with the Unix shell, the shell considers you to be located somewhere within a file system. Although it may seem strange to be located somewhere in computers file system, the concept is not so different with memory location. The place where you are located is called the current working directory

CONCEPT
The Unix file system is hierarchical (resembling a tree structure). The tree is anchored at a place called the root, designated by a /. Every time in the UNIX file system tree is either a file or a directory. A directory is like a file folder. A directory can contain files, and other directories. A directory contained within another is called child of the other.

Concept continued
A directory in the file system tree may have many children, but it can only have one parent. A file can hold information , but cannot contain other files or directories. To describe a specific location in the file system hierarchy, you must specify a path". The path to a location can be defined as an absolute path from the root anchor point or as a relative path starting from the current location.

When specifying a path you simply trace a route through the file system tree, listing the sequence of directories you pass through as you go from one point to another. Each directory listed in the sequence is separated by a slash.

Exercise: specify the absolute path to the directory named jon at the bottom of the tree diagram. Explanation: since the absolute path must always begin at the root (/) directory,the path would be :
/users/admin/jon

Exercise: specify the relative path from the directory named student in the tree diagram Explanation: starting from the student directory, we would first have to move up the file system tree (using the .. notation) to the directory called users before we could descend to the directory called jon. The path would be:
../admin/jon

Starting an Xterminal session


To start an Xterm session click on the Unix Terminal icon on your desktop or from the drop-down menus An xterminal window will appear with a unix prompt waiting for you to start entering commands.

File and Directory Permissions


Unix supports access control. Every file and directory has associated with its ownership, and access permissions. furthermore one is able to specify those to whom the permissions apply Permissions are defined as read write and execute. the read write and execute permissions are referred to as r,w,x respectively The user, group, and other permissions are referred to as u , g, and o respectively.

Read Permission
For a file, having read permission allows you to view the contents of a file. For a directory, having read permission allows you to list the directory contents

Write Permission
For a file write permission allows you to modify the contents of the file. For a directory write permission allows you to alter the contents of the directory i.e. to add or delete files.

Execute Permission
For a file execute permission allows you to run the file, if it is an executable program or script. Note that file execute permission is irrelevant for non executable files. For a directory execute permission allows you to go to the directory and make it your current working directory

Viewing Permission
To see the permissions on a file use the ls command with the -1 option Execute the command ls -1/etc/passwd To view the information on the system password database. The output should look similar to this: -rw-r--r-- 1 root sys 41002 May 9 12:35/etc/passwd

continued
The first 10 characters describe the access permissions. The first dash indicates the type of file(d for directory ,s for special file, - for a regular file). The next three characters(rw-) describe the permissions of the owner of the file: read and write, but no execute. The next three characters (r--) describe the permissions for those in the same group as the owner: read, no write, no execute. The next three characters describe the permissions for all others: read, no write, no execute.

Setting Permission
Unix allow you to set the permissions on files that you own. The command to change the file permission mode is chmod. Chmod requires you to specify the new permissions you want,and specify the file or directory you want the changes applied to. To define the kind of change you want to make to the permission, the minus sign (-) to remove a permission and the equal sign(=) to set a permission directly.

example
Type the command chmod g = rw-~/.shrc To change the file permissions on the file .shrc in your home directory. Specifically you are specifying group read access and write access, with no execute access.

exercise
Change the permissions on the .shrc file in your home directory so that group and others have read permissions only. Ans. Typing command Chmod go = r-- ~/.shrc Would accomplish the task.

Changing directories
In Unix your location in the file system heirarchy is known as your current working directory. When you log in, you are automatically placed in your home directory. To see where you are, type the command Pwd which stands for print working directory. To change your location in the file system hierarchy use the cd command followed by an argument defining where you want to go.the argument can be either an absolute path to the destination or a relative path.

example
Type the command cd/tmp To go to the /tmp directory. You can type pwd to confirm that you are actually there. If you type the cd command without an argument ,the shell will place you in your home directory.

Exercise
Type the command

pwd And note the result. then type cd.. To the shell. Then type pwd again. Explanation:- the cd .. command should have moved you up one level in the directory tree, because .. is Unix shorthand for the parent directory. The result of the second pwd command should be the same as first, with the last directory in the path omitted.

Listing contents of a directory


The ls command allows you to see the contents of a directory and to view basic information (like size, ownership, access permissions) about files and directories. Explanation for ls la The -a option instructs the ls command to list all files, including those that start with the period character. The directory permissions are listed next to the . symbol. Remember that . is Unix shorthand for the current working directory.

The cat command


The cat command concatenates files and sends them to screen. You can specify one or more filesasarguments.cat makes no attempt to format the text in any way, and long output may scroll off the screen before you can read it. Example :- cat ~ to the shell. The tilde(~) character is Unix shorthand for your home directory

Head and tail commands


The head command allows you to see the top part of a file. you may specify the number of lines you want or default to ten lines. Example: head -15/etc/rc To see the first 15lines of the /etc/rc file The tail commands works like head, except that it shows the last lines of the file. Example: tail/etc/rc To see the last 10lines of file etc/rc. Because we did not specify the number of lines as an option.the tail command defaulted to ten lines.

Pipelines and Filters


Concept:- Unix allows you to connect processes, by letting the standard output of one process feed into the standard input of another process. That mechanism is called pipe. Connecting simple processes in a pipeline allows you to perform complex tasks without writing complex programs

You might also like