Linux Mayank Jaiswal 2
Linux Mayank Jaiswal 2
Indore
Department of Information Technology
Submitted To Submitted By
Ms. Anjali Kayat Mayank Jaiswal
Assistant Professor 0822IT211028
Department’s Vision and Mission
Mission:
M1: To provide students with Innovative and research skills, which is need of the hour for
technical students.
M2: To impart knowledge to the students of Information Technology with relevant core
and practical knowledge inculcating real time experience in the promising field of
computing.
M3: To prepare the graduates to meet information technology challenges with a blend of
social, human, ethical and value based education.
M4: To engage in emerging research areas and establishing leadership.
M5: To contribute to the community services at large as well as catering to socio-
economic goals in local and national levels.
PROGRAM OUTCOMES (POs)
PO1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals,
and an engineering specialization to the solution of complex engineering problems.
PO2. Problem analysis: Identify, formulate, research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.
PO3.Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
PO4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
PO5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
PO6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
PO7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
PO8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
PO9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11. Project management and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
PO12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change .
PROGRAM EDUCATION OBJECTIVES (PEOs)
PEO-III: Design and Analysis : Graduates will demonstrate good breadth of knowledge
in core areas of Information Technology and related engineering so as to comprehend
engineering trade-offs, analyze, design, and synthesize data and technical concepts to
create novel designs in solving the real life problems.
After the completion of this course, the students will be able to:
S. Date of Date of
Name of Experiment Experiment Submission
Signature Remark
NO
Installation of Linux OS using
1. CD,DVD,USB drive.
2. Choose installation options to install opens USE 12.3 on you system. Please select openSUSE 12.3
GNOME Live options to test it, before installation.
7. File system partitioning. We opted default file system partition. You may choose manual file system
partitioning as options provided.
8. Create new user and its password. Uncheck all three options. Click on change to select authentication
method.
9. Please select authentication method and click on Accept.
14. Installation completed, remove installation media and click on Reboot Now.
15. Post installation.
16. Login screen. Supply password for user created during installation.
17. OpenSUSE 12.3 Desktop. OpenSuse
STANDARD PROCEDURE:
Start the Linux and enter the user name and password.
Now write startx and after that open the terminal.
At the terminal try the different commands and see the output.
The exercises in this lab cover the usage of some of the most basic system
utilities that users and administrators alike need to be familiar with. Most of the
commands are used in navigating and manipulating the file system.The file
system is made up of files and directories.
THEORY:
1) pwd COMMAND:
pwd - Print Working Directory. pwd command prints the full filename of
the current working directory.
SYNTAX:
The Syntax is
pwd [options]
2) cd COMMAND:
cd command is used to change the directory.
SYNTAX:
The Syntax is
cd [directory | ~ | ./ | ../ | - ]
ls COMMAND:
ls command lists the files and directories under current working directory.
SYNTAX:
The Syntax is
ls [OPTIONS]... [FILE]
OPTIONS:
-l Lists all the files, directories and their mode, Number of links,
owner of the file, file size, Modified date and time and filename.
-t Lists in order of last modification time.
-a Lists all entries including hidden files.
-d Lists directory files instead of contents.
-p Puts slash at the end of each directories.
-u List in order of last access time.
-i Display inode information.
3) rm COMMAND:
rm linux command is used to remove/delete the file from the directory.
SYNTAX:
The Syntax is
rm [options..] [file | directory]
OPTIONS:
4) mv COMMAND:
mv command which is short for move. It is used to move/rename file
from one directory to another. mv command is different from cp command as
it completely removes the file from the source and moves to the directory
specified, where cp command just copies the content from one file to another.
SYNTAX:
The Syntax is
mv [-f] [-i] oldname newname
OPTIONS:
5) cat COMMAND:
cat linux command concatenates files and print it on the standard output.
SYNTAX:
The Syntax is
cat [OPTIONS] [FILE]...
OPTIONS:
-A Show all.
-b Omits line numbers for blank space in the output.
-E Displays a $ (dollar sign) at the end of each line.
-n Line numbers for all the output lines.
6) cmp COMMAND:
cmp linux command compares two files and tells you which line numbers are
different.
SYNTAX:
The Syntax is
cmp [options..] file1 file2
OPTIONS:
-l Print the byte number (decimal) and the differing byte values
(octal) for each difference.
-s Prints nothing for differing files, return exit status only.
7) cp COMMAND:
cp command copy files from one location to another. If the destination
is an existing file, then the file is overwritten; if the destination isan existing
directory, the file is copied into the directory (the directory is notoverwritten).
SYNTAX:
The Syntax is
SYNTAX:
The Syntax is
echo [options..] [string]
11)mkdir COMMAND:
mkdir command is used to create one or more directories.
SYNTAX:
The Syntax is
mkdir [options] directories
OPTIONS:
SYNTAX:
The Syntax is
paste [options]
OPTIONS:
SYNTAX:
The Syntax is
rmdir [options..] Directory
OPTIONS:
-P Allow users to remove the directory dir name and its parent
directories which become empty.
Experiment : -3
Question :3 ) Study and use of command for performing arithmetic operation with linux.
THEORY:
There are various operators supported by each shell. Our tutorial is based on default
shell (Bourne) so we are going to cover all the important Bourne Shelloperators in
the tutorial.
There are following operators which we are going to discuss:
Arithmetic Operators.
Logical Operators.
String operators.
File operators
Relational operators.
But in this section we are only concentrating on only arithmetic operators
Arithmetic Operators:
1. Open a text editor and create a new file. Let's name it `arithmetic_operations.R`.
2. In the file, you can write your arithmetic operations using R syntax. Here are a few examples:
4. Open the terminal and navigate to the directory where the `arithmetic_operations.R` file is
located.
5. Execute the R script using the command `Rscript arithmetic_operations.R`. This will run the
script in the R interpreter and display the results in the terminal.
The script will perform the arithmetic operations you specified and print the results in the
terminal. You can modify the arithmetic expressions or add more operations as per your
requirements.
Experiment : -4
Question :4) To create a file called "cc.txt" with some lines and display the number of lines,
words, and characters present in that file, you can follow these steps:
2. Create a new file named "cc.txt" and add some lines of text. For example, you can use the
following lines:
This is line 1.
This is line 2.
This is line 3.
3. Save the file as "cc.txt" in a directory of your choice. Make sure to note down the file's
location.
4. Open a terminal window and navigate to the directory where the "cc.txt" file is located using
the `cd` command. For example, if the file is in the "Documents" directory, you can use the
following command:
5. Once you are in the correct directory, you can use the following command to display the
number of lines, words, and characters in the file:
The `wc` command is used to count lines, words, and characters in a file. By providing the
filename (`cc.txt` in this case) as an argument to the `wc` command, it will display the line
count, word count, and character count for that file.
6. After running the `wc` command, you will see the output that includes the number of lines,
words, and characters in the "cc.txt" file:
The output is separated by spaces, where the first number represents the number of lines, the
second number represents the number of words, the third number represents the number of
characters, and the last part is the filename.
That's it! You have created the "cc.txt" file, and you have displayed the number of lines, words,
and characters present in the file using the `wc` command.
Experiment : -5
Question :5) Give two files each of which contain name of student . create a program to only
those names that are found on both the files .
1. Create two text files, let's name them `file1.txt` and `file2.txt`, and populate them with names.
Each name should be on a separate line.
`file1.txt`:
`file2.txt`:
2. Open a text editor and create a new file. Let's name it `find_common_names.R`.
3. In the file, write the R code to read the contents of the two files, compare the names, and find
the common names.
4. Save the file (`find_common_names.R`).
5. Open the terminal and navigate to the directory where the `find_common_names.R` file and
the two text files (`file1.txt` and `file2.txt`) are located.
6. Execute the R script using the command `Rscript find_common_names.R`. This will run the
script in the R interpreter and display the common names in the terminal.
The program reads the contents of both files, compares them, and prints the common names
found in both files. In this example, the names "Alice" and "David" are present in both `file1.txt`
and `file2.txt`. You can modify the file names and their contents as needed for your specific use
case.
Experiment: -6
Question: 6) Study and use of command for changing the permission in Linux .
In Linux, the "chmod" command is used to change the permissions of files and directories. The
"chmod" command allows you to modify the read (r), write (w), and execute (x) permissions for
the owner, group, and others.
Here are some commonly used options and examples for changing permissions:
This adds execute permission for the owner and group (+x) and removes write permission
for others (-w).
4. Recursive mode:
- The "-R" option allows you to change permissions recursively on directories and their
contents.
- Example: To change the permissions of a directory and all its files and subdirectories, you
can use the command:
This sets the permissions to 755 (rwxr-xr-x) for the directory and all its contents.
It's important to note that changing permissions can affect the security and functionality of files
and directories. It's recommended to understand the implications and use caution when
modifying permissions.
Experiment No.07
Aim:- Execute shell command through vi editor.
The vi editor is also known as visual editor. It is user-friendly and works same on different
platforms. The vi editor
tool is an interactive tool as it displays changes made in the file on the screen while you edit the
file.In vi editor
you can insert, edit or remove a word as cursor moves throughout the file.
In the terminal when you'll type vi command with a file name, the content of the file will be
displayed. If there is
no such file, then a new file will be created .
Example
we are creating a new file f.txt as this file doesn't exist and have entered the full path for the
directory Documents.
vi /home/cloudera/Documents/f.txt
Command mode : by default vi editor is in command mode.S
Insert mode: To be in insert mode we need to press “ i ”
Commands Action
:w Save
:q Quite
press escape (esc ) and then :wq will save and quit the vi editor. When you'll type it in command mode,
it will automatically come at bottom left corner. If you want to quit without saving the file, use :q
File is modified and hence on typing :q file can be saved with the command.
“!q” It discards the changes made in the file and save it.
Example : let create a program file named as “abc.sh”.then write a program in it and then save it by
pressing “esc :wq!”.then run the program by passing “sh abc.sh” command to terminal.
Experiment: -8
Question: 8) Write a shell script that accepts any number of argument and print them in the
reverse.
Save the script with a desired name, such as "reverse.sh". Make sure to give it execute
permissions using the following command:
You can then run the script by providing any number of arguments. For example:
The script will print the arguments in reverse order:
The script uses a loop to iterate through the arguments array in reverse order, starting from the
last element. It then echoes each argument, printing them in reverse order.
Experiment: -9
Aim :-Write a shell script to find the smallest of three no. that are read from the keyboard.
Program 1
echo "enter a: "
read a
echo "enter b : "
read b
echo "enter c : "
read c
s=$a
if [ $b -lt $s ]
then
s=$b
fi
if [ $c -lt $s ]
then
s=$c
fi
echo Smallest of $a $b $c is $s
Output
Program 2
echo "enter a: "
read a
echo "enter b: "
read b
echo "enter c: "
read c
if [ $a -le $b -a $a -le $c ]
then
echo "a is Smallest"
elif [ $b -le $c -a $b -le $a ]
then
echo "b is Smallest"
else
echo "c is Smallest"
fi
Output
Experiment No.10
Aim: - Write a shell script that report the logging in of a specified user within one minute after he/she
logs in. The script automatically terminates if the specified user does not login during a specified
period of time.
done
echo "he is there"