Вы находитесь на странице: 1из 4

Linux Programming

Unit-1:Intro to linux and linux Utilities


History of Linux:
The history of Linux began in 1991 with the commencement of a personal project by Finnish student Linus
Torvalds to create a new free operating system kernel. Since then, the resulting Linux kernel has been marked
by constant growth throughout its history. Since the initial release of its source code in 1991, it has grown
from a small number of C files under a license prohibiting commercial distribution to the 4.15 version in 2018
with more than 23.3 million lines of source code without comments [1] under the GNU General Public License
v2.

Architecture of Linux
 Hardware layer – Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).

 Kernel – Core component of Operating System, interacts directly with hardware, provides low level
services to upper layer components.

 Shell – An interface to kernel, hiding complexity of kernel’s functions from users. Takes commands
from user and executes kernel’s functions.

 Utilities – Utility programs giving user most of the functionalities of an operating systems.

Features of Linux
1. Multiuser Capability: This is a capability of Linux OS where, the same computer resources – hard disk,
memory, etc. are accessible to multiple users. Of course, not on a single terminal, they are given
different terminals to operate from. A terminal will consist of at least a Monitor/VDU, keyboard and
mouse as input devices. All the terminals are then connected to the main Linux Server or Host
Machine, whose resources and connected peripheral devices such as printer, can be used.

Client/Server Architecture is an example of multiuser capability of Linux, where different clients are
connected to a Linux server. The client sends request to the server with a particular data and server
requests with the processed data or the file requested, client terminal is also known as a Dumb
Terminal.

Page 1 of 4
Linux Programming
2. Multitasking: Linux has the ability to handle more than one job at a time, say for example you have
executed a command for sorting for a huge list and simultaneously typing in a notepad. This is
managed by dividing the CPU time intelligently by the implementation of scheduling policies and the
concept of context switching.

3. Portability: Portability was the one of the main features that made Linux so popular among the users,
but portability doesn’t mean that it is smaller in file size and can be carried on pen drive, CDs and
memory cards. Instead, here portability means that Linux OS and its application can work on different
types of hardware in the same way. Linux kernel and application programs support their installation
even on very least hardware configuration.

4. Security: Security is a very important part of any OS, for the organizations/user who is using the
system for their confidential works, Linux does provide several security concepts for protecting their
users from unauthorized access of their data and system.

Security by File Permissions


File ownership is an important component of Unix that provides a secure method for storing files. Every file in
Unix has the following attributes

• Owner permissions − The owner's permissions determine what actions the owner of the file can
perform on the file.

• Group permissions − The group's permissions determine what actions a user, who is a member of
the group that a file belongs to, can perform on the file.

• Other (world) permissions − The permissions for others indicate what action all other users can
perform on the file.

File Handling Utilities


All data in Unix is organized into files. All files are organized into directories. These directories are organized
into a tree-like structure called the filesystem. In Unix, there are three basic types of files −

• Ordinary Files − An ordinary file is a file on the system that contains data, text, or program
instructions. In this tutorial, you look at working with ordinary files.

• Directories − Directories store both special and ordinary files. For users familiar with Windows or
Mac OS, Unix directories are equivalent to folders.

• Special Files − Some special files provide access to hardware such as hard drives, CD-ROM drives,
modems, and Ethernet adapters. Other special files are similar to aliases or shortcuts and enable
you to access a single file using different names.

Listing Files
• Use ls

Metacharacters
• Use * and ? charecters

Hidden Files
• Use ls -a

Creating Files
• Use cat

Editing Files
• Use cat

Page 2 of 4
Linux Programming
Display Content of a File
• Use cat

Counting Words in a File


• Use wc

Copying Files
• Use cp

Renaming Files
• Use mv

Deleting Files
• Use rm

Process Utilities
• Touch

If user wants to change the timestamp , or create or modify timestamp Touch command is used.
Touch command is used to work with server Operating system timestamp.

• Ps

ps basically stands for ‘Process Status’ which is used to display currently running processes in unix
operating system.

• Kill

$ kill Pid: When invoked kill command sends a termination signal to the process being killed. We
can employ sure kill signal to forcibly terminate a process. Signal number for sure kill is 9

Disk Utilities
• fdisk

Fdisk is the most commonly used command to check the partitions on a disk. The fdisk command
can display the partitions and details like file system type. However it does not report the size of
each partitions.

• sfdisk

Sfdisk is another utility with a purpose similar to fdisk, but with more features. It can display the size
of each partition in MB.

• fdisk

Cfdisk is a linux partition editor with an interactive user interface based on ncurses. It can be used to
list out the existing partitions as well as create or modify them.

• parted

Parted is yet another command line utility to list out partitions and modify them if needed.

• df

Df is not a partitioning utility, but prints out details about only mounted file systems. The list
generated by df even includes file systems that are not real disk partitions.

• pydf

Page 3 of 4
Linux Programming
Improved version of df, written in python. Prints out all the hard disk partitions in a easy to read
manner.

• lsblk

Lists out all the storage blocks, which includes disk partitions and optical drives. Details include the
total size of the partition/block and the mount point if any.

• blkid

Prints the block device (partitions and storage media) attributes like uuid and file system type. Does
not report the space on the partitions.

• hwinfo

The hwinfo is a general purpose hardware information tool and can be used to print out the disk
and partition list. The output however does not print details about each partition like the above
commands.

Page 4 of 4

Вам также может понравиться