Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Unix Lab Roll No: 121A3023

Name: Kshitij Sakpal PRN: 121A3023 Batch: E1

Experiment 2
AIM:
To execute basic Unix – Linux commands and working with VI editor.
THEORY:
The Linux command is a utility of the Linux operating system. All basic and
advanced tasks can be done by executing commands. The commands are
executed on the Linux terminal. The terminal is a command-line interface to
interact with the system, which is similar to the command prompt in the
Windows OS. Commands in Linux are case-sensitive.
Linux provides a powerful command-line interface compared to other operating
systems such as Windows and MacOS. We can do basic work and advanced
work through its terminal. We can do some basic tasks such as creating a file,
deleting a file, moving a file, and more. In addition, we can also perform
advanced tasks such as administrative tasks, security tasks, and many more.
Linux terminal is a user-friendly terminal as it provides various support options.
To open the Linux terminal, press “CTRL+ALT+T” keys together, and execute
a command by pressing the ‘ENTER’ key.
Some of the most used Linux command are:
1. Whoami
It tells you about the system’s username.
2. Time
The time command is used to display the time to execute a command.
3. Echo
Used to display line of text/string that are passed as an argument.
4. Pwd
The pwd command is used to display the location of the current working
directory.
5. Ls
The ls command is used to display a list of content of a directory. There is
various type of ls command present in Linux. They are given below:
 Ls-F
It is used to add “/” at the end of each directory. This command will help
you to distinguish directories from files.

1
Unix Lab Roll No: 121A3023

 Ls-m
It is used to print the files and directories separated by a comma.
 Ls-Q
It is used to add quotation marks to all directories and files.
 Ls-i
It is used to get the inode(index node) number of all directories and files.
 Ls-l
It is to display the files and directories in an extended format, including
the permissions, owner, group, size and modification date of each file,
along with the file’s name or directory.
6. Cat
The cat command is a multi-purpose utility in the Linux system. It can be used
to create a file, display content of the file, copy the content of one file to another
file, and more.
7. Cal
The cal command is used to display the current month’s calendar with the
current date highlighted.
8. Cal 2023
This command is used to display all the month of the assigned year.
9. Man ls
Used to display the user manual of any command that we can run on the
terminal.
10.Pr
Writes a file to standard output.
11.History
Used to view the previously executed command.
12.Ifconfig
Used to configure the kernel-resident network interfaces.

RESULT:
1. Whoami

2
Unix Lab Roll No: 121A3023

2. Time

3. Echo

4. Pwd

5. Ls

3
Unix Lab Roll No: 121A3023

6. Cat

7. Cal

4
Unix Lab Roll No: 121A3023

8. Cal 2023

5
Unix Lab Roll No: 121A3023

9. Man ls

10.pr

6
Unix Lab Roll No: 121A3023

11.History

7
Unix Lab Roll No: 121A3023

12.Ifconfig

CONCLUSION:
Hence, executed the basic Unix – Linux command successfully.

8
Unix Lab Roll No: 121A3023

AIM:
Working with VI editor.
THEORY:
The VI editor is elaborated as visual editor. It is installed in every Unix system.
In other words, it is available in all Linux distros. It is user-friendly and works
same on different distros and platforms. It is very powerful application.
The VI editor has two modes:
 Command Mode: In command mode, actions are taken on the file. The
VI editor starts in command mode. Here, the typed words will act as
commands in VI editor. To pass a command, you need to be in command
mode.
 Insert Mode: In inset mode, entered text will be inserted into the file.
The ESC key will take you to the command mode from insert mode.
By default, the VI editor starts in command mode. To enter text, you have to be
in insert mode, just type ‘i’ and you will be in insert mode. Although, after
typing i nothing will appear on the screen but you will be in insert mode. Now
you can type anything.
To exit from insert mode press ESC key, you will be directed to command
mode.
RESULT:
1. Creating a file in VI.

9
Unix Lab Roll No: 121A3023

2. Entering text in the created VI file.

3. Viewing the created VI file using the ls command.

CONCLUSION:
Hence, successfully created a file VI and inserted text in it.

10

You might also like