You are on page 1of 8

Practice

(Performance Criteria)

Week1:
1. Types of OS installation
2. Boot methods
3 . File System and formatting
4. Post installation tasks

1. Types of OS installation:

 Attended installation: Here, someone is required to interact with the computer while executing
the installation process
 Silent installation: This means once the installation starts, the user is not offered any options to
change or edit the installation process.
 Unattended installation: The installation of a program without requiring the user to select options
or click next at the end of each step. It often use a file of predefined answers so that after starting
the installation, it runs to completion without further user intervention.
 Headless installation: A headless server is simply an operating system installed on a computer
without a monitor, mouse, keyboard, and other peripherals.
 Scheduled or automated installation: An installation process that runs on a preset time or when a
predefined condition transpires, as opposed to an installation process that starts explicitly on a
user's command.
 Clean installation: A clean install is a software installation in which any previous version is
eradicated.
 Network installation: Installing the NOS directly from the CD-ROM distribution discs on the
server's CD-ROM drive and shared harddisk from sever.

2. Boot methods: Cold Booting or Soft Booting & Warm Booting or Hard Booting.
Cold booting: When the computer is started after having been switched off.
Warm booting: When the operating system alone is restarted after a system crash or freeze.

3. File System and formatting: A file system is a major component of the operating system (OS). An
application command the OS to input and output data, and the file system reads and writes the sectors on
the storage drive. The file system manages the folder/directory structure and provides an index to the files.
APP-> OS-> File System-> Storage (HDD/SSD)

Formatting: Disk formatting is the process of preparing a data storage device such as a hard disk drive,
solid-state drive, floppy disk or USB flash drive for initial use. In some cases, the formatting operation may
also create one or more new file systems.

4. Post installation tasks: 1. Network Configuration, 2. Antivirus Installation, 3. Windows update, 4.


Installing Application Software’s.

Week 2:

1. Install and configure virtual machine- Virtual box/VMware, VMware player station.
2. Download and install a terminal emulator and connect Linux VM via TE(optional).
Significance of man command.
1. Install and configure virtual machine- Virtual box/VMware, VMware player station.

Install Virtual Machine eg: VMWare.

To install VMware Player on a Windows host:

I. Log in to the Windows host.


II. Open the folder where the VMware Player installer was downloaded. The default location is
the Downloads folder for the user account on the Windows host.
Note: The installer file name is similar to VMware-Player-xxxx-xxxx.exe, where xxxx-xxxx is
the version and build numbers.
III. Right-click the installer and click Run as Administrator.
IV. Follow the on-screen instructions to finish the installation.
V. Restart the host machine.

2. Download and install a terminal emulator and connect Linux VM via TE (optional). Significance of man
command. :

man command in Linux is used to display the user manual of any command that we can run on
the terminal. It provides a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION,
OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS and SEE ALSO.

Week 3:
File and Directory commands:
1. Create and delete directories and files, File movement, copy commands, Pipes (named & unnamed)
2. Commands for viewing File, File comparison, File manipulation, Altering file permission, File
compression and decompression.
3. Text processing commands.

File and Directory commands:


1. Create and delete directories and files, File movement, copy commands, Pipes (named & unnamed)

1. To create a Directory: type "mkdir <dir name>


2. To create a File: $ touch example.txt or $ cat > file1.txt followed by CRTL+D to save the files.
3. To delete directory: $ rmdir “dirname”(Empty), $rm -r dirname(Non-Empty)
4. To delete file: $rm “filename”. #$ rm filename1 filename2 filename3 for multiple files.
5. To Move the file : $mv example.txt to destination folder eg: mv 123.txt to ~/abc
6. To Move the directory: $mv directory to destination folder eg: mv directory to ~/abc
7.To copy the file: cp file name to destination folder eg:/ cp file to ~/abc
8. To copy the directory: $ cp -R <source_folder> <destination_folder>
9. Pipe: The pipe command lets you sends the output of one command to another
eg: $ echo “hello” >>pipe1-----in first terminal
$ tail -f pipe1-----in second terminal

2. Commands for viewing File, File comparison, File manipulation, Altering file permission, File
compression and decompression.

1. head / proc/cpuinfo- to view CPU information. (view file)


