0% found this document useful (0 votes)
50 views17 pages

Linux - 11th May

LInux

Uploaded by

Aniket
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views17 pages

Linux - 11th May

LInux

Uploaded by

Aniket
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Linux

What is Linux and why is it unique?

• Linux is different from other operating systems for many reasons. Firstly, it is open-
source and multilingual software. Most importantly, the code used for Linux is free for
users to view and edit.
• The Linux system is very stable and is not prone to crashes. The Linux OS runs exactly as
fast as it did when first installed, even after several years. … Unlike Windows, you need
not reboot a Linux server after every update or patch. Due to this, Linux has the highest
number of servers running on the Internet.
• It is a stable, multi-user, multi-tasking system for servers, desktops and laptops.

2
IT Solutions
Basic Features of Linux
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 multipleEngineering applications can
Services
run at same time.
 Hierarchical File System − Linux provides a standard file structure in which
Automatedsystem files/ user
Fare Collection,
Point of Sale & ATM Solutions,
files are arranged. Self Service Terminals,
 Shell − Linux provides a special interpreter program which can be used toInternetexecute
of Things.

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.
IT Solutions
Architecture of Linux
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.
Engineering
Services

Automated Fare Collection,


Point of Sale & ATM Solutions,
Self Service Terminals,
Internet of Things.
IT Solutions
Basic Commands of Linux

Engineering
Services

Automated Fare Collection,


Point of Sale & ATM Solutions,
Self Service Terminals,
Internet of Things.
IT Solutions
Basic Commands of Linux

Engineering
Services

Automated Fare Collection,


Point of Sale & ATM Solutions,
Self Service Terminals,
Internet of Things.
IT Solutions
File Structure in Linux
In Linux, all files and directories appear under the root directory /, even if they are stored on
different physical or virtual devices. Let us understand the meaning of individual high-level
directories.
1. / – Root
Every single file and directory starts from the root directory.
Only root user has write privilege under this directory.
Please note that /root is root user’s home directory, which is not same as /.
2. /bin – User Binaries
Contains binary executables.
Common linux commands you need to use in single-user modes are located under this directory.
Commands used by all the users of the system are located here.
For example: ps, ls, ping, grep, cp.
3. /sbin – System Binaries Engineering
Just like /bin, /sbin also contains binary executables. Services
But, the linux commands located under this directory are used typically by system aministrator, for system maintenance
Automated Fare Collection,
purpose.
Point of Sale & ATM Solutions,
For example: iptables, reboot, fdisk, ifconfig, swapon Self Service Terminals,
4. /etc – Configuration Files Internet of Things.
Contains configuration files required by all programs.
This also contains startup and shutdown shell scripts used to start/stop individual programs.
For example: /etc/resolv.conf, /etc/logrotate.conf
5. /dev – Device Files
Contains device files.
These include terminal devices, usb, or any device attached to the system.
For example: /dev/tty1, /dev/usbmon0
IT Solutions
File Structure in Linux (continued)
6. /proc – Process Information
Contains information about system process.
This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains
information about the process with that particular pid.
This is a virtual filesystem with text information about system resources. For example: /proc/uptime
7. /var – Variable Files
var stands for variable files.
Content of the files that are expected to grow can be found under this directory.
This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool);
lock files (/var/lock); temp files needed across reboots (/var/tmp);
8. /tmp – Temporary Files
Directory that contains temporary files created by system and users.
Files under this directory are deleted when system is rebooted. Engineering
9. /usr – User Programs Services
Contains binaries, libraries, documentation, and source-code for second level programs.
Automated
/usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under Fare Collection,
/usr/bin. For example:
Point of Sale & ATM Solutions,
at, awk, cc, less, scp
Self Service Terminals,
/usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin,Internet
look under /usr/sbin.
of Things.
For example: atd, cron, sshd, useradd, userdel
/usr/lib contains libraries for /usr/bin and /usr/sbin
/usr/local contains users programs that you install from source. For example, when you install apache from source, it goes
under /usr/local/apache2
IT Solutions
File Structure in Linux (continued)
10. /home – Home Directories
Home directories for all users to store their personal files.
For example: /home/john, /home/nikita
11. /boot – Boot Loader Files
Contains boot loader related files.
Kernel initrd, vmlinux, grub files are located under /boot
For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic
12. /lib – System Libraries
Contains library files that supports the binaries located under /bin and /sbin
Library filenames are either ld* or lib*.so.*
For example: ld-2.11.1.so, libncurses.so.5.7
13. /opt – Optional add-on Applications
opt stands for optional. Engineering
Contains add-on applications from individual vendors. Services
add-on applications should be installed under either /opt/ or /opt/ sub-directory.
14. /mnt – Mount Directory Automated Fare Collection,
Point of Sale & ATM Solutions,
Temporary mount directory where sysadmins can mount filesystems.
Self Service Terminals,
15. /media – Removable Media Devices Internet of Things.
Temporary mount directory for removable devices.
For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer
IT Solutions
User administration in Linux
There are three types of accounts on a Linux system −

