if we want to view more than one file at the same time in the same terminal, we can use the vi editor along with its command split
For e.g. let us say we have two files file1 and file2 that we want to view together in the same terminal then we can do it as follows.
1. Open a terminal and type
2. After file1 opens, go to the command mode and by pressing "esc".
3. Enter
As a result of this command we should see the terminal split into two halves, the top half displaying the file2 and the bottom half displaying the file1 as shown in the figure below.
By default the split of the terminal happens in the horizontal direction. In case we want to split the terminal in the vertical direction we can use the command vsplit instead of split and the files would look as shown below.
The window which has the cursor is indicated by highlighting corresponding file name . In the figure above we can see that the file2 is highlighted indicating that the cursor is present in the window of file2.
Cursor movement:
To move the cursor from on window to other
cntrl + w , up arrow to move to window above
cntrl + w , down arrow to move to window below
cntrl + w , right arrow to move to window on the right
cntrl + w , left arrow to move to window on the left
To quit
Move to the corresponding window using the cursor movement shown above and use the normal quit command :q
We can open as many windows as we wish using the split, the figure shows 4 files in 4 winodws being opened.
For e.g. let us say we have two files file1 and file2 that we want to view together in the same terminal then we can do it as follows.
1. Open a terminal and type
2. After file1 opens, go to the command mode and by pressing "esc".
3. Enter
As a result of this command we should see the terminal split into two halves, the top half displaying the file2 and the bottom half displaying the file1 as shown in the figure below.
By default the split of the terminal happens in the horizontal direction. In case we want to split the terminal in the vertical direction we can use the command vsplit instead of split and the files would look as shown below.
The window which has the cursor is indicated by highlighting corresponding file name . In the figure above we can see that the file2 is highlighted indicating that the cursor is present in the window of file2.
Cursor movement:
To move the cursor from on window to other
cntrl + w , up arrow to move to window above
cntrl + w , down arrow to move to window below
cntrl + w , right arrow to move to window on the right
cntrl + w , left arrow to move to window on the left
To quit
Move to the corresponding window using the cursor movement shown above and use the normal quit command :q
We can open as many windows as we wish using the split, the figure shows 4 files in 4 winodws being opened.
This comment has been removed by a blog administrator.
ReplyDelete