2. cat /proc/version-to version information. (view file)
3. cat file name-to view file ---eg: cat 123.txt. (view file)
4. diff filename1 filename2---eg :diff 123 abc. (file comparison)
5. mv file 1 file 2 dir1-----eg: mv 123 abc dir1(File manipulation)
6. Altering the file permission:-To change directory permissions in Linux, use the following: chmode
(Change mode)
ls –l : list all files with permssions
1.chmod +rwx filename to add permissions.
2.chmod -rwx directoryname to remove permissions.
3.chmod +x filename to allow executable permissions.
4.chmod -wx filename to take out write and executable permissions

Compress and decompress files using Gzip program

For compression

$ gzip ostechnix.txt : here Gzip will replace the original file ostechnix.txt with a gzipped compressed
version named ostechnix.txt.gz.

For decompression

$ gzip -c -d output.txt.gz > ostechnix1.txt

The above command decompresses the output.txt.gz file and writes the output to ostechnix1.txt file. In
both cases, it won't delete the original file.

3. Text processing commands:


Sort: sort lines of text files, this command is used to sort files.
$ cat ip.txt
6.2 : 897 : bar
3.1 : 32 : foo
2.3 : 012 : bar
1.2 : 123 : xyz

$ # -k3,3 means from 3rd column onwards to 3rd column


$ # for ex: to sort from 2nd column till end, use -k2
$ sort -t: -k3,3 ip.txt
2.3 : 012 : bar
6.2 : 897 : bar
3.1 : 32 : foo
1.2 : 123 : xyz

$ # -n option for numeric sort, check out what happens when -n is not used
$ sort -t: -k2,2n ip.txt
2.3 : 012 : bar
3.1 : 32 : foo
1.2 : 123 : xyz
6.2 : 897 : bar

$ # more than one rule can be specified to resolve same values


$ sort -t: -k3,3 -k1,1rn ip.txt
6.2 : 897 : bar
2.3 : 012 : bar
3.1 : 32 : foo
1.2 : 123 : xyz

uniq: report or omit repeated lines, specifies to recognizing duplicates. Options

 -d print only duplicate lines


 -c prefix count to occurrences
 -u print only unique lines

$ echo -e 'Blue\nRed\nGreen\nBlue\nRed\nBlack\nRed' | sort > sorted_colors.txt


$ uniq sorted_colors.txt
Black
Blue
Green
Red

$ uniq -d sorted_colors.txt
Blue
Red

$ uniq -cd sorted_colors.txt


2 Blue
3 Red

$ uniq -u sorted_colors.txt
Black
Green

comm: It prints output in three columns - lines unique to file1, line unique to file2 and lines common to
both files

Options

 -1 suppress lines unique to file1


 -2 suppress lines unique to file2
 -3 suppress lines common to both files

$ echo -e 'Brown\nRed\nPurple\nBlue\nTeal\nYellow' | sort > colors_1.txt


$ echo -e 'Red\nGreen\nBlue\nBlack\nWhite' | sort > colors_2.txt

$ # the input files viewed side by side


$ paste colors_1.txt colors_2.txt
Blue Black
Brown Blue
Purple Green
Red Red
Teal White
Yellow

 examples
$ # 3 column output - unique to file1, file2 and common
$ comm colors_1.txt colors_2.txt
Black
Blue
Brown
Green
Purple
Red
Teal
White
Yellow

$ # suppress 1 and 2 column, gives only common lines


$ comm -12 colors_1.txt colors_2.txt
Blue
Red

$ # suppress 1 and 3 column, gives lines unique to file2


$ comm -13 colors_1.txt colors_2.txt
Black
Green
White

$ # suppress 2 and 3 column, gives lines unique to file1


$ comm -23 colors_1.txt colors_2.txt
Brown
Purple
Teal
Yellow

cmp: compare two files byte by byte

Useful to compare binary files. If the two files are same, no output is displayed (exit status 0)
If there is a difference, it prints the first difference - line number and byte location (exit status 1)

Option -s allows to suppress the output, useful in scripts

Two provide examples for this command, lets consider two files :

$ cat file2.txt
My name is Mohak Kataria

$ cat file1.txt
My name is Mohak
1. Compare file1 to file2 and outputs results

$ cmp file1.txt file2.txt


file1.txt file2.txt differ: byte 17, line 1
2. Skip same number of initial bytes from both input files
$ cmp -i 5 file1.txt file2.txt
file1.txt file2.txt differ: byte 12, line 1
So we see that the initial 5 bytes were skipped

3. Skip different number of initial bytes from both in

Week 4:

1. Linux commands related to process creation and management- system calls fork() and exec();
bg, fg, nohup, pkill, nice, top, ps;
2. cron and at commands to schedule tasks.

