UNIX Tutorial for Beginners

Facebooktwitterredditpinterestlinkedinmailby feather

The UNIX is an operating system. “It was created by Ken Thompson and Dennis Richie at AT & T’s Bell laboratory in 1969”. The UNIX operating system was firstly programmed in assembly language.

An operating system is a set of programs which is written in such a way that can communicate to the system. It manages computer hardware and software resources as well as provides the common services for a computer program. The UNIX is an operating system, which is the base for all OS such as Ubuntu, POSIX, Solaris, etc.

The UNIX can handle multiple users at the same time. It is a collection of programs which act as the link between the computer and the user. The UNIX systems also have the graphical interface similar to Microsoft windows which provide a secure environment for the user to use.


The UNIX project began in the mid of 1960s. In 1969, Ken Thompson wrote the first version of UNIX, which is known as UNICS.  The UNICS stands for Uniplexed operating and computing system.


Dennis Richie teamed up with ken Thompson, who wrote the first C compiler. In 1973, they again wrote the UNIX kernel in C language. This version of UNIX is known as the fifth edition, and the first licensed version for the universities use. The UNIX operating system is widely used in the world for computer servers.


There are some features of the UNIX operating system which are given below:

  • It supports multitasking and multi-user.
  • The UNIX operating system has a programming interface.
  • UNIX can use the files as an abstraction of the device and other objects.
  • This operating system is Built-in networking (TCP/IP standard).
  • The Persistent system service processes called “daemons” and managed by inet or init
  • The UNIX operating systems use the centralized OS kernel, which can control the system and process activities.
  • We can communicate with our system through the UNIX shell, which translates to the kernel.
  • All functions in the UNIX operating system is related to the file or process. The processes are the execution of programs, while files are the collection of data created by the user.

1. Basic Commands

The UNIX commands are the inbuilt programs that can be invoked in various ways. We can work with these commands interactively from the UNIX terminal. The UNIX terminal is a graphical program. It provides a command-line interface by using the shell program.

Various testing activities, like installation and performance testing, depends on the operating system knowledge. Most of the web servers are based on the UNIX operating system. So, the knowledge of UNIX is mandatory for the testers.

There are different types of basic commands of the UNIX operating system, which are given below:

  • cal command

The “cal” command is used to print the calendar of the current month or the whole year. It is the command-line utility to display the calendar in the terminal.



1. Cal 2018: It will show the whole calendar of the year 2018.


2. Cal 08 2000: It will show the calendar of 8th month, the year 2000.

  • B. date command

The “date” command in UNIX is used to display the system’s date and time. It shows the date in the time zone on which Unix/Linux operating system is configured. We can also set the date and time of our system using this command.



1. Command: This command is used for the pacific daylight time.


2. Command: The command for the date and time of 2 years ago.


  • banner command

The banner command of UNIX operating system is used to print the text in large size on standard output. It prints the high-resolution text banner on the system console. If we have the printer connected to the machine, we can redirect the output to the printer.



  • who command

This command is used to show the list of users who are currently logged into the system. The who command of UNIX is related to the w command, that provides the same information but also displays the additional data and statistics. The who command shows the information if the various options are not provided:

  1. The login name of users.
  2. Terminal line numbers in UNIX.
  3. The login time of the users when they logged into the system.
  4. The remote hostname of the user.



1. The given command who-m-H is used to display the hostname and user associated with the standard input such as the keyboard. 

2. The given command who-p-H is used to show all active processes which are spawned by the INIT process.

3. The below syntax of who command will display the list of users logged into the system

4. In the below example, the who-b-H command will show the time of the system when it booted last time.

5. The who –d -H command is used to display the details of all dead processes.

6. To display the system login details, who –l –H command is used, as it is given in the below example. 

7. Count the number of users logged on to the system, when who –q -H command is used.

8.  To show the current run level of the system, who –r command is used.

9. The given command who-a is used to show all details of the users who currently logged in.

  • Whoami command

The whoami command is used in UNIX and LINUX as well as Windows operating system. It concatenates the strings “who,” “am,” “i” as whoami. The given whoami command is used to display the current user when this command is invoked by the system. It is similar to running of id command with the option –un.



2. The file system commands

The UNIX file system is the methodology to organize and store the large quantity of data in such a way that it makes the operating system easy to manage. The file is defined as a collection of data, which can logically view. It is the smallest unit of storage data in the UNIX file system.

The UNIX operating system has the hierarchical and structural file system with its highest-level directory called root. The root-level directories are containing different subdirectories.

