Vikrant Unix Notes
Vikrant Unix Notes
]
Subject Code: CS-5006
Semester: 5th
Downloaded from be.rgpvnotes.in
Introduction to Unix/Linux
Operating Systems
Interfaces:
Application Program OS
User Hardware
User User Kernel
UNIX
Multi-user, multi-tasking OS, & open source.
A fully featured modern operating system (mostly coded in C) turns the computer into a useable
machine.
Introduction to Unix/Linux
History
Unix is Made Up of
Processes
Running Programs
User owned
System owned
Files
Regular Files:
– Data
– Executables <-- usually start a process
Directory Files
– Contain other files and directories
Special Files
Introduction to Unix/Linux
• After a successful login, the shell program is run. The default shell of bingsuns: tcsh
• It displays like this :-
PID TTY TIME CMD
2159 pts/2 0:00 tcsh
Introduction to Unix/Linux
Introduction to Unix/Linux
/ (root)
Directory Contains
bin Binary executable files
lib Library functions
dev Device related files
etc Binary executable files usually required for system administration
tmp Temporary files created by unix or users
usr Home directories of all users
/usr/bin Additional binary executable files
Introduction to Unix/Linux
User management
Introduction to Unix/Linux
File permissions
d –Shows it is directory
* Total 9 bits are assigned to a file (i.e.2-10 bits, 1st bit for showing whether it is directory)
Examples:
(U) (O)
(g)
Introduction to Unix/Linux
To write or modify something in file go to Insert mod by pressing anyone of three keys a/i/o
Kill : to kill process Ex. “ Kill –term5467 ” where term is prosess name
& 5467 is PID.
Introduction to Unix/Linux
Guidelines to Students
There are two ways you can execute your shell scripts. Once you have created a script file:
Method 1
Pass the file as an argument to the shell that you want to interpret your script.
For example, the script file show has the following lines
Step 2 : To run the script, pass the filename as an argument to the sh (shell )
$ sh show
Here is the date and time
Sat jun 03 13:40:15 PST 2006
Method 2:
Make your script executable using the chmod command.
When we create a file, by default it is created with read and write permission turned on and execute permission
turned off. A file can be made executable using chmod.
For example, the script file show has the following lines
$ show
Here is the date and time
Notes are by Vikrant sharma
Introduction to Unix/Linux
Step 1 : Use an editor, such as vi, ex, or ed to write the program. The name of the file containing the program
should end in .c.
main()
{
printf(“ welcome to CDGI “);
}
$ cc show.c
If the program is okay, the compiled version is placed in a file called a.out
$ a.out
Welcome to CDGI