1. System Calls fork(): Fork system call is used for creating a new process, which is called child process,
which runs concurrently with the process that makes the fork() call (parent process). After a new child
process is created, both processes will execute the next instruction following the fork() system call .

for (i = 0; i < n; i++)


fork();

System Calls exec(): The exec system call is used to execute a file which is residing in an active process.
When exec is called the previous executable file is replaced and new file is executed.

Syntax:
exec [-cl] [-a name] [command [arguments]] [redirection ...]
Options:
 c: It is used to execute the command with empty environment.
 a name: Used to pass a name as the zeroth argument of the command.
 l: Used to pass dash as the zeroth argument of the command.

bg command in linux is used to place foreground jobs in background.


Syntax:
bg [job_spec ...]
job_spec may be:
%n : Refer to job number n.
%str : Refer to a job which was started by a command beginning with str.
%?str : Refer to a job which was started by a command containing str.
%% or %+ : Refer to the current job. fg and bg will operate on this job if no job_spec is given.
%- : Refer to the previous job.

fg command in linux used to put a background job in foreground.


Syntax:
fg [job_spec]
job_spec may be:
%n : Refer to job number n.
%str : Refer to a job which was started by a command beginning with str.
%?str : Refer to a job which was started by a command containing str.
%% or %+ : Refer to the current job. fg and bg will operate on this job if no job_spec is given.
%- : Refer to the previous job.
nohup (No Hang Up) is a command in Linux systems that runs the process even after logging out from
the shell/terminal.
Eg.1. Checking the version of Nohup:
The version of nohup command can be checked by using the following command. $ nohup –version
Eg.2. To run a command in the foreground:
Runs the command in the foreground and redirects the command output to the nohup.out file if any
redirecting filename is not mentioned. $ nohup bash geekfile.sh

P-kill is a command-line utility that sends signals to the processes of a running program based on given
criteria. The processes can be specified by their full or partial names, a user running the process, or other
attributes.

Eg: pkill -15 firefox

nice is a program found on Unix and Unix-like operating systems such as Linux. It directly maps to a
kernel call of the same name. nice is used to invoke a utility or shell script with a particular CPU priority,
thus giving the process more or less CPU time than other processes.
Eg:
1. To check the nice value of a process. : ps -el | grep terminal
2. To set the priority of a process: nice -10 gnome-terminal
3. To set the negative priority for a process :nice --10 gnome-terminal
4. changing priority of the running process: sudo renice -n 15 -p 77982

Top (table of processes) command shows a real-time view of running processes in Linux and displays
kernel-managed tasks. The command also provides a system information summary that shows resource
utilization, including CPU and memory usage.
Eg:
 PID: Shows task's unique process id.
 PR: The process's priority. ...
 VIRT: Total virtual memory used by the task.
 USER: User name of owner of task.
 %CPU: Represents the CPU usage.
 TIME+: CPU Time, the same as 'TIME', but reflecting more granularity through hundredths of a
second.

ps program displays the currently-running processes. A related Unix utility named top provides a real-time
view of the running processes.

[root@rhel7 ~]# ps
PID TTY TIME CMD
12330 pts/0 00:00:00 bash
21621 pts/0 00:00:00 ps
Where,
PID – the unique process ID
TTY – terminal type that the user is logged into
TIME – amount of CPU in minutes and seconds that the process has been running
CMD – name of the command that launched the process.

2. cron and at commands to schedule tasks.


It is a set of commands that are used for running regular scheduling tasks. Crontab stands for “cron table”.
It allows to use job scheduler, which is known as cron to execute tasks.
Crontab of Linux has six fields. The first five fields define the time and date of execution, and the 6’th field is
used for command execution.

Crontab syntax:

To schedule a task using cron, you need to edit a special file called the crontab file in a text
editor and add your task in it in a particular format. Then cron will run the task for you at the
time you specify in the crontab file. You can specify any intervals of time, from seconds to weeks
and even years.

Week5:
1. Demonstration through videos. 2. Commands to exhibit thread concepts.

The top command can show a real-time view of individual threads. To enable thread views in the top
output, invoke top with "-H" option. This will list all Linux threads. You can also toggle on or off thread view
mode while top is running, by pressing 'H' key

# top -H -p <pid>
# ps -T -p <pid>
# ps -ef | grep 97947
deploy 97947 97942 1 00:51 ? 00:13:51 java

You might also like