Basics of UNIX Programming

What is UNIX?

Actually UNIX was originally spelled 'Unics' (Uniplexed  Information and Computing Services). The UNIX operating system is a set of various programs which act as a link or interface between the computer and the user. The computer programs which allocate system resources and coordinate all the computer internal's is called as Operating System or we also called it as Kernel.
User communicate with the kernel through an interface or program called as Shell. A shell is type of command line interpreter which translates user commands into Kernel Language (Language which is understood by the kernel).
The Linux that we often heard of is a type of UNIX operating system of better say it as flavor of UNIX.

Some Basic Commands

There are various commands and utilities that we use in our day to day activities in UNIX. 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.
First whenever you first connect to UNIX system then you are prompted to a login screen where you have to login with your username and password.
To change that password we use

1.passwd

passwd command is used to change your password.
Note: Carefully write a command because UNIX is case-sensitive.
Syntax: passwd

2.cal

Command opens up the calender.
Syntax: cal

3.ls

All the data in UNIX is organised into files, all files are organised into directories and all directories are organised into tree like structure called filesystem.
ls stands for listing. And this command is used to list files or directories in a particular directory.
Syntax: ls or ls dir_name or ls file_name or ls 1stdir/2nddir

4.mkdir

Command is used to create a directory.
Syntac: mkdir dir_name or mkdir 1stdir/2nddirec

5.rmdir

Command is used to remove a particular directory.
Syntax: rmdir dir_name or rmdir 1stdir/2nddir

6.cp

Command is used to copy one file content to another file and also for copy whole file from one directory to another directory.
Syntax: cp file_name dir_name/file_name

7.mv

Command is used to move one file from one directory to another. It is also used to rename files.
Syntax: mv file_name dir_name or mv old_name new_name

8.whoami

This command will show you your username or loginid.
Syntax: whoami

9.who

This command will show you the list of all the users that are currently working on the same UNIX environment.
Syntax: who

10.touch

The main purpose of this command is Update access and modification time of a file. But we also used it to create a file.
Syntax: touch file_name

11.man

man stands for manual. It is a kind of help which provides everything about a particular command i.e it's attributes and their work and much more.
Syntax: man ls or man cp or man mv or man touch


12.vi

vi is used to crate a file.
Syntax: i.) vi file_name
ii.)Type your file content by typing i after creation.
iii.)Exit from inserting by pressing esc then exit completely from editing by pressing shift+zz.

13.rm

rm is used to delete a file.
Syntax: rm file_name

So these are some basic commands that one should know, but their are much more of commands in UNIX.
Previous
Next Post »