Root account
This is also called superuser and would have complete and unfettered control of the system. A
superuser can run any commands without any restriction. This user should be assumed as a
system administrator.
System accounts
System accounts are those needed for the operation of system-specific components for
example mail accounts and the sshd accounts. These accounts are usually needed for some
Engineering
specific function on your system, and any modifications to them could adversely affect the
Services
system.
User accounts Automated Fare Collection,
Point of Sale & ATM Solutions,
User accounts provide interactive access to the system for users and groupsSelfofService
users. General
Terminals,
users are typically assigned to these accounts and usually have limited access to critical
Internet of Things. system

files and directories.

Linux supports a concept of Group Account which logically groups a number of accounts. Every
account would be a part of another group account. A Linux group plays important role in
handling file permissions and process management.
IT Solutions
User administration in Linux (continued)
The common commands for user administration are as follows:
Sr.No. Command Description
1 useradd Adds accounts to the system
2 usermod Modifies account attributes
3 userdel Deletes accounts from the system
4 groupadd Adds groups to the system
5 groupmod Modifies group attributes
6 groupdel Removes groups from the system Engineering
Services
There are four main user administration files − Automated Fare Collection,
•/etc/passwd − Keeps the user account and password information. This file holds
Pointthe
of Sale & ATM Solutions,
majority of information about accounts on the Unix system. Self Service Terminals,
Internet of Things.
•/etc/shadow − Holds the encrypted password of the corresponding account. Not all the
systems support this file.
•/etc/group − This file contains the group information for each account.
•/etc/gshadow − This file contains secure group account information.
IT Solutions
Monitoring System Performance
Linux provides following important commands to measure and fine tune system performance:
Sr.No. Command Description
It helps in execution of a program/process with modified scheduling priority. It launches
1 nice/renice a process with a user-defined scheduling priority. In this, if we give a process a higher
priority, then Kernel will allocate more CPU time to that process.

2 netstat This command is used for monitoring network connections both incoming and
outgoing as well as viewing routing tables, interface statistics, etc.
3 time Helps time a simple command or give resource usage
4 uptime It gives the uptime of the system
This commaind is used to list the currently running processes and their Engineering
PIDs along with
5 ps Services
some other information depends on different options
6 vmstat This command is used to obtain information about memory, system Automatedprocesses, paging,
Fare Collection,
interrupts, block I/O, disk, and CPU scheduling. Point of Sale & ATM Solutions,
Self Service Terminals,
Internet of Things.
7 top This command shows a real-time view of running processes in Linux and displays kernel-
managed tasks. The command also provides a system information summary that shows
resource utilization, including CPU and memory usage.
It allows administrators to view information about users that are currently logged in.
8 w This includes their username, where they are logged in from, and what they are
currently doing.
IT Solutions
File/Directory Permissions and Ownership
File/Directory Ownership and Permissions:
 Every file/directory belongs to a specific user or a group of users
 Every user/group many have permissions to read, write, &/or execute

 If you set read permission for a directory you can create new entries
 If you set write permission for a directory you can list (ls) the contents
 If you set execute permission for a directory you can cd into the directory
 A good starting point for files in your directory is "chmod 644" or "chmod 755" for files you want to
allow yourself to change and others to see (or execute). Engineering
 chmod command changes the rwx mode bits of a file or directory Services
• +/-: adds or removes the mode bits Automated Fare Collection,
• o: Sets the permissions for the owner of the file/directory Point of Sale & ATM Solutions,
• g: Sets the permissions for the group that of the owner belongs to Self Service Terminals,
Internet of Things.
• a: Sets the permissions for the all other users
IT Solutions
Text Editors in Linux
There are many text editors available on Linux. The most common editors are:
• nano is a small, simple and friendly editor
• vi/vim is a powerful text editor which can be used to edit all kinds of text

How does vi/vim work?


• vi/vim is a very popular text editor among programmers and system administrators
• It supports many programming and scripting languages
• Suitable for more advanced file editing
• vi/vim has two modes:
1. Text mode: which can be enabled by typing i (insert) or a (append)
2. Command mode: which will be enabled by pressing the Esc key on keyboard.
Engineering
Command Description
Services
! Forces the action
:q quit Automated Fare Collection,
:q! Force quit Point of Sale & ATM Solutions,
:w write Self Service Terminals,
:wq Write and quit Internet of Things.
:x Write and quit
i insert
a append
x Delete a character
d[count]d Cut (Delete) [count] lines
p Paste after the current line
IT Solutions
Other common commands in Linux
Compression and File Packaging:

Engineering
Services

Automated Fare Collection,


Point of Sale & ATM Solutions,
Self Service Terminals,
Internet of Things.
IT Solutions
Other common commands in Linux
tar command saves many files and directories into a single “archive” file
• tar OPTIONS dest_file src1 src2 …
• -f define the archive file path/name
• -c Create a new archive
• -a Append to the existing archive file
• -x Extract the contents of an archive file
• -z Compress archive file with gzip
• -j Compress archive file with bzip2
• -v verbosely list files processed

Engineering
Services

Automated Fare Collection,


Point of Sale & ATM Solutions,
Self Service Terminals,
Internet of Things.
THANK YOU

© Copyright 2020 Datamatics Global Services Limited and its subsidiaries (hereinafter jointly referred as Datamatics). All rights reserved.
 
Contents in this document are confidential and proprietary to Datamatics. No part of this document should be reproduced, published, transmitted or distributed in any form or by any means, electronic, mechanical, photocopying,
recording or otherwise, nor should be disclosed to third parties without prior written approval from the marketing team at Datamatics.

You might also like