Common operating system functions in linux

Operating System — Linux

Linux is one of popular version of UNIX operating System. It is open source as its source code is freely available. It is free to use. Linux was designed considering UNIX compatibility. Its functionality list is quite similar to that of UNIX.

Components of Linux System

Linux Operating System has primarily three components

Linux Operating System

  • Kernel − Kernel is the core part of Linux. It is responsible for all major activities of this operating system. It consists of various modules and it interacts directly with the underlying hardware. Kernel provides the required abstraction to hide low level hardware details to system or application programs.
  • System Library − System libraries are special functions or programs using which application programs or system utilities accesses Kernel’s features. These libraries implement most of the functionalities of the operating system and do not requires kernel module’s code access rights.
  • System Utility − System Utility programs are responsible to do specialized, individual level tasks.

Kernel Mode vs User Mode

Kernel component code executes in a special privileged mode called kernel mode with full access to all resources of the computer. This code represents a single process, executes in single address space and do not require any context switch and hence is very efficient and fast. Kernel runs each processes and provides system services to processes, provides protected access to hardware to processes.

Support code which is not required to run in kernel mode is in System Library. User programs and other system programs works in User Mode which has no access to system hardware and kernel code. User programs/ utilities use System libraries to access Kernel functions to get system’s low level tasks.

Basic Features

Following are some of the important features of Linux Operating System.

  • Portable − Portability means software can works on different types of hardware in same way. Linux kernel and application programs supports their installation on any kind of hardware platform.
  • Open Source − Linux source code is freely available and it is community based development project. Multiple teams work in collaboration to enhance the capability of Linux operating system and it is continuously evolving.
  • Multi-User − Linux is a multiuser system means multiple users can access system resources like memory/ ram/ application programs at same time.
  • Multiprogramming − Linux is a multiprogramming system means multiple applications can run at same time.
  • Hierarchical File System − Linux provides a standard file structure in which system files/ user files are arranged.
  • Shell − Linux provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, call application programs. etc.
  • Security − Linux provides user security using authentication features like password protection/ controlled access to specific files/ encryption of data.
Читайте также:  Устройства локальной сети linux

Architecture

The following illustration shows the architecture of a Linux system −

Linux Operating System Architecture

The architecture of a Linux System consists of the following layers −

  • Hardware layer − Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).
  • Kernel − It is the 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. The shell takes commands from the user and executes kernel’s functions.
  • Utilities − Utility programs that provide the user most of the functionalities of an operating systems.

Источник

Basics of Operating System and Linux Commands

Finally, I decided to start writing blogs to have systematic notes saved somewhere so that I can access them anytime, and at the same time, sharing my learning can help others, too.

So, in this blog, I’ll be sharing whatever I’ve learned about operating system, and linux commands and what are the important and most basic linux commands that you should be familiar with as a developer.

What is Operating System?

An operating system is a program that acts as an interface between the computer user and computer hardware, and controls the execution of programs.

Things that a software needs to be considered as a Operating System

  • Kernel — establish communication between user level application and hardware, decide state of incoming processes, control disk management, control memory management, control task management.
  • File System — Data structure that an operating system uses to store and retrieve data in the memory.
  • User Interface(CLI(Command line Interface) or GUI(Graphical user interface))
  • Should be able to manipulate data based on commands

What happens when you start your computer?

When you start your computer, the operating system executes the softwares that are there in the BIOS(Basic Input Output System). The BIOS chip tells it to look in a fixed place, usually on the lowest-numbered hard disk (the boot disk) for a special program called a boot loader (under Linux the boot loader is called Grub or LILO). The boot loader is pulled into memory and started. The boot loader’s job is to start the real operating system.

Читайте также:  Dropbox на linux mint

Most common Operating Systems

  • Windows(Majorly derived from other operating systems)
  • Macintosh(UNIX based)
  • Linux(UNIX based)

Why developers should use Linux

  • UNIX based Operating System
  • It is open source
  • Supports almost all programming languages
  • Offers vast range of applications and tools that are developer friendly
  • Terminal is superior to command prompt(cmd) in windows
  • Bash Scripting
  • SSH

