۱۳۹۳ مهر ۲۴, پنجشنبه

c progaramming videos

 
په پښتو ژبه زده کړی  c -programming سلامونه ګرانو دوستانو داسایت تعقیب کړی او کولای شی

۱۳۹۳ مهر ۲۱, دوشنبه

linux nots by pashto


بسم الله الرحمن الرحیم

دلوی خدای ج په سپیڅلی نامه

System

·         An operating system (OS) is software that manages computer hardware and software resources and provides common services for computer programs

1.    اپریټینګ سیستم یو سافتویر دی کوم چی ترتیب کوی دکمپیوتر سافتویر او هاردویر او اسانتیا برابروی تر څو انستال شی په کمپیوتر کی  پروګرامونه. 

·     Operating System

An operating system or OS is a software program that enables the computer hardware to communicate and operate with the computer software. Without a computer operating system, a computer and software programs would be useless

2.   دا یو سافتویر پروګرام دی کوم چی توانایی لری چی هاردویر دسافتویر سره ارتباط ورکری  بیدون له اپریټینګ سیستم څخه کمپیوتر یا کوم بل پروګرام بی فایدی دی یعنی که په کمپیوتر کی اپریټینګ سیستم موجود نه وی نو موژ نشو کولای چی دکمپیوتر نه استفاده وکرو

·        open source

a program in which the source code is available to the general public for use and/or modification from its original design free

هغه پروګرام دی کوم چی سورس کود ته یی لاسرسی کیژی او دټولو خلکو دپاره داستعمال وړ وی او هغه پری یا خوشی ترلاسه کیدای شی


 

Open source software is software whose source code is available for modification or enhancement by anyone

Whit notes: it’s a software which is free including the source code free to modify free to distribute and free to download.

داهغه سافتویر دی کوم چی پری یعنی خوشی دی په هغه کی شامل دی سورس کوډ او هغه یعنی موژ کولای شو چی په هغه کی تغیر راولو او هغه موژکولای شو چی خوشی ډانلوډ کړو او مثالونه یی تاسی پورته کتلی شی.

What is single operating system?


·         Single user operation systems.


Single user operating system can be split into two types:


1)       Single user, single application operation system


2)       Single user, multi-tasking operating system.


Single user single application:


This type of operating system would be found on a mobile phone. There can only be one user using the mobile and that person is only using one of its applications at a time.



 


ځانګړی یعنی یواستفاده کوونکی په دوه برخوویشو اول هغه استفاده کوونکی چی فقط یوه وظیفه ترسره کوی په یوه وخت کی دمثال په ډول لکه مبایل یو استعمالونکی کولای شی چی تر سره کری یوه وظیفه په یوه وخت کی لکه په مبایل کی چی ته یا ګیم کوی یا مسیج لیګی خو تنها همدغه یو کار کولای شی په یوه وخت کی په همدی وخت کی خو ته نشی کولای چی هم ګیم وکر اوهم مسیج ولیګی داشوه یوه برخه یی 


Single user multi-tasking:


You will find this kind of operation system on a personal computer


The operation system is designed mainly with a single user in mind but it can deal with many applications running at the same time. for example when you write something you will search in the internet and also you will download something and listening to music on the same time


اوبله برخه یی  داده چی یو استفاده کوونکی کولای شی چی اجرا کری زیات کارونه په یوه وخت کی لکه کمپیوتر کی ته هم کولای شی یوه ویډیو ډانلوډ ته ورکړی او هم په فیسبوک کی کاروکړی او هم یوه سندره واوری دا ټول کارونه په یوه وخت کی ته ترسره کوی دا شوه بله برخه یی


 



·     Multi User System
Multi-user operating system is a computer operating system (OS) that allows multiple users to access a single system with one OS on it.It refers to more than one person can be able to log into the computer. Each person will have their
own settings.


زیات استفاده کوونکی :یا ملټی پل اپریټینګ سیستم یو کمپیوټر استفاده کوونکی سیستم دی دغه اجازه ورکوی تر څو زیات استفاده کوونکی لاسرسی ولری یوه سیستم ته او له یوه نه زیات کسان کولای شی چی داخل شی یوه کمپیوټر ته او هر یو کولی شی چی په هغه سیستم کی تنظیمات راولی  او په یوه وخت کی زیاتی وظیفی پرمخ بوزی


