Linux Open Source Revolution.

Managed by Ambarish......partner with Prateek Verma.

The human knowledge belongs to the world.

Source code availability ensures it does belong to the world.

Everything free.

Even full fledged softwares.

Website's motive.

To spread awareness about the free and open source world.

Showing posts with label Unix programming. Show all posts
Showing posts with label Unix programming. Show all posts

Sunday, 21 April 2013

Some basic Linux and Unix vi commands

The vi editor is a very powerful tool to edit text, programs in Linux / Unix. VI editor is the standard text editor for all the UNIX systems and is used extensively. Commands in vi editor are input from keyboard only and no switching to mouse is required. 
  • Moving through the Text can be performed using Arrow keys. 
Basic Operation: Some Popular vi commands
  • :q exits the editor
  • :w saves the file
  • :wq save the file and then exits
  • :n moves to line n of a file
  • x will delete the character on which the cursor is positioned
  • n dw wil delete n characters to the right of the cursor
  • n dd will delete n lines from the current position of the cursor
  • :q! exits a file even if you have unsaved changes, can be referred as force exit
  • :w newfile will save the text in editor to the newfile
  • :wq! overrides read-only permission, only if you have access to change the read-only permission. Generally for root accounts. 
  • yy will copy a block of text
  • n p will paste it for n number of times
  • :recover recovers a file from any unexpected interruption
Switching the editor to insert mode. 
  • i to insert
  • a to append
  • o insert a blank line next to the cursor position and moves the cursor to that line
Learning all these commands is an easy job and any one using vi editor has to go through these all the times. If you are a Linux/UNIX newbie, these are must to get used to. 

mb.
Open source World.

Monday, 18 February 2013

Learn Unix : Introduction to beginners.

Learn UNIX : Chapter 1. What is Unix. Short description to kernel, shell, and commands related to listing files and directories.

Lets begin UNIX Introduction with the question "What is UNIX"? 

Unix is an operating system just like Windows, which was developed in 60s and is in development ever since. Basically started with just command lines, its now have a Graphical Interface. There are different versions of UNIX, like Sun Solaris, GNU/Linux and Mac OS X. However, we in the tutorials will cover with Linux Operating System. 

There is basically three parts of a UNIX operating System: the kernel, the shell, and the programs. 

Now, What is a Kernel? 
The kernel is a part of Operating system which basically handles hardware interaction and allocation of time and memory to programs and management of System calls. 
The shell. It acts as an interface between the user and the kernel. 
Files and Processes. If anything is in Unix, its either a process or a file. A file is a collection of data stored for future use or whenever needed. A process is a program in execution. For ex, lets say you write a piece of code, and stored it in a file. When you execute that file, its a process. And is assigned a Process ID.

What is a Unix Terminal? 
You can get to know about it here in my earlier post introduction-to-shell-programming.

Listing Files and Directories. 

ls         list files and directories. 
List all the Directories and files that are present in the current Directory. However, it doesn't list files with (.) as beginning. As files starting with .(dot) are hidden files. 

ls -a list all files and directories. 
It lists all directories and Files even if they begin with a dot in the Current directory. 

mkdir <directory_name> make a directory. (A directory in Linux/Unix is a Folder in windows.)
Make a directory of the mentioned directory name.

cd <directory> change to directory. <directory> is the name of the directory to change to. 

cd ~  change to home directory. 

cd ..  change to parent directory. 
For ex. if you are in a\b\c and execute command cd .. you will go to a\b

pwd display the path of the current directory. 



Related Posts Plugin for WordPress, Blogger...