Basic Unix Commands

Unix is a important operating system that provides a command- line interface for druggies to interact with the system. Then are some introductory Unix commands:

  1. 1s.
  2. cd.
  3. pwd.
  4. mkdir.
  5. rm.
  6. ep.
  7. mv.
  8. cat.
  9. head.
  10. tail.
  11. grap.
  12. chmod.
  13. sudo.

Unix editors

Any UNIX system provides many different editors out of the box. In this section I will describe the most popular ones showing the basics of working with them. vim and emacs in particular have lots and lots of different commands, have plugins, and so you can spend years using them just scratching the surface of what’s possible.

vi Editor in UNIX

The dereliction editor that comes with the UNIX operating system is called vi( visual editor). Using vi editor, we can edit an being train or produce a new train from scrape. we can also use this editor to just read a textbook train.


Unix system commands take input from your terminal and shoot the performing affair back to your terminal. A command typically reads its input from the standard input, which happens to be your terminal by dereliction. also, a command typically writes its affair to standard affair, which is again your terminal by dereliction.


A pipe is a form of redirection( transfer of standard affair to some other destination) that’s used in Linux and other Unix- like operating systems to shoot the affair of one command/ program/ process to another command/ program/ process for farther processing.


The tee command in Unix and shell programming allows you to read the standard input and write it to both the standard affair and one or further lines. It’s useful when you want to see the affair on the terminal while contemporaneously saving it to a train for future reference or analysis.

The introductory syntax of the tee command is as follows

command | tee file1 file2 ...


In Unix and shell programming, a “filter” refers to a command or program that takes input from the standard input, performs some operation on it, and produces the modified output on the standard output. Filters are designed to process streams of data and are often used in combination with other commands through the use of pipes (|).

The Unix Utilities grep

The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern. The pattern that’s searched in the train is appertained to as the regular expression( grep stands for global hunt for regular expression and publish out)


grep [options] pattern [files]


SED command in UNIX stands for sluice editor and it can perform lots of functions on train like searching, find and replace, insertion or omission. Though utmost common use of SED command in UNIX is for negotiation or for discovery and replace. By using SED you can edit lines indeed without opening them, which is important quicker way to find and replace commodity in train, than first opening that train in VI Editor and also changing it.

Overview of Unix Architecture

Unix is an operating system that has been extensively used since its commencement in the 1970s. It was developed at Bell Labs by a platoon led by Ken Thompson and Dennis Ritchie. The Unix armature has had a profound influence on the design of posterior operating systems, and numerous ultramodern systems still follow its principles.

The Unix armature is characterized by its simplicity, modularity, and adherence to the” Unix gospel” of doing one thing well. It follows a layered approach, with each subcaste furnishing a specific set of services and functionality. Then’s an overview of the crucial factors and layers in the Unix armature

  1. Kernel.
  2. Shell.
  3. Filesystem.
  4. Processes.
  5. Networking.
  6. Utilities and Tools.
  7. Libraries.


Kernel is the heart of the operating system. The term kernel frequently refers to the operating system. The critical law of kernel is stored in a special memory area to cover it from other programs. It’s a vital element as it’s the base for the proper functioning of the entire system. Kernel performs a variety of tasks including process operation, managing tackle bias and handling interrupts.


Shell is the interface between stoner and kernel. It’s a command line practitioner and is the interface between the stoner and the kernel. The stoner can enter commands to the shell. also it interprets the commands to perform the needed task. likewise, it executes programs and shell scripts. The stoner should follow the standard syntax to write commands to the shell.


A program/command when executed, a special instance is provided by the system to the process. This instance consists of all the services/resources that may be utilized by the process under execution.

Time Sharing files

There have been four performances of the UNIX time- sharing system. The foremost( circa 1969- 70) ran on the Digital Equipment Corporation PDP- 7 and-9 computers. The alternate interpretation ran on the vulnerable PDP-11/20 computer. The third incorporated multiprogramming and ran on the PDP-11/34,/ 40, / 45,/ 60, and/ 70 computers; it’s the one described in the preliminarily published interpretation of this paper, and is also the most extensively used moment. This paper describes only the fourth, current system that runs on the PDP-11/70 and the Interdata8/32 computers. In fact, the differences among the colorful systems is rather small; utmost of the variations made to the firstly published interpretation of this paper, away from those concerned with style, had to do with details of the perpetration of the train system.


Directories in Unix are used to organize files into a hierarchical structure. They contain entries for files and subdirectories within them. Directories are also considered files themselves but with a different file type. You can create, navigate, and manipulate directories using various shell commands.