Multi-tasking is the ability to operate more than one program at a time.



Difference between Single User and Multi-User Operating System


1)      A single-user operating system is a system in which only one user can access the computer system at a time. On the other hand, a multi-user operating system allows more than one user to access a computer system at one time.1


دیوه استعمالونکی اوزیات استعمالونکی ترمنځ فرقونه :اول یو استعمالونکی هغه دی چی تنها یو نفر کولای شی دسیستم سره لاسرسی ولری په یوه وخت کی اول زیات استعمالونکی هغه دی چی له یوه نه زیات استعمالونکی کولای شی لاسرسی ولری سیستم ته په یوه وخت کی


A single user operating system provides the facilities to be used on one computer by only one user. In other words, it supports one user at a time. However, it may support more than one profiles. Single keyboard and single monitor are used for the purpose of interaction. The most common example of a single user operating system is a system that is found in a typical home computer----------


یو استعمالونکی کولای اماده کوی دا اسانتیا تر څو استعمال کری یو یو کمپیوتر یا مبایل دیوه ویوه نفر پواسطه په یوه وخت کی 


********************************************************************************************************************

 On the other hand, a multi-user operating system has been designed for more than one user to access the computer at one time. Generally, a network is laid down, so that a computer can be remotely used. Mainframes and minicomputers work on multi-user operating systems. These operating systems are complex in comparison to single user operating systems. Each user is provided with a terminal and all these terminals are connected to a main computer. In a multi-user environment, it is very important to balance the requirements of the users, as the resources of the main computer are shared among the users.

دا جور شوی دی له یوه نه دزیاتو استعمالونکو لپاره تر څو لاسرسی ولری سیستم ته ټول په یوه وخت کی لکه نیټورک داسیستم مختلف دی له سنګل یوزر نه په دی کی هر استعمالونکی کولای شی چی تهیه کری یو ترمینل اوټول ترمینل وصل کوی له مین کمپیوتر سره 

 


1. What Is Kernel?




A kernel is a central component of an operating system. It acts as an interface between the user applications and the hardware. The sole aim of the kernel is to manage the communication between the software (user level applications) and the hardware (CPU, disk memory etc). The main tasks of the kernel are :

کرنل څه شی دی ؟ کرنل یوه مرکزی برخه دآپریټینګ سیستم ده کوم چی رابطه ټینګوی ترمابین داستعمالونکی اپلیکشن او هارډیور ترمنځ او همدارنګه رابطه ټینګوی ترمابین دسافتویر او هارډویر 

مهمی دندی عبارت دی له :

·         Process management

·         Device management

·         Memory management

·         Interrupt handling

·         I/O communication

·         File system...etc..



·          


 

History of Linux:

Ken Thomson and Dennis Ritchie developed Linux in bill lib

1024 TB=1 exa byte

1024 EB=1peta byte.

1024 PB=1 zeta byte.

·         How can to create virtual RAM in Linux?

When we click to virtual box then you will click some thin else then click on partition then new partition then table free space then add press  100 EXD:3 choose system boot  then ok

Then free space    add   press   \

Then free space    add   press home

Then free space    add   press   swap

When we open the terminal how to open it     Control+Alt+T

$ ****this is normal user symbol

#****this is root user symblol

User name @host name@ ~# ښودل کیژی

Commands:

·         ls – directory name = to view the contents of directory list.

·         Touch- file name to creat afile.

·         Mkdir directory name - to creat a directory.

·          Rm file name to delete file

·         Rmdir directory name- to delete directory

·         Cp file name = Copy one or more files to another location

·         Cat > file neme = to write some thing in file

·         Cat >> to add more thing in file

·         Cat file name =to show what is in the file

·         Cal = to show calendar

·         Date= to show date

·         Pwd = to show present

·         chdir = Change working directory

·         chgrp = Change the group ownership of files

·         Clear = Clear terminal screen

