Professional Documents
Culture Documents
(m2) (Eng) Os Process, Vi Text Editor, and Network Configuration
(m2) (Eng) Os Process, Vi Text Editor, and Network Configuration
Operating System
Fundamental
2021
Module 2
OS Process, Vi Editor and
Network Configuration
ASSISTANT
Ananda Anggie Nur Aini
GIE
Farras Naim
RAS
Muliya Dewi
MYD
Nurul Annisa
ICE
Rizal Indera
RZL
Rizky Fadilah
RIZ
I. Practicum Objectives
1.1 Practicant is able to understand the Operating System process.
1.2 Practicant is able to understand the definition, usage, and utilization of Text Editor
1.3 Practicant is capable to operate Text Editor
1.4 Practicant is capable of perorm Network Configuration
STATUS Explanation
New The process is being created.
The process is ready to execute but the CPU is not yet available
Ready because it is working on another process.
The process is waiting for a specific event. For example,
Waiting
waiting for the I/O operation to complete.
The process is executed. At this status the CPU is executing
Running the instructions on the process.
Terminated The process ends.
1
3.1.2 Process Creation Concept
The concept of process creation on Linux operating systems:
a. Each process is assigned a special number as identification called
Process Identification or PID in the form of a unique integer number.
b. If the process is completed (Terminated) then all resources used
including PID are freed back.
c. The process is created using a call system fork() often called forking
the process.
d. System call fork(), copy the caller process so that there are two
processes, namely PARENT (caller process) and CHILD (copy
process).
e. The CHILD process is identical to its PARENT process but has a
different PID.
f. After a new process (CHILD) is successfully executed resumed
normally in each process on the line after the system call fork() call.
g. The caller process (PARENT) can forking the process more than once,
allowing many CHILD processes to be executed. Child process can
forking the process as well as PARENT so that it can form the
structure of the process tree.
a. Command “ps”
Process Status or "ps" command is used to display the current
process on the system. This command has a disadvantage of not being
interactive. To execute the command "ps" can be done on the terminal
in the following ways:
[root@sisjarlab sisjar]#ps
2
Image 2.1 “ps”command after executed
b. Command “top”
“top” command is used for managing Linux process without
using GUI. When executed, it will display a list of all running processes
and every second will be updated (default scanning is 3 seconds). This
command is more interactive than the "ps" command. To execute the
"top" command can be done on the terminal in the following ways:
[root@sisjarlab sisjar]#top
3
c. Command “kill”
In certain cases, we can stop the process forcibly, for example,
when the resource usage from a process is too high. To execute the “kill”
command, it could be done on the terminal in the following ways :
[root@sisjarlab sisjar]#kill [-signal] [PID]
Example:
[root@sisjarlab sisjar]#kill -9 23112
Explanation: the discontinued process is the top process with PID 23112.
[-signal] is a specific parameter sent to the process. We can use a signal
with a number (such as 9) or a name (such as SIGKILL). 9 or SIGKILL
causes the exit process without shutdown the task.
4
3.3 Variant
3.3.1 Nano Editor
GNU Nano is a text editor used on Unix-based operating systems,
the Nano view editor using the Command Line Interface. Nano is a clone
of Pico so it aims to emulate the functionality and easy use of Pico's
interface. Unlike Pico, Nano editors are licensed under the GNU General
Public License (GPL) and released as free software.
a. Commands and How it Works
Nano editor can be used easily, so users can type directly to
enter text. The nano editor uses the control key as its way of operation,
so it's called keyboard-oriented. If the user is confused in the use of
Nano editor can by way of Ctrl+G then it will be taken to the help page.
To enter into nano editor can be done by entering the following
command in the terminal:
[root@sisjarlab sisjar]#nano [FileName]
Example:
[root@sisjarlab sisjar]#nano pantun.txt
5
Image 2.5 Characteristic of Nano Editor
3.3.2 Vi Editor
Vi editor is one of the text editors originally created for the Unix
operating system. The name Vi (pronounced "vee-ai") is derived from the
visual abbreviation. Vi editor itself is a fast and powerful text editor first
developed by William (Bill) Joy.
a. Commands and How it Works
Vi editor has a screenoriented way of operating using the
terminal text editor. The vi editor operation is divided into three modes,
including Command Mode, Insert Mode, and Command-Line Mode.
Each mode shift can only be done in Command Mode, so it does not
allow Insert Mode to move to Command-Line Mode without going
through Command Mode first and vice versa. Here's an explanation of
each mode:
1. Command Mode
This mode is the initial mode when Vi editor is run.
Functions that can be performed in this mode include navigating
using cursors on written files, editing lines and words, and as a
reference to mode shifts. Unlike other modes, commands in this
mode can be executed without the need to press enter. To enter into
Vi editor can be done by entering the following command in the
terminal:
[root@sisjarlab sisjar]#vi [FileName]
Example:
[root@sisjarlab sisjar]#vi lyrics.txt
6
Image 2.6 Command on the terminal
7
The commands that can be run in this mode are :
Table 2.2 Command in Command Mode
Command Description
Search
Repeat the previous search on the cursor and
n
afterwards.
Repeat previous search on cursor and previous
N
Delete
dd Delete all text in cursor line.
ndd Remove all n number text on cursor line.
D Delete all text aftercursor.
dw Delete the word on the cursor is located.
Remove the n-word on the cursor and
ndw
afterwards.
x Remove characters in cursor.
Remove n characters on cursor and
nx
afterwards.
X Remove characters before cursor.
Delete words in cursor while moving to
cw
Insert Mode.
Replace (→ Then type)
r→n Replace characters on cursor with n.
Replace characters on cursor and afterwards a
nr → x
number of n with x characters. .
Append (→ Then type)
Add n after cursor at once
a→n
berpindah ke Insert Mode.
Line
Add a new row after the cursor row is at once
o
moving into Insert Mode.
Add a new row before the cursor row is at once
O
Moving into Insert Mode.
8
Undo/Repeat
U Undo activity on cursor row is located.
. (dot) Do the previous command on cursor.
Copy/Paste
yy Copy the row on the row where the cursor is
located.
Copy row number n on cursor row is located and
nyy
after.
Add the contents of the clipboard to the cursor
p
and afterwards.
Cursor
Key → Move the cursor to the right.
Key ← Move the cursor to the left.
Key ↑ Move the cursor up.
Key ↓ Move the cursor down.
Move the cursor to the end of the cursor
$ atau [end]
row.
Move the cursor to a sentence after the cursor
w
position.
Move the cursor to a sentence before the cursor
b
position.
Any use of the above command in both capital and non-
capital letters is case sensitive.
2. Insert Mode
Insert Mode is a mode that has a function to insert typed
characters into a previously created file. Commands in Command
Mode and Command-Line Mode will not work
After successfully creating a file and entering in Command
Mode, to switch mode to Insert Mode press the letter [i] on the
keyboard, then write a word or sentence on the file.
9
Image 2.8 Insert Mode Vi Editor
3. Command-Line Mode
This mode has a wider scope of functions in manipulating
or editing files as a whole. To enter this mode, enter the characters
":" or "/" or "?" and then the command to use. To check if it has
entered Command-Line Mode is to look at the bottom of the Vi
editor where the cursor will move to the bottom row along with the
character that has been typed. Unlike Command Mode, this mode
will execute the command after pressing enter. This mode cannot
execute more than one command line. In the image below the
command entered is a command to save the file and exit vi editor.
10
Image 2.9 Display Command-Line Mode
Command Description
W Save file changes
Save file changes and ignore errors that appear
w!
in the process
Q Quit Vi editor
Quit Vi editor and ignore errors that appear in
q!
the process
Save file changes then exit Vi editor
wq
/n Search for a character or n-word after cursor
?n Find the character or n-word before the cursor
Find the character or n-word after the cursor,
/s/n/m
then replace it with m
Contoh:
[root@sisjarlab sisjar]#cat lyrics.txt
11
Image 2.10 Tampilan isi file dengan command “cat”
3.4.2 IP Addressing
a. Network Manager Command Line Interface (NMCLI)
NMCLI is a command line tool to control Network Manager.
This NMCLI tool can be used to add or create new IP addresses, modify
available IP addresses, and remove IP addresses. Changes to the
NMCLI are temporary, so that when the operating system restarts, the
IP address configuration will return in its original state.
b. Network Manager Text User Interface (NMTUI)
NMTUI is a TUI application that is installed by default on
CentOS that is used to modify ip addresses on CentOS. Changes to
NMTUI are permanent and it is highly recommended to use them.
12
IV. Lab Praktik
4.1 Text Editor
4.1.1 Vi Editor
Toni is a student majoring in Indonesian Literature, in a course, Toni is given
the task of writing a poem by Chairil Anwar. Toni chose a poem entitled
"Krawang-Bekasi". Using Vi Editor Toni writes the verse and saves it with
the file name SYAIR.txt.
When finished writing the poem and save it. Toni remembered that
the poem had additional verses, so Toni created a new file with the name
Tambahan.txt and then saved it.
After finishing writing the poem, Toni put it all together file into a
file named KRAWANGBEKASI.txt.
13
4.2 Network Configuration
4.2.1 Identificationi Ethernet Interface
To be able to identify can be done in the following ways.
a. How to Identify Ethernet Interfaces
To identify available ethernet interfaces, use the command:
[root@sisjarlab sisjar]#ip address
Or:
[root@sisjarlab sisjar]#ip address show
Image 2.11 Ens33 interface display before being given IP address settings
14
Image 2.12 Command to add IP address on ens33 interface
15
4.2.3 Configuring IP Address Using NMTUI
Here are the steps to configure with NMTUI.
a. Enter the NMTUI command as follows.
b. It appears to look like the following. To edit the IP address, select Edit a
connection by pressing the enter key.
16
c. Next, an interface appears. To configure Ethernet, select ens33 and use the right
arrow key to select . Press Enter.
d. The following view will appear. Select IPv4 Configuration and change
<Automatic> to <Manual>.
17
Image 2.20 Change IPv4 Configuration to <Manual>
18
e. Next, fill in the IP in the Addresses field, and the DNS server as following
image.
19
g. To activate a preconfigured interface, select Activate a connection in the main
menu.
20
h. Next, there will be a selection of available interfaces. Select the interface
that you want to enable, and point the option to <Activate>. (If the status
already <Deactivate>means the interface is already active)
21
i. To check the preconfigured IP address, enter the following command:
[root@sisjarlab sisjar]#ip address show
j. Ping to ip 10.220.19.1 and press ctrl+c to stop it. If the display as shown below
then ping is successfull.
22
V. Bibliography
1. Laboratorium Sistem Operasi dan Jaringan Komputer. (2015). Modul Praktikum
Sistem Operasi 2015. Bandung, Laboratorium Sistem Operasi dan Jaringan
Komputer.
2. Laboratorium Sistem Operasi dan Jaringan Komputer. (2016). Modul Praktikum
Sistem Operasi 2016. Bandung, Laboratorium Sistem Operasi dan Jaringan
Komputer.
3. Laboratorium Sistem Operasi dan Jaringan Komputer. (2019). Modul Praktikum
Sistem Operasi 2019. Bandung, Laboratorium Sistem Operasi dan Jaringan
Komputer.
4. Laboratorium Sistem Operasi dan Jaringan Komputer. (2019). Modul Praktikum
Sistem Operasi 2020. Bandung, Laboratorium Sistem Operasi dan Jaringan
Komputer
5. Mallet, A. (2014). CentOS System Administration Essentials. Birmingham: Packt
Publishing Ltd.
6. Smith, Roderick W. (2009). CompTIA Linux+ Study Guide. Indianapolis: Wiley
Publishing, Inc.
23