0% found this document useful (0 votes)
2 views10 pages

All Unix Notes

Unix is an operating system created in 1971, known for being freeware, open source, and capable of multitasking and multi-user functionality. It has several flavors, including Linux, Ubuntu, and Solaris, and utilizes a command-line interface for user interaction. Key components of Unix include the shell for command entry and the kernel for managing system resources.

Uploaded by

mayur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views10 pages

All Unix Notes

Unix is an operating system created in 1971, known for being freeware, open source, and capable of multitasking and multi-user functionality. It has several flavors, including Linux, Ubuntu, and Solaris, and utilizes a command-line interface for user interaction. Key components of Unix include the shell for command entry and the kernel for managing system resources.

Uploaded by

mayur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIX to

Unix is Operating system.

What is an operating system?

Opearating system is sw, which is compulsory installed on computer.


An operating system is a control program for a computer of computers.
Its purpose is to allocate computer resources and schedule task/program.
It determines how the computer is to operate

It is created in 1971.
51years

With several enhancement and improvements to base version, several flavours introduced by
oraganization/companies.

(Redhat, Linux, Ubuntu, centos..etc).

Linux and Unix are different but they do have a relationship with each other as Linux is derived from
Unix.

Charactristics of Unix:

1. It is freeware.
2. It is open source.
The source code how the commands are implemented we can see.
We can cutomize source code based on our requirement.
Velocity== >cutomize source code== > Velocity Flavour.

It is Foss == > Freeware and Open Source Software


3. Multi user operating system : Unix can be used by multiple users simultaneoulsy.
4. Multitasking : In Unix , multiple task can be executed simultaneoulsy.

Windows is GUI based..(Graphical User Interface)—folder—Small task

Unix???.. CUI (Character User Interface)—Directory—More/task you can use this one.

100 directories ---. Name of directory :-dir

In every directory----100 files

Mkdir dir{1..100} // 100 directory

[Link], [Link].. [Link]

touch dir{1..100}/file{1..100}.txt

dir1—100 files

dir2 –100

dir100—100 files
GUI— Graphical user Interfce

CUI - Character user Interface

Flavours of Unix :

 HP-UX.
 SunOS and Solaris.
 IRIX.
 Digital UNIX (formerly OSF/1)
 SCO Unix.
 Linux.

Componenets of Unix :

1. Shell : - Terminal—It reveives the command.


.
The terminal is a way to interactively communicate with the computer.

Shell is used to enter command.

2. Kernel :Core of the unix. Its It manages. It checks whether the command is right or wrong.

It manages machine memory and allocating of memory to the process.

Server
Shell Kernel
/System

User
Putty :

Click on Open…It will ask for UN and Pwd.


Then your terminal will get start.

Putty : Mostly used with SSH.


Free and open source terminal.
It supports several protocols, SSH, Telnet, SCP, rlogin and raw socket.

Hostname or IP address :
An IP address is logical numeric address that is assigned to every computer, printer or device.
A hostname is label assigned to logical number or to website.

Port :
A port number a way to identify nw message is to be send or receives.

Then click on Open Button…


Putty Terminal will get open

Then Enter Username and password. Then terminal will get display.

Unix virtual Terminal…

Cocalc unix VT..

Signup..
Project..
New Terminal..
Commands..

Create Project…
Click on New..
Select Linux Terminal..

1. Cal : Displays the calender.


Syntax : cal

2. Date :Displays system date and time.


Syntax : date
3. Whoami : Displays the userid of current loged in user.
Syntax :whoami
Make directories

mkdir (make directory)


To make a directory called Velocity in your current working directory type

Example :mkdir April


To see the directory you have just created, type : ls

Create file

touch (To create file)


To craete file use touch command with extension.
Example :
touch [Link]

Listing files and directories

[Link] (list)

The ls command ( lowercase L and lowercase S ) lists the contents of your current working directory.

ls –a

It will display al hiden files from your folder

Files beginning with a dot (.) are known as hidden files Example : ls –a

 Ls –al :

Files and directories from that folder with extra information : size owner, permisssions etc.

Changing to different directories

To change to the directory you have just made, type

Example : cd April

The directories . and ..


