Linux Notes Unit 1
Linux Notes Unit 1
Booting: Linux boot process is the initialization of the Linux Open Source OS on a Computer.
( Other distributions are : Arch linux, Kali linux, Yellow Dog, Gento linux, Scientific linux, Centos, Void linux,
Alphine linux, Parrot os, Vine linux, Black arch, Bodhi linux, Pardus, Sabayo, Linux Endeavour OS, Kubuntu,
Garuda etc)
You can use Linux as Server OS or as a Standalone OS on your PC. It is best suited for Server.
Linux is a multi user & multi tasking OS.
1
Advantages of Linux:
● Free – Most Linux distributions are free, users do not need to pay for a copy. Linux
distributions can be freely downloaded and legally installed on as many as you want and
freely (and legally) given to other people.
● Open Source – You have access to the source code and can customize Linux to be whatever
you want it to be. Linux is easy to install.
● Linux is very stable – Linux systems rarely crash, and when they do, the whole system
normally does not go down.
● Linux is not easily affected by computer malware – Infection with virus, spyware, Trojans,
and worms is considerably less for Linux. Also security updates normally come much quicker
to Linux than other operating systems because so many people are contributing to it.
● Linux does not have a registry like windows. So it is not troubled with registry errors which
can slow down a computer.
● Linux runs faster on even old computers. Linux runs great on newer computers as well.
● Linux offers a wide variety from which to choose the distribution.
● Linux is easier than other operating systems to use and install.
● Easier to upgrade than other operating systems.
● Linux in Outer Space : NASA’s Mars ExplorationRovers use Linux for Planning, Simulation,
Visualization, etc
● Linux in Gadgets: Embedded Linux Systems are used in Mobile Phones, Sony Play Stations,
notesbooks and PDAs.
● Linux in projects: Myth TV - gathers TV channel listing for your area, select shows you want
to view, record, playback etc.
● Linux Terminal Server Project: Workstations for Schools or small business.
● Linux toys: You can build your own gaming console.
Disadvantages of Linux:
● Many Windows programs will not run in Linux. Microsoft Office, Internet Explorer and many
other Windows programs will not run natively in Linux.
● There is a smaller selection of peripheral hardware drivers for Linux.
● Gaming software are less compared to Windows.
2
The functioning of Unix and Linux are managed in 3 levels:
1. Application programs and other utilities are in the outer level. They speak our language.
2. Shell is the command interpreter. It interprets commands that we give and then conveys them to
the kernel which executes them. Shell is in the middle layer. Shell is responsible for the
communication between the outer and inner layers..
3. Kernel is the heart of the OS. It interacts directly with the actual h/w. It is responsible for all the
major activities of the Linux OS. The Kernel has various functions like managing files, carrying out all
the data transfer between the files system and the hardware. It also manages the resources of Linux
OS (memory, cpu, etc.).
(1. What is the basic difference between Unix and Linux operating system? )
Unix Linux
1. Unix is not open source Linux is open source
2. Unix is licensed OS Linux is free to use
3. Distributions are AT&T, Ultrix, SunSolaris, Distributions are RedHat, Caldera, Debian,
Xenix, IRIX SUSE )
4. Not Portable Portable
5. High rigid hardware requirements Flexible
6. Mainly used in Server System Used in PC, mobile phone also
Inode: An Inode is a data structure containing metadata about the files. The Inode of a file contains
Owner of the file, File size, Date of creation, Permission, Device ID, number of links, etc An Inode
number is a unique number for all the files in Linux and Unix type systems. When a file is created
on a system, a file name and Inode number is assigned to it. Generally, to access a file, a user
uses the file name but internally the file name is first mapped with respective Inode number stored
in a table.
The Linux file system is the structure in which all the information on the computer is stored. Linux
uses a hierarchical file system to organize its files. It has a root directory (/) that contains other files
and directories.
A full path or relative path can be used to refer a file or directory. In Linux there are several types of
3
files. They are:
1. Ordinary files
2. Directory files and
3. Device files (In Linux systems, the devices are considered as special files.)
/ : It is the root filesystem. It is the top-level filesystem directory. It must include every file
needed to boot the Linux system.
/boot : It has bootable Linux kernel, bootloader configuration files and executable files needed
to start a Linux computer.
/bin: This directory includes user executable files. This directory contains common linux
commands such as ls, date etc.(binary files or executable files)
/dev: It includes the device file for all hardware devices connected to the system. These aren't
device drivers; instead, they are files that indicate all devices on the system and provide
access to these devices. (such as printers,disk storage devices, terminals, modems, memory
etc. )
/etc: It contains administrative configuration files.
/home: The home directory storage is available for user files. All users have a subdirectory
inside /home.
/root: It's the home directory for a root user. Keep in mind that it's not the '/' (root) file system.
/lib: It contains shared library files needed by applications in /bin to start the system.
/tmp: It is used to store all temporary files. It is a temporary directory used by the OS and
several programs for storing temporary files. Also, users may temporarily store files here.
Remember that files may be removed without prior notice at any time in this directory.
/usr : used to store all files of user accounts.
/mnt: It is a temporary mount point for basic filesystems.
/media: A place for mounting external removable media devices like USB thumb drives that
might be linked to the host.
/opt: It contains optional files like vendor supplied application programs.
/sbin: These are system binary files. They are executables utilized for system administration.
/var: Here, variable data files are saved. It can contain things such as MySQL, log files, other
database files, email inboxes, web server data files, and much more.
Linux supported File Systems are Ext, Ext2, Ext3, Ext4, XFS, NFS, JFS etc.
4
LINUX Commands
Syntax: $ command options arguments
The Linux command is followed by options and a list of arguments. The options can modify the
behavior of a command. The arguments may be files or directories or some other data on which
the command acts. Every command might not need arguments. The options can be provided in
two ways:
(i) single letter option with a - (eg: -a, -l, -abc)
I. Simple Commands
3. date - To display the current date and time. Syntax : date [option] [format]
eg: date
o/p: Tue Jan 9 10:55:36 IST 2024
Eg: date "+%y/%m/%d"
o/p: 24/01/09
5. more – the output of a command can be send to the more command, using ‘|’ symbol .
The more command will allow the user to view the contents of a file one screenful at a
time.
Syntax1: more <filename>
eg: more abc.text
Syntax2: <command> | more
eg: cal –y | more
5
Suntax2: cat <filename>
eg:2) cat music - to display the contents of the file music.
Syntax3: cat <filename> . . . > <filename>
5
eg:3) cat music game > new : to concatenate multiple files (music, game) and
write into a single file.
eg:4) cat * - to display all files.
eg:3) ls – R : to list all files and directories recursively from current directories.
eg: 4) ls - a : In linux low level configuration file names start with a period. By default ls
does not display those files. – a option is used to display those hidden files.
eg: 5) ls – s : to list by size, print the allocated size of each file in blocks.
2. cp - used to create copies of an ordinary file. The copy command is used to copy the contents of
one file to another. You can also use this command to copy a file from one directory into another.
Syntax: cp [option] <file1> <file2>
eg:1) cp music musicnew : to copymusic to musicnew
eg:2) cp file? /data : to copy the file1, file2 to data directory
eg:3) cp file1 ~ : to copy the file to home directory
eg:4) cp -i *.txt /data : i confirm each copy (interractive)
6
4. rm - To remove a file or directory
Syntax: rm <file1>
eg:1) rm newmusic : to remove newmusic file
eg:2) rm * : to remove all files.
eg:3) rm - R : To delete the entire directory tree. (recursion)
6
Syntax: cmp <file1> <file2>
eg: cmp file1 file2
6. file - To find out the type of the file (text file, executable file, script file etc.)
Syntax: file <file1>
eg: file music
eg:1) ls f* - to list all files starting with the character ' f '
eg:2) ls a???? - to list all files starting with the character ' a ' and having 4 more characters
eg:3) ls [ab]* - to list all files starting with the letter ' a ' or ' b'
eg:4) ls [a-c]* - to list all files starting with the letter ' a ' or ' b ' or ' c '
7
Minimum Requirements for Linux :
There are many linux distributors for handheld devices or old PC’s (such as Damn Small Linux,
Slack ware) which require as little as 24 MB RAM and 486 process0or.