What Is UNIX
What Is UNIX
What Is UNIX
UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which
provides an easy to use environment. However, knowledge of UNIX is required for
operations which aren't covered by a graphical program, or for when there is no windows
interface available, for example, in a telnet session.
Types of UNIX
There are many different versions of UNIX, although they share common
similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X.
Linux in its turn is packaged in a form known as a Linux distribution. There are several Linux
distributions, both free and commercial.
ISU has a campus site subscription to Red Hat Enterprise Linux (RHEL), providing access for
university-owned equipment as well as personal access to students, faculty, and staff. All
our clusters are running RHEL.
The kernel
The kernel of UNIX is the hub of the operating system: it allocates time and memory to
programs and handles the filestore and communications in response to system calls.
As an illustration of the way that the shell and the kernel work together, suppose a user
types rm myfile (which has the effect of removing the file myfile). The shell searches the
filestore for the file containing the program rm, and then requests the kernel, through
system calls, to execute the program rm on myfile. When the process rm myfile has
finished running, the shell then returns the UNIX prompt % to the user, indicating that it is
waiting for further commands.
The shell
The shell acts as an interface between the user and the kernel. When a user logs in, the
login program checks the username and password, and then starts another program called
the shell. The shell is a command line interpreter (CLI). It interprets the commands the user
types in and arranges for them to be carried out. The commands are themselves programs:
when they terminate, the shell gives the user another prompt (% on our systems).
The adept user can customise his/her own shell, and users can use different shells on the
same machine. Most accounts on our clusters have the bash shell by default. The accounts
on hpc-class use shell specified at https://asw.iastate.edu/cgi-bin/acropolis/user/shell .
The bash and tcsh shells have certain features to help the user inputting commands.
Filename Completion - By typing part of the name of a command, filename or directory and
pressing the [Tab] key, the shell will complete the rest of the name automatically. If the
shell finds more than one name beginning with those letters you have typed, it will beep,
prompting you to type a few more letters before pressing the tab key again.
History - The shell keeps a list of the commands you have typed in. If you need to repeat a
command, use the cursor keys to scroll up and down the list or type history for a list of
previous commands.
A file is a collection of data. They are created by users using text editors, running compilers
etc.
Examples of files:
instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of
binary digits (an executable or binary file);
a directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and
ordinary files.
In the diagram above, we see that the home directory of the undergraduate
student "ee51vn" contains two sub-directories (docsand pics) and a file
called report.doc.
What is UNIX?
UNIX is an operating system which was first developed in the
1960s, and has been under constant development ever since. By operating system, we
mean the suite of programs which make the computer work. It is a stable, multi-user, multi-
tasking system for servers, desktops and laptops.
UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which
provides an easy to use environment. However, knowledge of UNIX is required for
operations which aren't covered by a graphical program, or for when there is no windows
interface available, for example, in a telnet session.
Types of UNIX
There are many different versions of UNIX, although they share common
similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X.
Linux in its turn is packaged in a form known as a Linux distribution. There are several Linux
distributions, both free and commercial.
ISU has a campus site subscription to Red Hat Enterprise Linux (RHEL), providing access for
university-owned equipment as well as personal access to students, faculty, and staff. All
our clusters are running RHEL.
The kernel
The kernel of UNIX is the hub of the operating system: it allocates time and memory to
programs and handles the filestore and communications in response to system calls.
As an illustration of the way that the shell and the kernel work together, suppose a user
types rm myfile (which has the effect of removing the file myfile). The shell searches the
filestore for the file containing the program rm, and then requests the kernel, through
system calls, to execute the program rm on myfile. When the process rm myfile has
finished running, the shell then returns the UNIX prompt % to the user, indicating that it is
waiting for further commands.
The shell
The shell acts as an interface between the user and the kernel. When a user logs in, the
login program checks the username and password, and then starts another program called
the shell. The shell is a command line interpreter (CLI). It interprets the commands the user
types in and arranges for them to be carried out. The commands are themselves programs:
when they terminate, the shell gives the user another prompt (% on our systems).
The adept user can customise his/her own shell, and users can use different shells on the
same machine. Most accounts on our clusters have the bash shell by default. The accounts
on hpc-class use shell specified at https://asw.iastate.edu/cgi-bin/acropolis/user/shell .
The bash and tcsh shells have certain features to help the user inputting commands.
Filename Completion - By typing part of the name of a command, filename or directory and
pressing the [Tab] key, the shell will complete the rest of the name automatically. If the
shell finds more than one name beginning with those letters you have typed, it will beep,
prompting you to type a few more letters before pressing the tab key again.
History - The shell keeps a list of the commands you have typed in. If you need to repeat a
command, use the cursor keys to scroll up and down the list or type history for a list of
previous commands.
A file is a collection of data. They are created by users using text editors, running compilers
etc.
Examples of files:
In the diagram above, we see that the home directory of the undergraduate
student "ee51vn" contains two sub-directories (docsand pics) and a file
called report.doc.
More tar examples: The Ultimate Tar Command Tutorial with 10 Practical Examples
Print the matched line, along with the 3 lines after it.
$ grep -r "ramesh" *
More grep examples: Get a Grip on the Grep! – 15 Practical Grep Command Examples
# find ~ -empty
More find examples: Mommy, I found it! — 15 Practical Linux Find Command Examples
$ ssh -V
Print all lines from /etc/passwd that has the same uid and gid
More awk examples: 8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR
$ vim -R /etc/passwd
2c2,3
More diff examples: Top 4 File Difference Tools on UNIX / Linux – Diff, Colordiff, Wdiff, Vimdiff
$ sort names.txt
$ sort -r names.txt
declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
declare -x ORACLE_SID="med"
declare -x ORACLE_TERM="xterm"
$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0
access() This checks if a calling process has access to the required file
System Call Description
chdir() The chdir command changes the current directory of the system
kill() This system call sends kill signal to one or more processes
link() A new file name is linked to an existing file using link system call.
pause() The pause call suspends a file until a particular signal occurs.
alarm() The alarm system call sets the alarm clock of a process
ReadFile() Data is read from the file using this system call.
WriteFile() Data is written into the file using this system call.
SetTimer() This system call sets the alarm or the timer of a process
SetFileSecurity() This system call sets the security for a particular process
SetConsoleMode() This sets the input mode or output mode of the console’s input
buffer or output screen buffer respectively.
ReadConsole() This reads the characters from the console input buffer.
WriteConsole() This writes the characters into the console output buffer.
4.A Shell provides you with an interface to the Unix system. It gathers input from you and
executes programs based on that input. When a program finishes executing, it displays that
program's output.
Shell is an environment in which we can run our commands, programs, and shell scripts. There
are different flavors of a shell, just as there are different flavors of operating systems. Each flavor
of shell has its own set of recognized commands and functions.
Shell Prompt
The prompt, $, which is called the command prompt, is issued by the shell. While the prompt is
displayed, you can type a command.
Shell reads your input after you press Enter. It determines the command you want executed by
looking at the first word of your input. A word is an unbroken set of characters. Spaces and tabs
separate words.
Following is a simple example of the date command, which displays the current date and time −
$date
Thu Jun 25 08:30:19 MST 2009
You can customize your command prompt using the environment variable PS1 explained in the
Environment tutorial.
Shell Types
In Unix, there are two major types of shells −
Bourne shell − If you are using a Bourne-type shell, the $ character is the default
prompt.
C shell − If you are using a C-type shell, the % character is the default prompt.
The Bourne Shell has the following subcategories −
C shell (csh)
TENEX/TOPS C shell (tcsh)
The original Unix shell was written in the mid-1970s by Stephen R. Bourne while he was at the
AT&T Bell Labs in New Jersey.
Bourne shell was the first shell to appear on Unix systems, thus it is referred to as "the shell".
Bourne shell is usually installed as /bin/sh on most versions of Unix. For this reason, it is the
shell of choice for writing scripts that can be used on different versions of Unix.
In this chapter, we are going to cover most of the Shell concepts that are based on the Borne
Shell.
Shell Scripts
The basic concept of a shell script is a list of commands, which are listed in the order of
execution. A good shell script will have comments, preceded by # sign, describing the steps.
There are conditional tests, such as value A is greater than value B, loops allowing us to go
through massive amounts of data, files to read and store data, and variables to read and store
data, and the script may include functions.
We are going to write many scripts in the next sections. It would be a simple text file in which
we would put all our commands and several other required constructs that tell the shell
environment what to do and when to do it.
Shell scripts and functions are both interpreted. This means they are not compiled.
Example Script
Assume we create a test.sh script. Note all the scripts would have the .sh extension. Before you
add anything else to your script, you need to alert the system that a shell script is being started.
This is done using the shebang construct. For example −
#!/bin/sh
This tells the system that the commands that follow are to be executed by the Bourne shell. It's
called a shebang because the # symbol is called a hash, and the ! symbol is called a bang.
To create a script containing these commands, you put the shebang line first and then add the
commands −
#!/bin/bash
pwd
ls
Shell Comments
You can put your comments in your script as follows −
#!/bin/bash
Windows :
Microsoft window is a Graphical User Interface (GUI) based operating system that
provides graphical user-friendly alternatives for most of the command-line based
functions. Microsoft introduced a series of versions with the latest functions.
UNIX :
UNIX is a powerful, multi-user, and multitasking operating system originally developed at AT &
T Bell Laboratories. This operating system is very popular among the scientific, engineering, and
academic due to its most appreciated features like flexibility, portability, network capabilities,
etc.
Windows :
Microsoft window is a Graphical User Interface (GUI) based operating system that provides
graphical user-friendly alternatives for most of the command-line based functions. Microsoft
introduced a series of versions with the latest functions.
UNIX was developed as an open-source OS using C and Assembly languages. Since being open
source UNIX, and its various Linux distributions account for the most used OS in the world.
Unix and all its Linux distributions are available under the General Public License.
Windows Operating System is proprietary software owned by Microsoft, meaning its source
code is not available to the public.
2. User Interface:
Unix operating systems are relatively harder to grasp and produce significant barriers for
newcomers. However, some Linux distributions like Ubuntu are changing such perceptions by
bringing in more GUI-based applications.
Windows Operating System on the other hand is designed with the outset of keeping the UI as
simple and user-friendly as possible, so that non-IT people can easily use computers for their
work.
3. Processing:
Windows Support Multithreading, meaning many threads are created from a single process for
increasing computing power. In multithreading, many threads of a process are executed
simultaneously where common address space is shared by all the threads.
4. File System:
UNIX operating system uses STD.ERR and STD.IO file systems or the UFS (Unix File System)
and treats all physical drives as one logical drive. It has a robust and efficient file system. File
system is represented as a hierarchical tree under the same root.
Windows on the other hand, uses File Allocation Table (FAT32) and New Technology File
System(NTFS) systems for managing files and requires the owner of the executables before
executing, files store in folders on different data drive like, C,D,E.
GEEKSFORGEEKS
Difference between UNIX and Windows Operating System
In this article, we will be looking into the major difference between UNIX and
Windows Operating System.
UNIX :
Windows :
Microsoft window is a Graphical User Interface (GUI) based operating system that
provides graphical user-friendly alternatives for most of the command-line based
functions. Microsoft introduced a series of versions with the latest functions.
2. User Interface:
Unix operating systems are relatively harder to grasp and produce significant barriers
for newcomers. However, some Linux distributions like Ubuntu are changing such
perceptions by bringing in more GUI-based applications.
Windows Operating System on the other hand is designed with the outset of keeping
the UI as simple and user-friendly as possible, so that non-IT people can easily use
computers for their work.
3. Processing:
4. File System:
UNIX operating system uses STD.ERR and STD.IO file systems or the UFS (Unix
File System) and treats all physical drives as one logical drive. It has a robust and
efficient file system. File system is represented as a hierarchical tree under the same
root.
Windows on the other hand, uses File Allocation Table (FAT32) and New
Technology File System(NTFS) systems for managing files and requires the owner of
the executables before executing, files store in folders on different data drive like,
C,D,E.
5. Users Accounts:
Administrator: This account controls all the services and allows user to make
changes and check the activities of other users
Child: This account comes with Family Safety settings which is assigned by
the admin.
Guest: This account has no standard accounts with no privacy, it allows to
other people use your computer without being able to change PC settings and
install applications.
But in windows, we can not save with the same name. It generates errors:
7. Security:
UNIX is more secure by design. The primary protection on a Unix system is that
executing a “.exe” file is much more difficult. Here executables cannot be processed
without explicit permission as all processes in Unix are treated equally. But these are
slowly changing as Unix distributions are moving more towards GUI and now relying
on the application security itself.
Another advantage of Unix systems is that getting rid of viruses is easier, as viruses
can only infect user accounts and the root remains intact and pure.
Windows is less secure in the sense that it is simple to execute files with minimal
permission. These can further lead to the installation of Malwares unknowingly on the
system.
In the earlier version of UNIX, salvaging data from a system when the device housing
the said data is inaccessible, was not possible. But in some distributions of Linux like
Ubuntu, a new feature is introduced called Live distribution can be used to recover
data from an inaccessible device.
Recovery and Backup of data in the Windows system are much simpler and can be
done using its inbuilt GUI for the same. It has an integration with OneDrive for data
backup and recovery too.
9. Case Sensitivity:
Unix is completely case-sensitive, meaning the files with names “GFG.txt” and
“gfg.txt” can be considered two different files. Windows, on the other hand, have
optional case sensitivity.
10. Hardware:
Hardware support is limited in UNIX systems. Some hardware might not have drivers
built for them. Windows has almost all the drivers for all the available hardware.
11. Reliability:
Unix is known for being very stable to run. Although the stability of Windows has
significantly improved in recent years, most Unix systems are still far superior in this
respect.
It has a text base interface, making it harder It has a Graphical User Interface,
3. User Interface
to grasp for newcomers. making it simpler to use.
It uses Unix File System(UFS) that comprises It uses File Allocation System (FAT32)
5. File System
STD.ERR and STD.IO file systems. and New technology file system(NTFS).
7. Data Backup & It is tedious to create a backup and recovery It has an integrated backup and
Recovery system in UNIX, but it is improving with the recovery system that make it simpler to
. Parameters UNIX Windows