There are two special directories called (.) and (..)
The current directory (.) It means stay where you are

(.) means the current directory

 cd .
NOTE: there is a space between cd and the dot

 cd ..

The parent directory (..)

(..) means the parent of the current directory. Goes back to one directory

Example : cd ..

will take you one directory up the hierarchy (back to your home directory).

Copying Files

cp (copy)

cp file1 file2 is the command which makes a copy of file1 in the current working directory and calls it file2

touch [Link] ---- Creates [Link] file

touch [Link] ---- Creates [Link] file

cp [Link] [Link] ---- It will copy content of [Link] in to [Link]

Moving files

mv (move)

Moves files or renames files.

mv stands for move.


(i) It renames a file or folder.

mv [Link] [Link] ----Renames file

mv Simple Simplee ----Renames folder

(ii) It moves a file from one place to another. Source file will get deleted.

mv [Link] [Link] ----It will move contwnt of aaa1 file in to z1 file. It will delete source file([Link] file)

iii)We can move file from one place to another folder on same level.
e.g c2, [Link]
want to move [Link] to c2 folder then use : mv [Link] c2
Displaying the contents of a file on the screen

 clear (clear screen)

Before you start the next section, you may like to clear the terminal window of the previous commands so
the output of the following commands can be clearly understood.

clear

This will clear all text.

Searching the contents of a file

 tail command :
The tail command, as the name implies, print the last N number of data of the given input.

By default it prints the last 10 lines of the specified files.

Example :tail [Link]

$ tail -n 3 [Link]
OR
$ tail -3 [Link]

 head command :
The head command, as the name implies, print the top N number of data of the given input.

By default, it prints the first 10 lines of the specified files.

Example :tail [Link]

$ head -n 3 [Link]
OR
$ head -3 [Link]

 grep command

The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that
pattern. The pattern that is searched in the file is referred to as the regular expression (grep stands for global
search for regular expression and print out).

Options Description
-c : This prints only a count of the lines that match a pattern
$grep -c "unix" [Link]

-i : Ignores, case for matching


$grep -i "UNix" [Link]
-n : Display the matched lines and their line numbers.
grep -n "unix" [Link]

-w : Match whole word


$ grep -w "unix" [Link]

-o : Print only the matched parts of a matching line, with each such part on a separate output line.
$ grep -o "unix" [Link]

Pathnames
 pwd (print working directory)
Pathnames enable you to work out where you are in relation to the whole file-system.

For example, to find out the absolute pathname of your home-directory, type cd to get back to your home-
directory and then type : pwd

The full pathname will get display.

/home/user/Velocity-march

Removing files and directories

rm (remove), rmdir (remove directory)

To delete (remove) a file, use the rm command. As an example, we are going to create a copy of
the [Link] file then delete it.

rm [Link]

You can use the rmdir command to remove a directory (make sure it is empty first).

rm –r * : To delete all folders from directory

Displaying the contents of a file on the screen

 clear (clear screen)

Before you start the next section, you may like to clear the terminal window of the previous commands so
the output of the following commands can be clearly understood.

clear

This will clear all text.


 cat (concatenate)
Cat(concatenate) command is very frequently used in Linux. It reads data from the file and gives their content as
output. It helps us to create, view, concatenate files. So let us see some frequently used cat commands.
1) To view a single file
Command:
$cat filename
It will show content of given filename

2) To view multiple files


Command:
$cat file1 file2

3) To view contents of a file preceding with line numbers.


Command:
$cat -n filename
Output
It will show content with line number
example:-cat-n [Link]

4) Create a file
Command:
$ cat > newfile
Output:
Will create a file named newfile

5) Copy the contents of one file to another file.


Command:

$cat [filename-whose-contents-is-to-be-copied] > [destination-filename]


Output
The content will be copied in destination file.

7) Cat command can append the contents of one file to the end of another file.
Command:

$cat file1 >> file2


Output
Will append the contents of one file to the end of another file.

8) Cat command can display content in reverse order using tac command.
Command:

$tac filename
Output
Will display content in reverse order
9) Cat command can highlight the end of line.
Command:

$cat -E "filename"
Output :
Will highlight the end of line

 Exit command :

exit command is used to exit the shell where it is currently running.

You might also like