What is Linux?
Most people think that Linux is an OS, but it is actually not. Linux itself doesn’t form an OS. Linux is nothing but a Kernel.
Kernel is a large code of millions of lines, which forms the core of any operating system. It can be considered as a resource manager of an operating system. User applications can communicate with the hardware only through the kernel. It is the kernel which keeps the OS up and running.
Linux kernel based operating systems are called Linux OS, like redhat, Linux mint, Ubuntu, centos etc.
History of Linux
UNIX is considered as the very first operating system of all its characteristics. Before UNIX there was no operating system concept. UNIX was developed by the employees of AT&T Bell Laboratories) in 1969
UNIX was not a free OS; also the OS was not available for common users. Actually at that time there was no personal computer concept. So the operating system was mainly used in mainframe computers and for research purposes.
There was a research student’s version of UNIX called Minix released in the year 1987. The source code of the Minix was available, but modifications were not allowed.
Linus Torvalds from the University of Helsinki was doing a personal project in which he tried to modify the kernel of Minix and develop a new one of his own. He was using Minix since his school days. He posted on the internet that he is trying to develop the kernel for a new operating system. So many brains around globe respond to this and contribute their code. Linus Torvalds coordinate all these and formed Linux kernel in the year 1991.
The Free Software Foundation (FSF) started by Richard Stallman in the year 1983, was running a project called GNU (Gnu Not Unix). They had the entire user interface ready, but their kernel was a complete failure. They used the Linux kernel developed by Linus Torvalds for their GNU project and formed GNU/Linux.
FSF licensed the operating system GNU/Linux under GPL (General Public License) in the year 1992. The OS is available for free. It was open source, which means the source code is available. Anyone can modify the source code and develop their version of OS. But GPL doesn’t allow common people to distribute their modified Linux OS; all the modified versions should be submitted back to the FSF.
History of Linux
[header = Windows Vs Linux]
Windows versus Linux
Linux
|
Windows
|
Free Operating System
|
Windows is not available for free
|
Linux is open source
|
Windows is not open source
|
Linux is highly secure
|
Windows have so many security issues
|
Multiple user interface
|
Single user interface
|
Multiuser multitasking
|
Single user multitasking
|
Little chance for a system halt
|
Windows suffer from system halt occasionally
|
We can configure hardware through files
|
We can only install drivers for hardware
|
Why Linux for engineers?
1) Free OS
Linux is a free operating system. You can just search the internet and download the OS version you like.
2) Open source
Open source means the source code is available for reference and modification. Nothing is hidden in the Linux.
3) Security
Linux is a highly secure OS. Ever wonder why people say that virus won’t affect Linux? The main reason behind this is nothing but most of the hackers support the open source Linux. Also,
– No registry concept like windows
In windows there is a file called registry file, in which all the configurations are maintained. Normal people can’t read the registry file, because the data are stored in hex values. Those who know how to modify this registry file can create a virus in windows.
– Unlike windows not even a single program run without the permission of the administrator.
– Windows can have many users having administrating power. So there is a potential threat of unauthorized access by an administrator into another administrator’s documents or applications.
– Most of the virus comes in .exe format. Linux is safe from that kind of virus files, because it does not support .exe files.
Virus attack does affect Linux also, but their intensity is limited to like, hacking administrator password and similar things.
4) Multiple user interfaces
Windows has only one user interface, GUI. Command prompt is simply an application runs in GUI. But Linux has two kinds of user interfaces
– One GUI ( Graphical User Interface )
– Six TUIs ( Text User Interface )
5) Multiuser Multitasking
Windows allows only a single user to login at a time and do the work. But in Linux more than one user can login at any given time and each user can perform multiple tasks simultaneously.
6) Linux seldom crash
There is little chance for a system halt in Linux. Even if some applications crash, we can just kill those particular applications only. The whole system won’t go down due to such kind of issues. But in windows if a single program is not responding, we can use task manager and most of the cases it won’t work out and finally we have to restart the system. That is why Linux is preferred for network servers which require running 24*7 without any interruption.
7) Linux treat everything as files
Unlike windows, Linux treats everything as files including hardware devices. So we can configure the hardware devices through these files. In windows our access to the hardware is very much limited; we can do nothing but install the specific drivers.
Linux allows to write drivers for the hardware, and thus engineers prefer Linux for device driver coding.
[header = File system in Linux]
Filesystem in Linux
In a computer the hard disk forms a physical medium which can store files, and thus forms a filesystem. The major filesystem types in Linux are
1) EXT3
2) EXT4
3) VFAT
4) Swap
Ext3 and Ext4 stands for extended file system. VFAT is a filesystem equivalent to the windows FAT ( File Allocation Table ) file system, it stands for Virtual FAT.
Ext3 and Ext4 are used to create and access logical volume. VFAT is used in external medias like Pendrive and all.
Swap is used to create a swap area in the hard disk, which can be used as a virtual memory. The total memory which a running application can see is the sum of physical memory ( RAM ) and the Virtual memory ( Swap ).
Mount points in Linux
The windows use a method called “Drive letter mounting” to access the disc space. Windows users are familiar with the terms C-drive, D-drive etc. But Linux use an entirely different technique called “mount point”.
Unlike windows we can see the mounted disk space as folders under the root of the file system. In windows we can see them as drives.
Examples of mount points are /, /boot, /home etc.
Filesystem hierarchy in Linux
In Linux the file system is maintained in a hierachial method. The “/” forms the root of all filesystem, under which all other directories are mounted.
Filesystem hierarchy in Linux
Mount points and their Usage
Directory
|
Usage
|
/bin
|
Binary directory; Stores commands used in Linux
|
/boot
|
Store files like boot loader, required during boot time
|
/dev
|
Device information directory. Device files are kept here
|
/etc
|
System configuration files are stored here
|
/home
|
Document directory of all normal users
|
/root
|
Document directory of super-user
|
/mnt
|
Mount directory for manual mounting
|
/media
|
Auto-mount directory
|
/lib
|
Shared libraries and kernel modules are stored here
|
/lost + found
|
Back-up point for ext3 file system
|
/proc
|
Process information directory. It provides interface to kernel data structures
|
/tmp
|
Directory provided for storing temporary files
|
/sbin
|
Directory for storing only default system commands
|
/var
|
Varying file directory for storing regularly updating files
|
/opt
|
Optional directory for installing additional software
|
In practical cases, there could be more mount points than give in the above list
User types in linux
Linux has three types of users
1) Super-user
2) Normal-user
3) System user
Super-user in Linux is called “root”. Root user has complete previlage in Linux. Only he has the administratory power.
Normal user doesn’t have administrator power. Normal users have only a limited access. It is the root user which creates the normal user. In certain Linux OS there is no root user, like in Ubuntu, Linuxmint etc. In such cases we can use commands to give normal user an administrative privilage.
System users are the users created by applications in the system. For example in servers the application allows only authorised users to access its service.
Switching user interface in linux
Linux will boot into a default user interface, which is the GUI. We can then switch to TUI and also switch back from TUI to GUI.
Switching from GUI to TUI
Ctrl + Alt + F1 —– First TUI
Ctrl + Alt + F2 —– Second TUI
.
.
Ctrl + Alt + F6 —– Sixt user interface
Switching from TUI to GUI
Alt + F7
[header = Custom Installation]
Custom installation of Linux OS
If you have a good idea about the file system hierarchy, it won’t be difficult for you to install any Linux OS. In this section I will show you how to install Ubuntu.
Put the Ubuntu disk and restart the machine. Enter the Bios and select boot from CD option. As the Ubuntu boots, you can see the following screen.
After sometimes, a window appears asking whether you want to try Ubuntu before installation, or directly go to the installation procedure.
If you click the try Ubuntu button, you can install it later and you can see the Desktop of Ubuntu like this,
Now you can click the “Install Ubuntu” button to start the installation.
The next window will tell you about the minimum requirements for the Ubuntu installation. Click forward to proceed.
For custom installation, I mean to install by creating and resizing partitions, you should select “something else”. Click forward to proceed.
Now select the drive space in which you wish to install the Ubuntu. The complete disk space will be shown. I’ve selected /dev/sda, as my disk is empty. Now click the new partition table for partitioning.
he following warning window will appear, click “continue”.
The complete free space will be shown. Click “Add”.
Now “create partition” window will appear. Select the mount point as boot. A size of 3GB (3000 MB) is enough for the boot files. Click “OK” to proceed.
Now select the remaining free space and click “Add”.
This time allocate space for “/”. Allocate 15GB or more space and click “OK”
Now it is important to allocate some space for “/home”. Allocate some 20GB, and it depends upon the purpose for which you are going to use the OS. If you want to install so many applications, you need lot of GBs. Click “OK” to continue.
Now you need to add some swap area. Swaps are regions in which the inactive part of a running program will be backed up, and restore whenever it is needed. This is called virtual memory. Now the total memory space available for a running program is the sum of physical memory (RAM) and the virtual memory.
When you click “OK”, the next screen will show you the partitions that you’ve selected.
Now click “Install Now”.
While installing, you will be asked to enter certain information.
First select your time zone. Click “forward”.
Select the required keyboard layout. Click “forward”.
Enter your name, user name, password etc. Click “forward”.
Now there will be a display of all the available features, one by one.
When the installation completes, the following will appear. Click the “Restart Now” button.
Shells in Linux
The shells allow user to directly communicate with the kernel. Shells form the most important part of TUI or terminal or console. A shell can be described as a command line interpreter.
All the strings that we enter the command line are actually input to that particular shell. Based on the inputs, it will execute the corresponding process.
The major shells available in the Linux are,
Bash – Bourne again shell
Ksh – K shell
Csh – C shell
TCsh – Turbo C shell
In Linux, by default we are logging into the Bash shell.
After log in the Bash shell looks like the following. Go through the labels in the figure to learn more.
Basic commands
This section will show you the execution of some basic commands in the Bash shell.
uname –r
Type and enter the following will display the current kernel version.
Here the current kernel version is displayed below the entered command.
pwd
Present working directory. It will show you in which directory are you currently working on.
ls
List command. It will list the contents of the current directory. If no path is given it will list the files in the current directory.
Syntax: ls path of the directory to be listed
mkdir
Make directory. It will create a new directory; the following shows the creation of a new directory called “my_linux”.
Syntax: mkdir path of directory to be created
Another example of creating a directory called “abc”, and listing the current directory to find the abc.
You can see different colours for different names. By default the colours means:
White – Files
Blue – Folders
Green – Executable
Pink – Pictures
Red – Zip folders
cd
Change directory. It is used to change the working directory.
Syntax: cd path of directory into which to be changed
Following shows the changing into and listing of the directory abc.
cat
Create a text. It can be used to create and edit a text file.
To create a text file
Syntax: cat > filename
To open a text file
Syntax: cat filename
The following shows a basic usage of cat command
cp
Copy paste. It is used to copy files and folders
Syntax: cp source path destination path
In the above example a file calles “new_text” is copied into the same directory with a different name “new_text2”.
mv
Move command. This command is used to cut paste a file or folder into any directory.
Syntax: mv source path destination path
The same command can be used to rename a file or directory by moving them into the same directory with a different name.
In the above example the name of new_text2 is changed into new_text3.
rm
Remove command.
This command is used to remove a file or directory.
Syntax: rm path to be removed
An example of usage of rm command is shown below.
man
Manual of all commands. This command when used with a standard command, will shows you the manual page of that command, which includes all the details about that particular command.
Syntax: man command
Example : man ls ( will show you how to use ls command )
man man ( will show you how to use the manual itself )
[header = Few important Commands]
A few important commands
Command
|
Usage
|
adduser
|
Command for creating a new user
|
apt-get
|
Command for searching and installing software packages
|
bzip2
|
Command for compressing or decompressing files
|
chmod
|
Access permission of files can be changed using this command
|
clear
|
Terminal can be cleared using this command
|
df
|
Command for displaying free disk space
|
dmesg
|
Command for printing kernel messages
|
echo
|
To Display a string on the terminal
|
exit
|
Exit the shell
|
find
|
Search and find files
|
grep
|
Files can be searched with patterns matching their contents
|
gzip
|
Command for compressing a files
|
gunzip
|
Command for decompressing a file
|
kill
|
Command for stopping a process
|
killall
|
Command for stopping a process by their name.
|
locate
|
Another command for finding files
|
ls
|
Command for listing contents of a directory
|
man
|
Show the manual for a command
|
mkdir
|
Command for making new directory
|
mount
|
Use to mount a file system
|
mv
|
Cut and paste or rename files or directories
|
open
|
Command for opening a file in its default application
|
passwd
|
Helps to modify a user password
|
poweroff
|
Command for shut down the system
|
pwd
|
Command for print the working directory
|
reboot
|
Command for restarting the system
|
rm
|
Use to remove files
|
rmdir
|
Use to remove directories
|
uname
|
Command for printing system information
|
useradd
|
Helps to create a new user
|
vim
|
Command for opening vim text editor
|
whoami
|
Print the details of the current user
|
Terminal in Linux
Terminal is a TUI in GUI. It is actually a tool in the GUI for command line access. It is just like command prompt in Windows.
To get terminal, just Right click > “open in terminal” or Accessories > “Terminal”
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.