Into the world of unix:

Ritika Singh
4 min readMar 18, 2021

--

UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity.

~Dennis Ritchie

The unix logo, a plump penguin known as Tux welcomes you!

An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. One such operating system is Unix.

The UNIX operating system :

The UNIX operating system is made up of three parts; the kernel, the shell and the programs.

1. 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.

2.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).

3.Application (Commands and Utilities and Files and Directories )

Commands and Utilities — There are various commands and utilities which you can make use of in your day to day activities. cp, mv, cat and grep, etc. are few examples of commands and utilities. There are over 250 standard commands plus numerous others provided through 3rd party software. All the commands come along with various options.

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.

Unix operating system, which consists of Kernel ,Shells , Utilities and Applications.
Unix operating system, which consists of Kernel ,Shells , Utilities and Applications.

NOTE : If you have a linux based OS then you are good to go , but if you have windows then install WSL (Windows Subsystem For Linux).Click on the link to get WSL.

https://www.windowscentral.com/install-windows-subsystem-linux-windows-10

Some basic commands for unix are :

./ — refers to the folder we are in.

pwd(present working directory) — provides the path to the present directory.

ls — lists all the contents of a directory.

cd — changes the directory.

cd .. — takes us out of the present directory.

man ls - prints the manual with all the basic commands.

ls -l — prints the contents of the directory in long format.

ls -la — prints all the files and folders in the directory including the hidden files.

clear — clears the screen.

exit- closes the terminal.

cd /: — changes the directory to the root directory.

Unix file system:

Unix file system is broadly classified into four types : ordinary files ,directories ,special files and pipes.

The Unix File System consists of major four types of files :

1. Ordinary Files

These files are used to store information of the users. It may be some text or any image which is stored. It is normally located under a directory and does not contain any other files.

2. Directories

Directories help in organizing the files which are present. The directories can contain ordinary files, special files or even other directories. All these directories are the descendants of the root directory.

3. Special Files

The special files are used to represent physical devices like printer, tape driver or a terminal. Unix considers any device to be a file. Even the terminal is considered to be a file. It is considered as standard input file from where input is read. This terminal is also the standard output file which is the command’s output.

CRUD (create , read ,update , delete) COMMANDS :

The above commands can run on file as well as database level.

Create :

1. “touch” command:

The command “touch hello-world.txt “ will create a file called hello-world.txt

2. “mkdir” command :

This command is used to create a directory.

read :

1.”head” command :

The command “head hello-worl.txt” will print the first 10 lines of the given file. We can change the number of lines it reads by using ‘-n’ after the head command , where n is the number of lines we want to read from the above.

2. “tail” command :

The command “tail hello-worl.txt” will print the last10 lines of the given file. We can change the number of lines it reads by using ‘-n’ after the tail command , where n is the number of lines we want to read from below.

3. cat (concatenate) command :

This command is used to read the content of one or many files .

Update:

1.“nano” command :

this command opens a CLI text editor and we can store our content here. We use ctrl+x to exit the editor . It is then when the editor asks if we want to make changes, followed by where we want to save the changes.

delete :

1.rm:

removes/deletes a file.

2.rm -r :

(r stands for recusively) deletes contents of a directory one by one.

3.rmdir :

deletes directory only if it is empty.

4.rm -i:

also deletes files in a directory but asks for permission before deleting each and every file.

--

--

Ritika Singh
0 Followers

I write what I feel. Writing has always been a gateway to me being my most authentic self , feeling heard , worthy , happy and content .