You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, October 26th 2003, 5:50pm

Linux Command Problems & Questions ---APPENDED

Some of my questions in the original document seemed to be quite dificult to read, so here they are again together with some new tries to explain the situation. Thanks for everybody's help.


First question:
1. What does it mean really, that X does not have to display the graphics with the characteristics the klient wants, but only has to treat it as if it had those chracteristics?

New Q1:The client is any program sending requests to X about graphics displays (or the user I guess if you are just so hot on doing it all manually) Characteristics refers to the window's properties. In my book on Linux they tell you, that X handles the output to the screen, and that the client-program has to draw windows, borders, whatever or it won't get any from X. Then they also tell you that X doesn't have to display the window the way the client have asked of it, but rather treat it as if it had those characteristics. How would that happen? I'm puzzled.

2. When I use ls -1 the system reports 8 files and shows 2, but when I use -al the system reports 132 files and shows 42 (including dot-files). Why does it only report a total of 8 files if there is 132, and why, when using -al, does it only show 42 files, when it should show all?

NewQ2:

[...]$ ls -l
total 8

List of files (2) This i can understand, since -l only lists certain files.
-some of which are the files you've created yourself.

[...]$ ls -al
total 132

List of files (42, including 'dot'-files) This I don't understand, since
it hould show all files.
It does this even when I'm root. And why all of a sudden is there 132 files, when above there was a total of only 8, and where did the rest come from?


3. When reading about Linux you are told that when using ls -al Linux will not give the size of the directory, but rather the size of its control file or such. What does it mean?

NewQ3: If it's really the size of a special file, holding the entries of the directory, that's given using ls -l, how do I find out the actual size of the directory (it's contents')?


6. Why does Linux report so many directories (what seems lik the hole /) when I'm trying to look for a directory with find, before printing it at the end, and also all of its contents, or when there just isn't any hits? And why do I get a find error message saying the directory or file doesn´t exist, when it has actually found it for me already?

NewQ6:
You asked what exactly I had typed in. Here's the whole list:

find /home/Tillus /Dokument Frågor.abw
Frågor Lists the directory + error message
I can understand that these first won't really work since they don't follow the syntax, but why do they give a result at all and not just an error message?

/home/Tillus Dokument
Lists the hole directory + lots of others, no error message
The same with this one. Why not an error message?

/home/Tillus/Dokument -name /Dokument
no results, no error message

/home/Tillus/Dokument -name Frågor
no results, no error message
Why not error messages on these two?

/home/Tillus/Dokument -name Frågor.abw
Frågor*
Frå*
Pathname
Works, apparently

2

Sunday, October 26th 2003, 8:26pm

Re: Linux Command Problems & Questions ---APPENDED

Quoted

Original von Tillus

New Q1: ...

Sorry, can't help you there.


Quoted

Original von Tillus


2. When I use ls -1 the system reports 8 files and shows 2, but when I use -al the system reports 132 files and shows 42 (including dot-files). Why does it only report a total of 8 files if there is 132, and why, when using -al, does it only show 42 files, when it should show all?

NewQ2:

[...]$ ls -l
total 8

List of files (2) This i can understand, since -l only lists certain files.
-some of which are the files you've created yourself.

[...]$ ls -al
total 132

List of files (42, including 'dot'-files) This I don't understand, since
it hould show all files.
It does this even when I'm root. And why all of a sudden is there 132 files, when above there was a total of only 8, and where did the rest come from?


Ah, I see. That's simple, the "total" is not the number of files ;-)