·         Cut = Divide a file into several parts

·         Echo = Display message on screen

·         Factor = Print prime factors

·         Free = Display memory usage

·         Groups = Print group names a user is in

·         Kill= Stop a process from running

·         More= Display output one screen at a time

·         Mv= Move or rename files or directories

·         Passwd= Modify a user password

·         Who= Print all usernames currently logged in

·         Which= Locate a program file in the user's path

    • file system structure
    • The file system structure is the most basic level of organization in an operating system. Almost all of the ways an operating system interacts with its users, applications, and security model are dependent upon the way it organizes files on storage devices
    • چوکات دفایل سیستم هغه دی کوم چی جوړوی آپریټینګ سیستم په اسانه شکل

.1. The /boot/ Directory


The /boot/ directory contains static files required to boot the system, such as the Linux kernel. These files are essential for the system to boot properly

بوت ډایریکټوری شاملوی ساکن فایلونه تر څو بوت کری سیستم لکه کرنل چی مخکی مو تعریف کری دغه فایلونه ضروری دی ترڅو بوت کری سیستم په صحیح ډول

 

.2. The /dev/ Directory


The /dev/ directory contains device identity that are provided by the kernel

3.      The /bin/ Directory

Stand for binary 

Which can be use in normal user

4.      The /sbin/ Directory

Stand for super binary

Which can be used only by root user.

5. The /home/ Directory

 Default location for normal user

5.      The /root/ Directory

Default location for admin user

6.      The /lib/ Directory

Library dynamic link library

Also 1.2.1.4. The /lib/ Directory


The /lib/ directory should contain only those libraries needed to execute the binaries in /bin/ and /sbin/. These shared library images are particularly important for booting the system and executing commands within the root file system.

1.2.1.5. The /media/ Directory


The /media/ directory contains subdirectories used as mount points for removeable media such as usb storage media, DVDs, CD-ROMs, and Zip disks.

1.2.1.7. The /opt/ Directory


The /opt/ directory provides storage for most application software packages.

1.2.1.8. The /proc/ Directory


The /proc/ directory contains special files that either extract information from or send information to the kernel

1.2.1.12. The /usr/ Directory


The /usr/ directory is for files that can be shared across multiple machines

 

13. The /etc/ Directory

It’s a directory in which the installed application are stored.

هغه داریکتوری ده کوم چی انستال شوی سافتویرونه زخیره کوی

که مو فکر کری وی په ویندوز کی فایل سیستم دی کوم چی موز څه شی انستال کرو داریکت خی فایل سیستم کی زخیره کیژی او په لینکس کی په دی ځای کی


 

 

 What is Fedora?


Fedora is a operating system, a collection of software that makes your computer run. You can use Fedora in addition to, or instead of, other operating systems such as Microsoft Windows™ or Mac OS X™. The Fedora operating system is completely free of cost for you o enjoy and share

پیډورا اپریټینګ سیستم دی کوم چی یوځای کوی سافتویرونه ترڅوستا کمپیوټر عملیه اجرا کړی



What is an INODE in Linux?


 

I must say that its a data structure that keeps track of all the information about a file.

You store your information in a file, and the operating system stores the information about a file in an inode(sometimes called as an inode number).

Also with nots: it contain the information about file like name size etc………….

اینود څه شی دی : اینود ډیټا سټرکچر دی کوم چی ساتی دفایل ټول معلومات یعنی زخیره کوی یی لکه لاندی وظیفی

 

 

 An Inode is a data structure that stores the following information about a file :

  • Size of file
  • Device ID
  • User ID of the file
  • Group ID of the file
  • The file mode information and access privileges for owner, group and others
  • File protection flags
  • The timestamps for file creation, modification etc
  • link counter to determine the number of hard links
  • Pointers to the blocks storing file’s contents

For example :

$ touch a

 

$ ln a a1

 

$ ls -al

drwxr-xr-x 48 himanshu himanshu 4096 2012-01-14 16:30 .

drwxr-xr-x 3 root root 4096 2011-03-12 06:24 ..

-rw-r--r-- 2 himanshu family 0 2012-01-14 16:29 a

-rw-r--r-- 2 himanshu family 0 2012-01-14 16:29 a1

 

$ stat a
File: `a'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 805h/2053d Inode: 1448240 Links: 2
Access: (0644/-rw-r--r--) Uid: ( 1000/himanshu) Gid: ( 1001/ family)
Access: 2012-01-14 16:30:04.871719357 +0530
Modify: 2012-01-14 16:29:50.918267873 +0530

Change: 2012-01-14 16:30:03.858251514 +0530

 

that contain information about files in Unix file systems that are created when a file system is created. Each file has an inode and is identified by an inode number

Types of inode:


Hard link and soft link


 


Structure of regular file


 

 


Boot block: it is a place to store boot related information (100 MB)

Super block: it is a place where information about file system all size store in this block

Inode list :  like                       file name                     inode value

                                                  Abc                                  123

A data block is the unit of transfer between main memory and auxiliary storage and usually consists of several records

File and permission 


Read ,write and execute

Example : r=4  w=2 x=1                                         rwx=7

Example:           vfr

                            Own     group          others

                             Rw          r                 rw

                                6          4                 6

#] chmod 646 vfx

 

To change the permission of a file or directory

Chmod permission filename\directory

Chang mode

If we want to know the permission of existing file:#]ls –l file name

·         Change owner permission

We Use chown to change ownership

A group usually consists of a collection of users, all belonging to the same group. The first set of three is the read, write, and execute permissions for the owner of the file

 

isms@dell]$touch  hi

to know the properties of a file hi

ls – l hi

ls – l flie name

 

chown: change ownership

#]chown user name    file name

To change the group

#]chgrp group name

 

System calls

To open a file the system call used is

Open(  )

Close ( ) to close a file

Create (  ) to create a file \folder

Write ( ) to write a file

Read  (  ) to read into file



The Linux terminal has a number of useful commands that can display running processes, kill them, and change their priority level.

When you execute a program on your UNIX system, the system creates a special environment for that program. This environment contains everything needed for the system to run the program as if no other program were running on the system

Starting a Process:


When you start a process (run a command), there are two ways you can run it:

·         Foreground Processes

·         Background Processes

Foreground Processes:


By default, every process that you start runs in the foreground. It gets its input from the keyboard and sends its output to the screen.

You can see this happen with the ls command. If I want to list all the files in my current directory, I can use the following command:

$ls ch*.doc

Background Processes:


A background process runs without being connected to your keyboard. If the background process requires any keyboard input, it waits.

The advantage of running a process in the background is that you can run other commands; you do not have to wait until it completes to start another!

The simplest way to start a background process is to add an ampersand ( &) at the end of the command.

$ls ch*.doc &

·         Terminal command prompt in windows

in linux server if we login it provides terminal for every user for every task we do there will a process created

·         Command to use the process that is running in terminal

·         $]ps [process state]

·         To see all the process   $] ps _ - a   it will show the foreground and background of process

·         To see which user using which application     $] ps _ -va

·         To end the process which is running    $] kill process id

Vi Editor:

Its like notepad

Type of editor  1 : CVI   2 : GVI

To open the notepad in linux we should type                    $] gedit

Operating mode in VI editor

1)      Command mode    

2)      Editing  mode

·         VI – file name            to open VI editor

·         CVI   consumes  less power when compared to GVI

·         In command mod we can give only commands we could not type text

·         In editor mode we can insert update we can type anything

·         Press  (i) to goes editor mode

·         Press ( ESC) to goes command mode

·         :w we can to save the file

·         :q used to log out the command mode

1)      K – up

2)      J – down

3)      H – left

4)      L – right

Deleting characters

X= to used to delete a character under cursor location

d w = delete location

d ^ = if will delete the text which texted before the cursor

d$ = this is used to delete the text which delete after the cursor

search and replace in vi editor

 %s\fid word \replace word\.g

·         To copy the the entire line command is

y y (name of lines) (or) y

·         To paste the lin commant is p   after the cursor   P befor the cursor

·         To copy the entire documents from vi to vi2

·         :e<file name >vi2

Who command