Here are some common directory-related commands in Unix:

  1. 1s.
  2. cd.
  3. mkdir.
  4. rmdir.
  5. cp.
  6. rm.
  7. pwd.

Peripheral devices

In Unix, peripheral devices such as printers, serial ports, or input devices can be represented as special files in the file system. These files are typically located in the /dev directory. They allow you to interact with the device as if you were reading from or writing to a regular file.
Peripheral device files are known as device files or special files and are categorized into two types:

  • Character device files.
  • Block device files.

Shell Scripts

A shell script is a list of commands in a computer program that’s run by the Unix shell which is a command line practitioner. A shell script generally has commentary that describe the way. The different operations performed by shell scripts are program prosecution, train manipulation and textbook printing.


The Bourne shell is used for scripting. It provides command- grounded programming to interpret and execute stoner commands. As a stoner types a command, the shell interprets it so the operating system can take action, similar as automating a task. The Bourne shell was the dereliction shell for Unix interpretation 7. The shell advisement used in command prompts is the$ symbol.


The C shell( csh or the bettered interpretation, tcsh) is a Unix shell created by Bill Joy while he was a graduate pupil at University of California, Berkeley in the late 1970s. It has been extensively distributed, beginning with the 2BSD release of the Berkeley Software Distribution( BSD) which Joy first distributed in 1978.( 2)( 3) Other early contributors to the ideas or the law were Michael Ubell, Eric Allman, MikeO’Brien and Jim Kulp.

Shell Variables

A variable is a character string to which we assign a value. The value assigned could be a number, text, filename, device, or any other type of data. A variable is nothing further than a pointer to the factual data. The shell enables you to produce, assign, and cancel variables.

Scripting Meta-Characters

meta- characters are special characters that have a specific meaning or function within a given environment. They’re used to control the geste of the script or to perform specific conduct. The interpretation of meta- characters varies depending on the scripting or programming language being used. Then are some generally used meta- characters in scripting:

  1. Asterisk () .
  2. Question mark (?) .
  3. Pipe (|) .
  4. Ampersand (&) .
  5. Dollar sign ($) .
  6. Backslash ().

if statements

The if statement allows you to execute a block of code based on the evaluation of a condition. Here’s the basic syntax:

if condition
    # code to execute if condition is true
    # code to execute if condition is false

Case Statements

The case statement allows you to perform different actions based on the matching of a value against a list of patterns. It is particularly useful when you have multiple conditions to evaluate. Here’s the basic syntax:

case variable in
        # code to execute if pattern1 matches
        # code to execute if pattern2 matches
        # code to execute if pattern3 matches
        # code to execute if none of the patterns match

Unix System Calls

Unix system calls are low- position functions handed by the operating system kernel. They allow programs to pierce operating system services and coffers, similar as train operations, process operation, network communication, and tackle access. Some generally used system calls include:

  • ‘open ()’.
  • ‘read()’.
  • ‘weite()’.
  • ‘fork()’.
  • ‘socket()’.
  • ‘bind()’.
  • ‘connect)’.
  • ‘close()’.

C Library Functions

The C library functions give advanced- position abstractions erected on top of system calls. They’re enforced as standard C functions and give a wide range of serviceability for common programming tasks. The C library functions are generally movable across different Unix- suchlike systems and give a harmonious interface. Some generally used C library functions include

  • File and I/O operations.
  • String manipulation.
  • Memory management.
  • Time and date functions.
  • Mathematical functions.
  • Process and signal management.
  • Networking functions.

Bourne Shell

The Bourne shell, often referred to as “sh,” is a command-line interpreter and scripting language used in Unix-like operating systems. It was developed by Stephen Bourne in the early 1970s and served as the default shell for many Unix systems.

Here are some key features and concepts related to the Bourne shell:

  1. Command execution.
  2. Variables.
  3. Command substitution.
  4. Control structures.
  5. Shell expansion.
  6. Redirection.
  7. Pipes.

Shell meta characteristics

Metacharacters are special characters that are used to represent commodity other than themselves.characters that are neither letters nor figures may be metacharacters. Like grep, sed, and awk, the shell has its own set of metacharacters, frequently called shell wildcards.( 4) Shell metacharacters can be used to group commands together, to truncate filenames and pathnames, to deflect and pipe input/ affair, to place commands in the background, and so forth.

Shell Variables

Shell variables are used to store information such as strings, numbers, or file names. They can be defined and accessed within the shell or shell scripts. In Unix, there are two types of variables: environment variables (global variables accessible to all processes) and local variables (specific to a particular shell or script)

Shell Scripts

