[mdlug] UNIX tips: Learn 10 good UNIX usage habits

Aaron Kulkis akulkis3 at hotpop.com
Wed Mar 12 00:32:45 EDT 2008


Raymond McLaughlin wrote:
> Aaron Kulkis wrote:
>> Clinton V. Weiss wrote:
>>
>>> 3. I want to quickly read the contents of the file.
>>>
>>> Clinton =)
>> That would be true in 1983.
>> However, since then has come the invention
>> of both more....and less, too!
>>
>> more file
>> or  cmd | more
>>
>>
>> less file
>> or  cmd | less]
>>
>>
>> (Less allows you to page backwards through piped input).
> 
> How ever, a pager such as less requires you to exit before you can
> continue to work, and is not suitable for piping. I use both, my choice
> depending on the context, expected size of out put, and ultimate intention.
> 

Yes.. less erases it's display from the screen before exiting,
which can be annoying when trying to refer to a man page and
build a command line... I always end up opening a second
tty window.

> For instance, if I'm working in a graphical console with a large scroll
> back buffer I might just cat a file, and scroll back and forth with my
> mouse, perhaps selecting parts of the text for some copy/paste
> operation. Also, the "cat file | " syntax might be less direct than the
> redirect syntax, but I'm inclined to use "cat file" to see the content
> of a file, and then "<Up Arrow> | ..." to avoid retyping a (possibly
> long) file descriptor.
> 
> Both less and cat can be useful tools. I would give some thought to
> efficiency in writing a script, but at the command line I would opt for
> less typing.

Ever notice that after thousands of repetitions, some
commands just seem to get typed out automatically without
even thinking about it?

For example, I'm in such a habit from years of using "more"
that if I don't pause momentarily to type "less"... I won't.

Then there's the going back and forth between BSD and SysV
style ps...

in college, I used
ps guax

most of the business world systems use System V ps...
ps -efl

Fortunately, Linux (gnu) ps recognizes both ... if
you use a -flags style, it assumes SystemV flags...
if you don't use a -, then it assumes BSD flags.







More information about the mdlug mailing list