History of Linux

Working with Linux Terminal

Linux shell of «Terminal»

So, basically, a shell is a program that receives commands from the user and gives it to the OS to process, and it shows the output. Linux’s shell is its main part. Its distros come in GUI (graphical user interface), but basically, Linux has a CLI (command line interface).

Opening the terminal

To open the terminal, press Ctrl+Alt+T in Ubuntu, or press Alt+F2, type in gnome-terminal, and press enter. In Raspberry Pi, type in lxterminal. There is also a GUI way of taking it, but this is better!

Managing the size of the terminal

To increase the size of the terminal, press ctrl + shift + ‘+’ To decrease the size of the terminal, press ctrl + ‘-‘

Basic Linux terminal commands

Hello world in terminal(echo) :

echo-Hello-World.webp

To print anything in the console just write echo and then the phrase you want to print. To print Hello, world just write $ echo Hello, world!

pwd :

Use the pwd command to find out the path of the current working directory (folder) you’re in. The command will return an absolute (full) path, which is basically a path of all the directories that starts with a forward slash (/). An example of an absolute path is /home/username.

ls :

The ls command is used to view the contents of a directory. By default, this command will display the contents of your current working directory.

  • ls -R will list all the files in the sub-directories as well
  • ls -a will show the hidden files
  • cd- (with a hyphen) to move to your previous directory If you want to see the content of other directories, type ls and then the directory’s path. For example, enter ls /home/username/Documents to view the content of Documents.

cd :

To navigate through the Linux files and directories, use the cd command. It requires either the full path or the name of the directory, depending on the current working directory that you’re in.

Читайте также:  Linux load library at runtime

Let’s say you’re in /home/username/Documents and you want to go to Photos, a subdirectory of Documents. To do so, simply type the following command: cd Photos.

  • cd .. (with two dots) to move one directory up
  • cd to go straight to the home folder
  • cd- (with a hyphen) to move to your previous directory

Here is an example of pwd, cd and ls commands being used :

Change-directory-in-Linux-using-cd-command.webp

clear :

Just write ‘clear’ command to clean out the terminal

comments :

In Linux terminal, comments are written just after a # For example, if we write ‘#This is a comment’ in the terminal if won’t do anything.

mkdir & rmdir :

Use the mkdir command when you need to create a folder or a directory. For example, if you want to make a directory called “DIY”, then you can type “mkdir DIY”. Remember, as told before, if you want to create a directory named “DIY Hacking”, then you can type “mkdir DIY\ Hacking”.

  • To generate a new directory inside another directory, use this Linux basic command mkdir Music/Newfile
  • use the p (parents) option to create a directory in between two existing directories. For example, mkdir -p Music/2020/Newfile will create the new “2020” file.

fZHiKDkI6X950pnqyFDNLUuVvXnCGE3W2LqLjN3w.webp

Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.

touch :

The touch command is used to create a file. It can be anything, from an empty txt file to an empty zip file. For example, “touch new.txt”.

xQ2pP99oGhjN1fisLfllUSp3BYFne9Gt1hdBAvMX.webp

file :

Used to list types of all the files from mentioned directory.

gedit :

To start gedit from the command line, type gedit and hit Enter. The gedit text editor will appear shortly. It’s an uncluttered and clean application window. You can get on with the task of typing up whatever you’re working on

cat :

Use the cat command to display the contents of a file. It is usually used to easily view programs.

Here is an example using touch, file, gedit, and cat commands:

File-cat.png

history :

When you’ve been using Linux for a certain period of time, you’ll quickly notice that you can run hundreds of commands every day. As such, running history command is particularly useful if you want to review the commands you’ve entered before.

cp :

Use the cp command to copy files from the current directory to a different directory.

cp.png

man :

Loads the manual or info of a command. To see manual of any command, type man and then the command. For example man cp gives manual of cp command which looks like:

Источник

Оцените статью
Adblock
detector