Shell scripts are files containing a series of shell commands. They can be executed directly by the shell interpreter. Shell scripts are useful for automating tasks, running commands sequentially, and implementing more complex logic.

Shell Facilities

Unix shells provide various facilities and features for programming and script execution, including:

  • Conditional Statements.
  • Looping Constructs.
  • Input/Output Redirection.
  • Command Substitution.
  • Functions.


Unix commands are in built programs that can be invoked in multiple ways.

Then, we will work with these commands interactively from a Unix outstation. A Unix outstation is a graphical program that provides a command- line interface using a shell program.

This tutorial will give a summary of some of the common introductory and advanced Unix commands along with the generally used syntax for those commands.


Environment variables or ENVs principally define the geste of the terrain. They can affect the processes ongoing or the programs that are executed in the terrain.

Shell Archive

A shell archive, often referred to as a “shar” file, is a type of archive file created in a Unix shell script format. It combines multiple files into a single, self-extracting script that can be run on a Unix-like operating system. When executed, the shell archive script extracts the original files and restores them to their original form.

Restricted Shells

A restricted shell is a Unix shell that has been modified to allow the Unix shell stoner to do smaller effects than a normal shell would allow him to do. It may allow the stoner to run only certain programs. It may stop the stoner from changing directories.

ROLC program

The ROLC (Role-Based Access Control) program is a security model used to manage access to computer systems and resources. It is based on the concept of assigning permissions and access rights to individual users or groups based on their roles or responsibilities within an organization. ROLC allows administrators to define roles and associated permissions, and then assign users or groups to these roles, making it easier to manage access control and ensure proper security measures are in place.

Korn Shell

KornShell ( ksh) is a Unix shell which was developed by David Korn at Bell Labs in the early 1980s and blazoned at USENIX on July 14, 1983. The original development was grounded on Bourne shell source law. Other early contributors were Bell Labs inventors Mike Veach and Pat Sullivan, who wrote the Emacs and vi- style line editing modes’ law, independently. KornShell is backward-compatible with the Bourne shell and includes numerous features of the C shell, inspired by the requests of Bell Labs druggies.

Shell variables

Shell variables are named placeholders used to store values or data in the shell. They can be used for various purposes, such as configuration settings, temporary storage, or passing information between shell scripts. In most shells, including Bash, variables are case-sensitive, and their names consist of letters, numbers, and underscores.

Shell scripts

Shell scripts are plain text files containing a series of commands that are executed by a shell interpreter, such as Bash. They allow you to automate tasks, perform complex operations, and combine multiple commands into a cohesive script.

Unix Editor Options

there are several built-in editors available that you can use to create, edit, and modify files directly from the command line. Here are some commonly used built-in editors:

  1. Vi/Vim.
  2. Emacs.
  3. Nano.

built in integer arithmet

Built-in integer arithmetic refers to the ability of a programming language or software to perform arithmetic operations on integers without the need for additional libraries or external functions. This means that the language itself has native support for integer arithmetic operations such as addition, subtraction, multiplication, division, and modulo.

String manipulation capabilities

String manipulation capabilities refer to the ability to manipulate and modify strings in a programming language or software. This typically includes operations like concatenation (combining two or more strings), substring extraction (extracting a portion of a string), searching for specific patterns or characters within a string, replacing portions of a string with new content, and converting strings to different formats or representations.

Command Aliasing

Command aliasing is a feature that allows users to define shortcuts or aliases for frequently used commands or sequences of commands. It simplifies command-line usage by enabling users to create shorter and more memorable names for complex or lengthy commands. For example, instead of typing a long command like “git commit -am ‘Fix bug #1234′”, you could create an alias like “gc” that represents the same command.

Array Job contro

Array job control typically refers to a feature in job scheduling systems or batch processing environments that allows the execution of multiple similar tasks or jobs using arrays. It enables the submission and management of a group of jobs as a single entity, with each job in the array having its own set of input parameters or data. Array job control simplifies the management and execution of repetitive tasks by automatically generating and managing a set of related jobs based on a predefined template or configuration.


C-Shell allows you to define and use shell variables to store values. You can assign values to variables using the “=” operator and access them by prefixing the variable name with a dollar sign ($)

Shell Scripts

C-Shell provides the ability to write shell scripts, which are sequences of commands stored in a file. Shell scripts can be executed as standalone programs. To create a shell script, you can use a plain text editor to write the commands and save the file with a “.csh” or “.sh” extension

Shell Facilitie

C-Shell provides several built-in facilities and features to enhance your command-line experience. Some commonly used features include command aliasing, command history, command-line editing, and job control. These facilities help improve productivity and make working in the shell more efficient.