Operating System
Operating System
Unix: The Unix operating system is a set of programs that act as a link
between the computer and the user.
Kernel: The kernel is the heart of the operating system. It interacts with the
hardware and most of the tasks like memory management, task scheduling
and file management.
Files and Directories: All the data of Unix is organized into files. All files
are then organized into directories. These directories are further organized
into a tree-like structure called the filesystem.
COMMANDS:
Command Function
concatenate and display
cat reads data from the file and gives their content
as output
echo output a string
mkdir make directories
cd change directory
cp copy files and directory
rm remove files and directory
mv move or rename files
rmdir remove empty directories
tail output the last part of files
Command Function
file determine file type
used to find files and directories and perform
find
subsequent operations on them
get information about currently logged in user
on to system.
tty - short of teletype allows you to interact with the system by passing
on the data (you input) to the system, and
displaying the output produced by the system
list out all the files or directories available in a
ls
directory
list the account name associated with the
whoami
current login
date +%d/%m/%Y print out today's date
uname -nr machine's name and version of the OS
clear clear the screen
tput 10 30 moves the cursor to row 10, column 30
bc used for command line calculator
breaks the output of a program so that it can be
both displayed and saved in a file
pr
adds 5 lines of margin both at the top and
bottom of the page
used to list the currently running processes and
ps [process status]
their PIDs
used to terminate processes manually
SHELL
Command Function
takes the input from the keyboard and assigns it as the value
read
of the variable
echo echo command in linux is used to display line of text/string
used to evaluate a given expression and display its standard
expr
output
SHELL OPERATORS
Command Function
logical negation, this inverts a true condition into false and
!
vice versa.
logical OR, if one of the operands is true, then the condition
-o
becomes true.
logical and, if both the operands are true, then the condition
-a
becomes true otherwise false.
Checks if the value of two operands are equal or not; if yes,
-eq
then the condition becomes true.
Checks if the value of two operands are equal or not; if
-ne
values are not equal, then the condition becomes true.
Command Function
Checks if the value of the left operand if greater than the
-gt value of the right operand. if yes then condition becomes
true.
Checks if the value of the left operand if less than the value
-lt
of the right operand. if yes then condition becomes true.
Checks if the value of left operand is greater than or equal to
-ge the value of right operand, if yes then the condition becomes
true
Checks if the value of left operand is less than or equal to
-le the value of right operand, if yes then the condition becomes
true
Terminal Shell
A terminal is a text input and output The shell is a command-line
environment. interpreter.
The shell is the program that
A terminal is a wrapper program that
actually processes
runs a shell and allows us to enter
commands and outputs
commands.
results.
The terminal is a program that A shell is a user interface for
displays a graphical interface and accessing the services of an
allows you to interact with the shell. operating system.
2. What is process status?
Linux provides us a utility called ps which stands as abbreviation for
“Process Status” and is used for viewing information related with the
processes on a system
3. How can we find the running status?
By using ps or top command
4. How to kill a process?
Using kill command. To specify which process should receive the kill
signal we need to provide the PID.
5. How to interrupt a process?
umask chmod
used to set the default access used to change the access
permissions for files and permissions for files that have
directories which will be been already created and are
created in the future present in the system
4. How to set and calculate umask values for files and directories?
1. We can use the umask command to set the default permissions
with which the files/directories will be created.
2. File -> The full permission set for a file is 666
as csh
Korn Shell also knew as ksh
# !/bin/bash