[Novalug] Command line question

Peter Larsen plarsen@famlarsen.homelinux.com
Sat Jan 1 03:34:05 EST 2011


On Sat, 2011-01-01 at 00:29 -0500, cmhowe@patriot.net wrote:

> > List,
> >
> > I started a file (not an official file; a narrative that I will update
> > frequently). I created it with
> >
> >   $gedit /home/chasmhowe/environment/myfile


Charlie,
First I think you may find it useful to get familiar with $PWD - or
Print Working Directory. Try typing "pwd" on the command line, and
you'll be shown your current (working) directory. This information is
very useful because it allows you to make relative paths - which are
usually MUCH MUCH shorter than full/absolute paths.

For instance - let's say my user's home directory is /home/plarsen.
When I login, and I type pwd I will be told /home/plarsen is the current
directory. This means, that when I write "mkdir special" I actually
create /home/plarsen/special.  I can then do "cd special" and then "pwd"
which will show /home/plarsen/special.  If I want to operate on files in
this directory, all I need to type is the filename: vim mytextfile.txt
And this will (when I write the file) create a
file /home/plarsen/special/mytextfile.txt. As you can see, much less
typing.

There are a few other tricks with relative paths: 

. = current directory
.. = parent directory
~ = my home directory (or you can use $HOME)

(you may have noticed those when you do an ls -a). These are full and
valid directory names. So, assuming I want to
edit /home/plarsen/.bash_profile and my pwd is /home/plarsen/special, I
can edit the file by saying: vim ../.bash_profile

Notice again how little I write. It makes using command lines a lot
easier. 


> > After a few minutes, I decided that I preferred to use oowriter. I had a
> > senior moment and forgot that I could do it by executing
> >
> >   $oowriter /home/chasmhowe/environment/myfile.odt


Well, oowriter (Open Office Writer) is usually just launched from the
menu. When you do that, it's a simple gui menu you pick/create files
with. The reason we use the menu, is that like gedit, it's X only.
You'll find that in GNOME you can actually bookmark directories so you
can easily pick them as you need to open/save files there.

That said you can certainly write commands like you do. But with
oowriter the buffer usually isn't named until you save the file, or if
you open an existing file.


> > so I decided to start from the beginning. I wasted only a minute or two,
> > so no regrets. 


Well, you really didn't need to. oowriter can read text files quite
easily. Check the "insert menu". Another option is the old fashioned
copy/paste function. Copy from gedit and paste into oowriter. Works
perfectly. However, do realize the two editors are very different.
oowriter isn't creating text files but actual work-processor formatted
files, with fonts, paragraphs, page breaks etc. - gedit isn't. It's just
a text file. So oowriter is a lot more powerful, but as you realized the
file formats aren't compatible. oowriter WILL however open text files
just fine. Saving back to a text file from oowriter is possible but
you'll loose a lot by doing so (hence the warning oowriter gives you
when you try to do that).


> But I relate this to remind users that they may be able to
> > salvage their work if they want to do a similar conversion.


Again - no need to salvage anything in this case actual. 


> >
> > On to my question.
> >
> > I do
> >
> >   $rm /home/chasmhowe/environment/myfile
> >
> > and it comes back


This statement I'm not sure I understand?  "it comes back" does that
mean you get a $ prompt without anything else written to the screen? If
so, that's what rm does if it successfully deletes a file. If you want
to see what rm is doing, try "rm -v filename".

Btw. my script/bash background makes it a bit hard to read $rm as
anything but "the content of the rm variable". Reading your email a few
times made it clear that this is not in your context. However, I would
suggest that you in the future just write $ command par1 par2  - using a
space after $ makes it a lot clearer.


> > All I can do is cntrl-c. 


I don't understand. If it comes back to the command line, no need for
ctrl-c.



> Whoops! (twice) First whoops: I should have said
> 
>   $oowriter /home/chasmhowe/environment/myfile
> 
> instead of
> 
>   $gedit /home/chasmhowe/environment/myfile
> 
> The next whoops is that it did the same thing. When I did
> 
>   $oowriter /home/chasmhowe/environment/myfile
> 
> it still came back


That's natural. You're starting a GUI/X program - consider it a
background application. So you should see the oowriter open even though
you're getting the next $ on the command line (again, we usually do not
use the command line to start oowriter). If oowriter is already running,
this is where it may get a bit hairy for you. You should notice the
oowriter icon on the task bar changes color and/or starts flashing. This
means it needs "attention". Simply click on it, and you'll see your
document opened in oowriter.


> I think it through and believe that what worked before doen't work for me
> now. What am I doing wrong?



Nothing really. I think you're expecting one set of functionality and
getting another. Both gedit and oowriter are gnome programs. They do not
operate/use the terminal at all. nano, vim and even emacs are all
terminal based editors and I think you'll find using them does what you
expect them to do.

Regards
  Peter Larsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20110101/d00a9d9f/attachment.htm>


More information about the Novalug mailing list