The file system of UNIX consists of files, relationships to other files, as well as the attribute of each file. File attribute is the information related to the file but does not include the data contained within the file. This file attributes to the generic operating system include the information which is given below:

  1. The file type (what kind of data is in the file).
  2. Filename (which may or may not include the extension).
  3. The physical file size.
  4. The owner of the file.
  5. File protection/privacy capability.
  6. The file timestamp.

 The file system provides a tool which allows the manipulation of a file and provides the logical organization as well as services, which maps the logical organization of file to the physical devices. There are various types of file system commands which are given below:

A) touch command

The touch command is used in both LINUX and UNIX operating system. It is creating change and modifies the timestamps of the file. It can create the file without any content. So, that file is empty, which is created by the user via touch command. This command can be used when the user doesn’t have data to store at the time of file creation.


It is the common syntax for touch command.

The touch command is used to create multiple numbers of the file at the same time. These files would be empty during creation.




The given syntax is used to create many files at the same time.


B) cp command

The cp stands for copy, and this command is used to copy files or group of files or directory. The cp command creates an image of the data on the disk with the different file name. It requires at least two file names in its arguments.


The first and second syntax is used to copy source file to Destination File or Directory, and the third syntax is used to copy multiple sources (files) to the directory. 


The above example contains two file names, and then it copies the contents of the 1st file to the 2nd file. If the second file doesn’t exist, then firstly the cp command creates a file, and the content is copied to it. But if that file already exists then, it is overwritten without any warning. So, we need to be careful when we choose the destination file name.

C) Mv command

The mv command is a command-line utility that moves files or directory from one place to another. It supports moving the single files, multiple files, and directories. The mv command has two distinct functions:

1. It renames the file or folder.

2. This command can move the group files to a different directory. 

No additional space is consumed on the disk during the renaming. The mv command normally works silently means no prompt for the confirmation of the command.



D) rm command

The rm command is the basic command of UNIX and LINUX operating system. It is used to remove the objects such as computer files directories and symbolic links from file systems.

This command removes the references to the object from the file system, where those objects might have multiple references. It does not remove the directories by default.

The rm command normally works silently, and we should be very careful while running the rm command. Once the files are deleted, then we are not able to recover the contents of the files and directories. 



 The given example is used to Removing one file at a time.

 This syntax is used to Removing more than one file at a time

E) mkdir command

The mkdir command is used to create directories or folders. It can create multiple directories at once and set permissions when it makes the directory.

It is important to note that when the user executes mkdir command, the user must have enough permission to create the directory in the parent directory. Otherwise, the user may receive the error ‘permission denied’. 



1. – – version: The given example shows the version number and some information regarding the license.




2. – – help: It shows the help related information and exits.




3. –v or – -verbose: It is used to display the message for every directory.




3. The processes control commands

The process control command is a single running program. It may be the system program or program initiated by the user. It gives the unique number to each process when the UNIX operating system runs the process. The process is the sequence of instructions, and every process has a block of controlled data to associate with it.

 The process table contains information about all processes which are currently running in the operating system. The primary purpose of this table is to manage the running processes effectively. The different type of information exists in the process table, which is given below:

  • The process ID of any process.
  • The parent process ID should present in the process table.
  • State of the processes is related to the process table.
  • Usage of the central processing unit exists in the process table in the UNIX operating system.

The different state of the process in the UNIX operating system depends on the various circumstances. It may trigger the state of the process and needs to wait for the read or write operation to complete. Several commands are available to review and manipulate the process.

A) Ps command

The ps command is used to display the currently running process. The UNIX is the multitasking and multi-user operating system, so ps command allows multiple methods to operate simultaneously without interfering with each other. The processes are the executing instance of the program and carry out the various tasks within the operating system.



1. View process

 The given ps-A and ps-e command is used to view all the running processes.

2.  The given below example is used to view all the process except session leaders.

B) top command

The top command is used to display system summary information as well as the list of processors or threads which are currently managed by the kernel. This command provides the dynamic real-time view of the running system.



1. Batch mode: This syntax of the top command is used to send the output to file or any other program with the help of batch mode.

2. Secure mode: The given top-s command is used in a secure mode.

C) bg command

The bg command is used to job control. It is the ability to stop or suspend the execution of processes and continue their execution as per our requirements. The bg command is used to locate the foreground job in the background.



bg  – -help: Given bg- -help command is used to display the help information.


D) fg command

The fg command in UNIX operating system is used to position the background job in the foreground.



fg – – help:  The fg – – help command is used to show the help information.


E) clear command

The clear command is mainly used to clear the terminal screen. This command will ignore every command-line parameter if present. It doesn’t take any argument and similar to cls command.



