Disk Management In Operating System

Image
 Disk Management  Disk is a secondary storage device that is used to store data.  The external devices such as hard disk, magnetic disks and floppy disks stores data in the sectors.  These devices provide the data to user programs by means of I/O requests.  Disk Management is an important function of operating system and includes disk buffering and management of swap area and disk cache.  Disk Structure  Disks provide a means to store a large amount of information for modern computer.  A disk is usually divided into tracks, cylinder and sectors.  Below fig shows the various components of a disk system.  Data is stored on a series of magnetic disks called platters. These disks are connected by a common spindle that spins at very high speed (some spindle rotate at speeds of 3600 revolutions per minute).  The two surfaces of a platter are covered with a magnetic material similar to that on a magnetic tape. Information is recorded mag...

Editors in Linux Operating System

 Editors 

In Unix, a text file is created and modified by a program, called text editor or simply editor. Unix operating system also comes with several editors. 

Types Of Editors :

LINE EDITORS :

The Unix editors that edit processes one line at a time are called line editors. Common example are ED and EX. 

SCREEN EDITORS :

Editors that makes use of whole screen for editing or processing more than one line at a time are called screen editor. With screen editor you can display and edit many lines by giving a single command. Example Vi. 

Various Commands of Linux 

Listing of files 

'1s' command lists the files in the specified directory. 

Syntax : 1s[options] 

At the command prompt type 1s 

[user1 @linux-mac user1]$ 1s

The screen will look like this, because we have not created any directory or file. 

[user1 @linux-mac user1]$ 1s

[user1 @linux-mac user1]$

Find Out Where You Are 

The command used for this purpose is 'pwd'. This command displays the name of the present working directory. 
Syntax : pwd 
[user1 @linux-mac user1]$ pwd 
 /home/user1
[user1 @linux-mac user1]$

Creating A Directory 

The command 'mkdir' is used to make a directory. 
Syntax :  mkdir[directory path] 
 [user1 @linux-mac user1]$mkdir hello 
 [user1 @linux-mac user1]$1s-1
 total 4 
 drwxrw - xxr ------------ 2 user1  1024 May 11 11:05 hello 

Moving Around 

The command 'cd' is used to change directory. 
Syntax :  cd [directory path] 
 [user1 @linux-mac user1]$ cd hello 
 [user1 @linux-mac user1/hello]$

Creating A File 

The command 'cat' is used to create a file. 
Syntax : cat>>[filename] 
Issue the command cat>>name at he command prompt as a given below. 
[user1 @linux-mac user1] cat>>name 
This is my first file. 
Then press ctrl+z to save contents.

Removing A Directory 

The command 'rmdir' is used to remove directory. 
Syntax : rmdir[directory path] 
at the command prompt type rmdir hello where hello is the directory that we want to remove. 
  [user1 @linux-mac user1]$ rmdir hello 
  [user12linux-mac user1]$ 1s -1 
  total  0 

Renaming A Directory Or File 

The 'mv' command is used to rename a given file. 
Syntax : mv[source path directory]  [destination path directory] 
At the prompt type name name 1
      [user1 @linux-mac user1]$ name name1

Moving A File Or Directory 

The 'mv' command is also used to move the specified file or directory to another location. 

If a directory 'another' exists in the current directory, running the following command moves the file name 1 into the directory 'another'. 
[user1 @linux-mac user1]$ mv name1 another 
[user1 @linux-mac user1]$ 1s another 
name1

Copying A File 

The command 'cp' is used to copy a file. 
Syntax : cp [source file]  [destination file] 
[user1 @linux-mac user1]$ cp name1 name 

Now we have 2 files name and name1, which are absolutely same. 

Removing A File 

The command 'rm' is used to remove a file. 

Syntax : rm[file] 
[user1 @linux-mac user1]$ rm name1
[user1 @linux-mac user1]$

This removes the file name1 from the directory. 

Removing Directory Structure Entirely 

The command 'rmdir' fails if files of subdirectories exist within the directory we wish to delete. The 'rm-r' command traverses the entire directory structure of the specified directory removing all the files and directories that exist on the way. 
[user1 @linux-mac user1]$ rm-r another 
[user1 @linux-mac user1]$

Using The Online Help 

The command 'man' is used to get online help for any linux command. The command 'man' formats and displays the online manual pages of given command. 

Syntax : Man[Command] 
[user1 @Linux-mac user1]$ Man 1s 

The above command displays the documentation from manual pages for '1s' command. 

Using The Calendar Command :

The command 'cal' is used to print the calendar for a particular year. We can specify the month /year in this command. 

Syntax : cal[month] [year] 

The computer can print a calendar. The command for this is cal. 
[user1 @Linux-mac user1]$ cal 1999

This will print the calendar for year 1999 

File Permissions 

A multiuser environment involves a lot of people working together sharing resources. Linux uses a mechanism called file permission to prevent a user's file from being tampered by others users. 

Permissions fall into three main categories : read, write, and execute. These permissions may be granted to classes of users : the owner of the file, the group to which file belongs and to all other users, regardless of the group. 

'Read' permission let's the user read the contents of the file, or in case of directories list the contents of directories. 

'write 'permission let's the user write to modify the file. For directories' write' permission let's the user create new files or delete files within the directory. 

'Execute' permission lets the user run the file as a program or shell script. For directories having execute permission let's the user switch to the directory in question. 

Thus, every file or directory has three kinds of permissions attached to it : 

Read (r) : to examine the contents 

Write (w) : to modify or change the contents 

Execute (x) : to run that file as a program allows the user see the contents of the directory

Using The Command Is -I : 

This command is used to see long listing of files. 

[user1 @linux-max user1]$ 1s -1

This will display the file in long format. 

-rw-rw-r- 1 kelvin Kelvin 206 may 18 12:17 lopht 
  
-rw-rw-r- 1 kelvin Kelvin 10206 may 218 12:17 lopht 

-rwxrw-r- 1 kelvin Kelvin 17838 may 218 12:17 linux1 

The first field - rwxrw-r- is the field that describe permissions. 

The set 'r-' describes the permissions for others. 

Standard Files 

In Linux, a file represents every physical device used by the system. 

The monitor, which is called the standard output device also has a file which is known as the 'standard output file' associated with it. 

The keyboard, called the standard input device also has a file, the 'standard input file'. 

If in any case the execution of a command results in error, the error message is directed to the standard error device, which in most cases the standard output device namely the monitor. 


       https://youtube.com/channel/UCLZqVRZUkuXIlST8BteqTig

This is the link of my YouTube channel please visit at this link and if you like it don't forget to like, share and subscribe the channel.

Comments

Popular posts from this blog

Disk Management In Operating System

Text Editor in Linux Operating System

You must know about Adventure sports