From the man page of ls, option -l:
-l, --format=long, --format=verbose
[...]
For each directory that is listed, preface the files with a line `total
blocks', where blocks is the total disk space used by all files in that
directory.

Quoted

Original von Tillus


3. When reading about Linux you are told that when using ls -al Linux will not give the size of the directory, but rather the size of its control file or such. What does it mean?

NewQ3: If it's really the size of a special file, holding the entries of the directory, that's given using ls -l, how do I find out the actual size of the directory (it's contents')?


Use the "total" from above ;-)
or
du -sk dirname
(the latter one sums up subdirectories)

3

Sunday, October 26th 2003, 8:46pm

Re: Linux Command Problems & Questions ---APPENDED

Quoted

Original von Tillus

NewQ6:
You asked what exactly I had typed in. Here's the whole list:

find /home/Tillus /Dokument Frågor.abw
Frågor Lists the directory + error message
I can understand that these first won't really work since they don't follow the syntax, but why do they give a result at all and not just an error message?

find accepts more than one argument:
find dir1 dir2 file3
and it processes its arguments left to right.
Here's what I guess what happens:
It lists the directory /home/Tillus (which exists),
then doesn't find the directory /Dokument (because it doesn't exist)
then doesn't find the file Frågor.abw in the current directory
and prints two error messages.

Quoted

Original von Tillus


/home/Tillus Dokument
Lists the hole directory + lots of others, no error message
The same with this one. Why not an error message?

I guess you're in your home directory where there's a subdir
called Dokument. So find finds both /home/Tillus and Dokument,
lists both -> no error.

Quoted

Original von Tillus


/home/Tillus/Dokument -name /Dokument
no results, no error message

...because the directory /home/Tillus/Dokument exists,
but you don't have a file or directory in it called "/Dokument"
(including the slash!)

Quoted

Original von Tillus


/home/Tillus/Dokument -name Frågor
no results, no error message
Why not error messages on these two?

...because the dir /home/Tillus/Dokument exists
but the name Frågor doesn't match
as the file is called Frågor.abw

Quoted

Original von Tillus


/home/Tillus/Dokument -name Frågor.abw
Frågor*
Frå*
Pathname
Works, apparently

Yes, because all those patterns match the real filename.

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Monday, October 27th 2003, 9:56am

Re: Linux Command Problems & Questions ---APPENDED

Quoted

Original von Tillus

First question:
1. What does it mean really, that X does not have to display the graphics with the characteristics the klient wants, but only has to treat it as if it had those chracteristics?

Not sure what this is referring to, but perhaps it means that the X server will only display what it is able to.
For example if your program wants to display a true color image and the X server can only to 8bit color, it might display the image but with reduced colors.

Quoted


Then they also tell you that X doesn't have to display the window the way the client have asked of it, but rather treat it as if it had those characteristics. How would that happen? I'm puzzled.

I think this referres to the window properties.
How the decoration (border, minimize/maximize buttons, etc) is drawn is up to the window manager.
A program can request certain properties using so-called window manager hints, but the window manager is the one who decides which one to apply and which to ignore.
However most window manager will apply the requested hints, but theoretically they wouldn't have to.

Cheers,
_
Qt/KDE Developer
Debian User

5

Monday, October 27th 2003, 3:02pm

Re: Linux Command Problems & Questions ---APPENDED

Quoted

Original von Tillus

Some of my questions in the original document seemed to be quite dificult to read, so here they are again together with some new tries to explain the situation. Thanks for everybody's help.


First question:
1. What does it mean really, that X does not have to display the graphics with the characteristics the klient wants, but only has to treat it as if it had those chracteristics?

New Q1:The client is any program sending requests to X about graphics displays (or the user I guess if you are just so hot on doing it all manually) Characteristics refers to the window's properties. In my book on Linux they tell you, that X handles the output to the screen, and that the client-program has to draw windows, borders, whatever or it won't get any from X. Then they also tell you that X doesn't have to display the window the way the client have asked of it, but rather treat it as if it had those characteristics. How would that happen? I'm puzzled.


I suppose that it means that there could be a window manager, like KDE's.

Quoted


3. When reading about Linux you are told that when using ls -al Linux will not give the size of the directory, but rather the size of its control file or such. What does it mean?

NewQ3: If it's really the size of a special file, holding the entries of the directory, that's given using ls -l, how do I find out the actual size of the directory (it's contents')?


You can use du

Have a nice day!

6

Monday, October 27th 2003, 4:46pm

I have written to use du, but that gives the sizes of all files in the directory and above.

That is perhaps not what you meant.

If you want cound the number of files, the best is to use a tool to count lines:
wc -l

So you have a few posibilties:
ls -1 | wc -l
find | wc -l

For counting only the files
find -type f | wc -l
For counting only the irectories:
find -type d | wc -l

With these counts, you normally count . and .. too, which might not what you want either.

Have a nice day!