The terminal looks like that before executing the clear command.


After the execution of the clear command, the terminal is looking like this.


F) history command

The history command is used to view the previously executed command. This command is used in every version of the UNIX operating system. It is mainly used to view history.



1. To display the limited number of commands in history, we can use syntax like this


4. The Utilities program commands

The UNIX is divided into two parts the kernel and the utilities program command. A kernel is the heart of the UNIX system. It resides in the computer’s memory from the time when the computer is turned on and booted until it is shut down.

The utilities program commands are resided on the computer’s disk and brought into the memory according to user’s request. Every command of UNIX is classified as the utility.

A) man command

The man command of UNIX is used to display the user manual of any command that can run on the terminal. It provides a detailed view of command, which include:

NAME, SYNOPSIS, DESCRIPTION, OPTION, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AND AUTHORS. Each manual page is divided into some sections which are given below:

  1. The Executable Programs or shell commands in the terminal.
  2. System calls, these are the functions provided by the kernel.
  3. The Library calls which are the functions within the program libraries.
  4. Every manual page is divided into the game section.
  5. The System administration commands.
  6. The routines of the kernel.
  7. The file formats and conventions



1. No option: The given syntax of man command shows the whole manual of the command.




In this output, the Printf command is executed and returns manual pages as the output.

B. sudo command

The sudo command stands for “superuser do.” It allows the user to run programs with the security privileges of another user. This command also supports the security privileges from the superuser by default.



1.-V: The sudo command given below is used to print the version number and exit from the terminal.


C. find command

The find command is used to search one or more directory trees of the file system. This command performs subsequent operations on files and directories. It supports the searching by file, folder, name, creation date, modification date, owner, and permissions.



 The given syntax is used to Search the file with its specific name.




Unix Installation

1. Go to www.virtualbox.org and click on download virtual box.


2.  Select the windows hosts on this page.


3. Click the button, power on the virtual machine.


4. Select the option Install or upgrade an existing system.


5. The given page shows requested files of the UNIX operating system are loaded in a virtual machine.


6. Select a Skip or OK button according to the user’s requirement.


7. Click on the Next button.


8. Select the language according to the user’s need.


9. After selecting the language, click next option.


10. Select the Basic Storage Device Button.


11. It is the Warning page for the storage device; here we select the yes button. So, we got the space in the storage device.


12. Then, we need to set the Hostname.


13. Select the time zone according to the user’s choice.


14. Set the root password on this page.


15. Select the Create Custom Layout option.


16. Create the standard partition of the virtual machine.


17. Similarly, create two more partitions of the virtual machine.


18. Select the format button.


19. Then, click on the button, write changes to disk.


20. After click on the create button, the formatting of the disk gets started.


21. Install the boot loader.


22. Installing process of UNIX is started after the process completion, clicks the next button.


23. Select the primary server option and click on customize now button.


24. Check the dependency of the server.


25. End


The UNIX operating system has various advantages which are given below:

  • The main advantage of UNIX is multitasking with the protected memory.
  • Multiple users can run multiple programs at the same time without interfering with each other and crashing the system.
  • The UNIX operating system is available on a wide variety of machines.
  • It is an optimized operating system for program development.
  • This operating system is the lean kernel which does the basic task but doesn’t get in the way when we try to do the unusual.
  • The UNIX OS is very efficient virtual memory; so that many programs can run with the modest amount of physical memory.
  • The UNIX has a rich set of small commands and utilities that can do the specific task well. These commands cannot create clusters. This operating system has stocked toolbox.
  • The UNIX operating system has strong access control and security. All users must be authenticated by the valid account and password to use the system. A particular account owns the whole files, and the owner can decide that others have read or write access to his data.
  • The UNIX has a powerful unified file system, and everything is stored in this operating system such as data, programs, and physical devices.


There are several disadvantages to this operating system which are given below:

  • The traditional command-line shell interface in the UNIX operating system is user-hostile. It is only designed for the programmer, not for the casual user.
  • To use the UNIX operating system completely, we need to understand some of the main design features. We should know how to make commands and programs which can interact with each other.
  • The UNIX is designed in the text-based command line, so it is not easy to use. This Operating System is for normal users,
  • The modern version of UNIX has graphical interfaces except for macOS.


The UNIX operating system is used in workstations and servers. UNIX environment and client-server program are very important for the development of internet and remapping of the computer system as keeping the keyframe of networking.

It is portable and time-sharing configuration operating system. There are several layers of interaction in UNIX. These layers occur in between the computer hardware and the user.

Facebooktwitterredditpinterestlinkedinmailby feather