PDA

View Full Version : cant type filename in xterm? but can open it.


bakerbaker
05-07-2007, 12:01 PM
i opened xterm, ls and see all my files, and open/create new files using nano. however, when i "type filename.txt", it says no file found. what gives?

zorg
05-07-2007, 06:46 PM
Puzzling. If I say
type filename.txt
at a shell prompt, I expect it to say something like
filename.txt: not found
since it's highly unlikely that filename.txt can be
interpreted as a command and the type command
is used to determine how commands are interpreted.

If, on the other hand, I say
type ls
the type command replies that
ls is a tracked alias for /bin/ls

You can find out more about the type command by googling
bash type
or something similar like
tcsh type

For example, I did that and one of the first hits was a man page
for type at http://www.ss64.com/bash/type.html

It seems to me that MS-DOS has a type command that displays
the contents of a file. That may be what you're looking for.
If that's the case, you could say
more filename.txt
with the same effect.

more is not very satisfying. I installed less, which is a better
utility for viewing the contents of files, but my N800 crashed
and would not restart. I had to reflash it. Of course, I'm not
saying that less crashed it. I installed a dozen things in rapid
succession. I have not had time to do them all one at a time
to figure out what's causing the problem.

For the time being, I'm just using vim to view files. You can
open vim in readonly mode by saying
vim -r filename.txt
if you're concerned about accidentally changing files.

I just googled
linux tutorial
to see if there are good tutorials available. Most of the ones on
the first page appeared to suck donkey balls. This one was
impressive, though:
http://www.ee.surrey.ac.uk/Teaching/Unix/unix1.html
but it is for a particular university's system. There are
probably many things installed on their system that are
not on your Internet Tablet. You can eventually install
many of them, but you are probably on a very reduced
set of commands. You can probably find most of them
by typing
ls /bin
and
ls /usr/bin

Any particular command that doesn't seem to be working
can be checked with
which cmd
where cmd is the name of the command you are checking.

The biggest thing that seems to be missing from the N800
is the man command. That's how you would find out what
various commands can do. For most of them you can
google for a man page, but it can get tricky because you have
to avoid spurious results. For example, the most valuable
command in many circumstances is the find command.
I'm afraid that if you google find, you'll get ... well, I am an
idiot. I just checked and the very second hit is about the
find command!

Karel Jansens
05-07-2007, 07:00 PM
i opened xterm, ls and see all my files, and open/create new files using nano. however, when i "type filename.txt", it says no file found. what gives?

"type ./filename.txt" seems to work for non-executables.

Dietrich
05-07-2007, 07:59 PM
type isn't really what you want..

You can:

cat filename.txt | more

or

more filename.txt

or, if installed,

less filename.txt

or

install Midnight Commander which will let you view any file (mc).

less is most typically used.

bakerbaker
05-07-2007, 10:58 PM
Thanks all. More will do just finee...howabout aliases?...i created file with aliases of common commands i use...when i type source file, that also says not found. i Will try the ./...thanks

TA-t3
05-11-2007, 10:33 AM
With the built-in shell you probably want to use ". file" (note dot instead of source).

To add to the previous explanations: 'type' is a command to check the where and whens of a command, thus it looks in the directories listed in your PATH environment variable (which most probably doesn't include the directory you're currently in). It's mostly used to figure out where a command resides, and if it's an alias or not.

The 'more' and 'cat' commands are the ones you want for looking at file contents, and they look in the current directory unless you specify a path yourself.