954,234 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

commands

whats the use of less & more commands in shell programming???
can anyone help......
I hav read on net but i didnt get how to use it.........

shama_kandy
Newbie Poster
19 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

Okay, it's good that you're interested!

Let's take an example:
You have a file which is 1Gb in size. You know that opening the file in the shell (e.g using 'cat') is going to be inefficient, as you'll have to scroll through a lot of lines to get to where you want to look. So less and more are basically alternatives to save resources and/or to only select the information that you're interested in.

The default behaviour of more is that the file content scrolls up one screen height at a time, and the space bar is used to advance to the next page. The command less is a more sophisticated version of more. Less can scroll backwards and has many more options over more. (There is plenty of information about this on the web).

If you're viewing a large log file and are only interested in what's happened most recently, then I would usually recommend using 'tail -f file.log' which would display the last 'x' number of lines of that file.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 63
 

thanx...

shama_kandy
Newbie Poster
19 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: