Linux Journal (2020) (E-Next - In)
Linux Journal (2020) (E-Next - In)
Practical No 1
Aim: Linux Installation
1. Linux
Linux is open-source, free to use kernel. It is used by programmers, organizations, profit and non-
profit companies around the world to create Operating systems to suit their individual requirements.
Ubuntu
This is the third most popular desktop operating system after Microsoft Windows and Apple Mac
OS. It is based on the Debian Linux Distribution, and it is known as its desktop environment.
This is one of the easiest methods of installing Ubuntu or any distribution on your computer. Follow
the steps.
Step 1) Download the .iso or the OS files on your computer from this
https://www.ubuntu.com/download/desktop.
https://E-next.in
Linux Journal
Step 2) Download free software like 'Universal USB installer to make a bootable USB stick.
Step 3) Select an Ubuntu Distribution form the dropdown to put on your USB
Select the drive letter of USB to install Ubuntu and Press create button.
https://E-next.in
Linux Journal
Step 5) After everything has been installed and configured, a small window will appear
Congratulations! You now have Ubuntu on a USB stick, bootable and ready to go.
https://E-next.in
Linux Journal
Those who like the way a CD runs should try using this method.
(image source)
Step 1) Download the .iso or the OS files onto your computer from this
link http://www.ubuntu.com/download/desktop.
Step 3) Boot your computer from the optical drive and follow the instructions.
https://E-next.in
Linux Journal
a. Click the downward arrow located at the top right corner of your Ubuntu desktop
and then click the settings icon located at the bottom left corner:
https://E-next.in
Linux Journal
c. You can also open the Settings utility from the list of applications through the Show
Applications button.
d. In order to change your Desktop or Lock screen backgrounds, move to the Background tab
in the Settings window and click on either the Background or Lock Screen option from the
menu:
e. You can choose a picture as a background either from the available list of wallpapers,
upload one from your system, or use solid colors as your background.
https://E-next.in
Linux Journal
Practical 2
Are you on a wired or wireless connection? What wireless networks are available,
if any.
3) Time settings: Change the time zone of your system to (or New York Time if you are currently in Indian
time). How does the displayed time change? After noting the time change, change the time zone back to your
local time zone.
1. Screen resolution:
The resolution is the number of pixels (dots on the screen) in each direction that can be displayed.
Each resolution has an aspect ratio, the ratio of the width to the height. Wide-screen displays use a
16∶9 aspect ratio, while traditional displays use 4∶3. If you choose a resolution that does not match
the aspect ratio of your display, the screen will be letter boxed to avoid distortion, by adding black
bars to the top and bottom or both sides of the screen.
You can change how big (or how detailed) things appear on the screen by changing the
screen resolution. You can change which way up things appear (for example, if you have a
rotating display) by changing the rotation.
Open the Activities overview and start typing Settings.
Click on Settings.
Click Devices in the sidebar.
Click Displays in the sidebar to open the panel.
If you have multiple displays and they are not mirrored, you can have different settings on
each display. Select a display in the preview area.
Select the resolution or scale and choose the orientation.
Click Apply. The new settings will be applied for 20 seconds before reverting back. That
way, if you cannot see anything with the new settings, your old settings will be
automatically restored. If you are happy with the new settings, click Keep Changes.
https://E-next.in
Linux Journal
For example:
2. Networking:
To set up most wired network connections, all you need to do is plug in a network cable.
The wired network icon ( ) is displayed on the top bar with three dots while the
connection is being established. The dots disappear when you are connected.
If this does not happen, you should first of all make sure that your network cable is plugged
in. One end of the cable should be plugged into the rectangular Ethernet (network) port on
your computer, and the other end should be plugged into a switch, router, network wall
socket or similar (depending on the network setup you have). Sometimes, a light beside the
Ethernet port will indicate that it is plugged in and active.
You cannot plug one computer directly into another one with a network cable (at least, not
without some extra setting-up). To connect two computers, you should plug them both into a
network hub, router or switch.
The steps are:
a) Open the settings.
b) Select the Network or Wireless Settings.
c) Select the network you want to use and enter the password.
https://E-next.in
Linux Journal
For example:
3. Time settings:
If the date and time displayed on the top bar are incorrect or in the wrong format, you can
change them:
1) Open the Activities overview and start typing Settings.
2) Click on Settings.
3) Click Details in the sidebar.
4) Click Date & Time in the sidebar to open the panel.
5) If you have Automatic Date & Time set to ON, your date and time should update
automatically if you have an internet connection. To update your date and time manually, set
this to OFF.
6) Click Date & Time, then adjust the time and date.
7) You can change how the hour is displayed by selecting 24-hour or AM/PM for Time
Format.
https://E-next.in
Linux Journal
For example:
https://E-next.in
Linux Journal
Practical 3:
Aim: Installing and Removing Software:
1. Install gcc package. Verify that it runs, and then remove it.
It stands for GNU compiler collection.
A compiler is computer software that transforms computer code written in one programming
language into another programming language. Compilers are a type of translator that support digital
devices, primarily computers.
These are used for smart, quick, compilation of programming languages without having the actual
compilation software.
Its other version is called extended GCC was developed for supporting C++ compilation.
As end number of languages have evolved , the GNU foundation has created a collection of
compilations called GCCS which supported the front-end support for java, FORTRAN, Ada
1. To install gcc:
Step 1: Open the terminal in Ubuntu
Syntax:
//WAP a program to print hello world
#include <stdio.h>
void main()
printf("Hello World");
Compilation Method:
./hello.out
https://E-next.in
Linux Journal
Output:
Syntax:
//WAP to find the factorial
#include <stdio.h>
void main()
int n,f=1;
printf("Enter a number");
scanf("%d",&n);
while(n>0)
f=f*n;
n--;
Compilation Method:
./hello.out
Output:
https://E-next.in
Linux Journal
Syntax:
//WAP to perform basic arithmetic.
#include <stdio.h>
void main()
int n,a,b,c;
printf("Menu");
printf("\n1)Addition");
printf("\n2)Subtraction:");
printf("\n3)Multiplication");
printf("\n4)Division");
scanf("%d",&n);
switch(n)
scanf("%d %d",&a,&b);
c=a+b;
printf("Addittion::%d",c);
break;
scanf("%d %d",&a,&b);
c=a-b;
break;
scanf("%d %d",&a,&b);
c=a*b;
break;
https://E-next.in
Linux Journal
scanf("%d %d",&a,&b);
c=a/b;
break;
Compilation method:
./hello.out
Output:
3. To remove gcc:
Step 1: To completely remove gcc execute the following command:
https://E-next.in
Linux Journal
Practical 5
https://E-next.in
Linux Journal
4. Create a symbolic link to the file you found in the last step.
Command: ln -s ./etc/passwd
5. Create an empty file example.txt and move it in /tmp directory using relative path name.
6. Delete the file moved to /tmp in previous step using absolute path.
Command: rm /tmp/hi.txt
https://E-next.in
Linux Journal
Practical 7
Aim : Use environment
1. Which account are you logged in? How do you find out?
2. Display /etc/shadow using cat and understand the importance of shadow file. How is it
different than password file?
3. Get your current working directory
4. Explore different ways of getting command history, how to run previously executed
commands without typing it?
5. Create alias to most commonly used commands like.
1. Which account are you logged in? How do you find out?
Command : who
Output :
2. Display /etc/shadow using cat and understand the importance of shadow file. How is it
different than password file?
Command : sudo cat /etc/shadow
Output :
https://E-next.in
Linux Journal
4. Explore different ways of getting command history, how to run previously executed
commands without typing it?
Command : history
Output:
https://E-next.in
Linux Journal
Practical 8
Aim: Linux Editors: vim/emacs
1. Create, modify, search ,navigate a file in editor.
2. Learn all essential commands like search, search/replace, highlight, show line
numbers.
1. Create, modify, search navigate a file in editor.
i. Create : vi prac.txt
:i
This is practical 8
: wq
https://E-next.in
Linux Journal
2. Learn all essential commands like search, search/replace, highlight, show line
numbers.
i. Search : vi prac.txt
Ctrl+c
/new
:q!
https://E-next.in
Linux Journal
Practical 9
Aim: Linux Security:
1. Use of sudo to change user privileges to root
2. Identify all operations that require sudo privileges
3. Create a new user and add it to sudo configuration file.
4. Set password for new user.
5. Modify the expiration date for new user using password ageing.
6. Delete newly added user.
https://E-next.in
Linux Journal
5. Modify the expiration date for new user using password ageing.
Command: chage -M 28 CR7
Output:
https://E-next.in