Thanks!

Story: Things You Can't Do With a GUI: Finding Stuff on Linux Total Replies: 18
Author Content
jimbauwens

Jun 17, 2011
8:25 AM EDT
Thanks TC!

I find this guide very useful, it will be a great help for me in the future :)

Btw, I noticed that the date format with 'ls -lrt' on my system (Ubuntu) is different than on yours:

server@uServer:~$ ls -lrt
total 8538104
-rw-r--r-- 1 server server 940128522 2003-03-09 21:04 kjv.zip
-rw-r--r-- 1 server server 179 2010-05-06 14:56 examples.desktop
...


I wonder where those settings are stored.
TxtEdMacs

Jun 17, 2011
9:36 AM EDT
[serious]

For this command, why isn't the seventh column showing (time):

Quoting:$ ls -lrt | awk '{print $6" "$7" "$9 }' | grep 'May 22'

May 22 file_a.txt

May 22 file_b.txt


In addition, in my file output I only have eight columns under Mint 10. Does that reflect a difference in a server vs. a desktop system?

[Within the quote, I had to add an extra carriage return to put the second file on a separate line.]

[/serious]
tuxchick

Jun 17, 2011
11:27 AM EDT
MBT, the ls command behaves differently on different distros, which I never noticed before. That's why breaking down these long command strings and running them in chunks is the fast way to see what's going on. On my Debian box the date is displayed as May 22, on Ubuntu it's 2011-05-22, and the number of columns is different. So if you run just ls -lrt you'll see what your system does, and then you can adjust your other variables. On Ubuntu it looks like this:

ls -lrt | awk '{print $6" "$8 }'| grep '06-03'

2011-06-03 monowall.html

2011-06-03 monowall2.html

2011-06-03 10-best-never-heard-of.html

jdixon

Jun 17, 2011
12:06 PM EDT
Most distros create aliases for some of the more common commands to make them more "user friendly". One common one is to alias rm to rm -i to make it ask you before it deletes a file. They probably do the same thing to ls. I think Slackware aliases ls to ls --color, for example. The aliases should be set somewhere in your logon scripts, but since they vary so much from distro to distro, there's no telling where that might be.
Fettoosh

Jun 17, 2011
12:47 PM EDT
This might shed some light about Formatting file timestamps

info coreutils 'ls invocation' then enter /date

Quoting: 10.1.6 Formatting file timestamps ---------------------------------

By default, file timestamps are listed in abbreviated form. Most locales use a timestamp like `2002-03-30 23:45'. However, the default POSIX locale uses a date like `Mar 30 2002' for non-recent timestamps, and a date-without-year and time like `Mar 30 23:45' for recent timestamps.

A timestamp is considered to be "recent" if it is less than six months old, and is not dated in the future. If a timestamp dated today is not listed in recent form, the timestamp is in the future, which means you probably have clock skew problems which may break programs like `make' that rely on file timestamps.

Time stamps are listed according to the time zone rules specified by the `TZ' environment variable, or by the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. ...
Fettoosh

Jun 17, 2011
12:50 PM EDT
@Txt,

Your last quote tag is screwing up all the comments in the thread, would you get "really serious" and fix the don thing! Thank you.

Fettoosh

Jun 17, 2011
12:53 PM EDT
@Txt,

Unless it is intentional to annoy the heck of everyone!! :)

TxtEdMacs

Jun 17, 2011
1:10 PM EDT
Dear Footsie,

Sorry I cannot comply, since I reserve "really serious" tags for discussions where my words and past behaviour might imply some ambiguity in the mind of the reader. However, in this case, it should suffice to use just the "serious" tag along with a pure technical question to reinforce or make obvious my true intention.

As always,

YBT

P.S. Can I be allowed to use Bling* to look up the meaning of your alias?

* What it should have been named. As Bling it would have killed off Google.
hkwint

Jun 17, 2011
1:12 PM EDT
jimbauwens: Oh, you don't want to poke into that pile of feces!

Linux features a medieval keyboard / time localization system which is best left alone.

Sometimes, for some stupid behaviour hardcoded into the kernel, there isn't an answer except for 'because some medieval failure nobody cares about today once behaved stupid, and because Linus decided so' --> Refer to "Why doesn't the backspace key generate backspace by default?"

But you're asking, so anyway...

Who could tell this better, than man does. Of course, women could explain it just as well, but on this system "man" doesn't seem to be aliased...

So, from "man 7 locale", may I present you:
Quoting:A locale is a set of language and cultural rules. These cover aspects such as language for messages, different character sets, lexicographic conventions, etc. A program needs to be able to determine its locale and act accordingly to be portable to different cultures.


Believe me, the GNU people put a lot of efforts into this whole 'locale' project, but it's so darn huge I'm always lost when trying to comprehend, and what I want always just doesn't want to be possible - at least not on even days of the month.

Back to your PC: What does 'locale' show when you type it in the CLI?

For my Gentoo desktop, as I detest locales, it shows this:

LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=


Which is really boring. But probably, if you have installed Ubuntu using the installer, chances are it was very creative and gave you a really nice listing!

Probably, you want to be looking at 'LC_TIME'. Maybe it puts your time in Belgian (or should I say Flandrian?) format, because you told Ubuntu that was where you are based.

These settings normally are sourced from some initalization file, which may or may not reside in /etc/env.d. On Gentoo it is, but that's of no particular use to Ubuntu users.

As I'm not lazy today, only in ranting mode and stressed out because migration to KMail2 just went pretty wrong, kwallet doesn't boot nor accept my password, and the whole thing is a pile of garbage, but again because I'm not lazy today, I tried it on my Debian VPS. Which shows this:

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


Like you see, I did my very best to keep it as boring as possible - using standard locales wherever I could.

Maybe some more explanation as to why I detest the freaking things: Once I tried sorting out how they work and using them to my advantage, but then all kind of strange things started to happen, and it still gives me nightmares! The very same is true on Windows, once my entire document system (PLM) stopped working as I told Windows I was based in the Netherlands, and wanted a comma as a decimal separator. Better stay clear of it! Not to mention termcap. But also on Debian Linux (or so, mayde it was Ubuntu), spending over two days trying to fix garbled Midnight Commander output. Sadly, I can't post a screenshot, as today it seems for a change, my mc decided to show "jut fine, like it ought to". Hmm, odd.

Anyway, it seems there are some plain text configuration files and you can compile them to 'locale'-files.

On Debian, I found something in /etc/default/locale. The file only says:

LANG=en_US.UTF-8

Again, pretty boring.

When you do an (s)locate for 'locale', you get tons of them! "man 5 locale" and "man 7 locale" give lots of gory details, probably more than you ever wanted to know.

You can google around a bit, and find pages like this one, telling about Debian and locales.
hkwint

Jun 17, 2011
1:25 PM EDT
Oh, now I comprehend; just like there's ARMEL, you have "Jimel" time, where "el" is for Little Endian.

Seems the fault of Debian, mine is also in JIMEL-format:

drwxr-xr-x 9 root root    4096 2011-03-05 16:38 X11
drwxr-xr-x 2 root root    4096 2011-03-27 15:37 menu
drwxr-xr-x 2 root root    4096 2011-03-27 15:37 menu-methods
drwxr-xr-x 2 root root    4096 2011-03-27 15:37 bash_completion.d
drwxr-xr-x 4 root root    4096 2011-03-27 15:37 apt
-rw-r--r-- 1 root root    2501 2011-06-17 19:30 hosts.allow


and here is Gentoo's POSIX one:

-rw-r--r-- 1 root root  235 Aug 26  2007 00basic
-rw-r--r-- 1 root root  139 Jan 25  2008 02distcc
-rw-r----- 1 root root    0 Jun  9  2008 02locale
-rw-r--r-- 1 root root   79 Jan 14  2009 20java-config
drwxr-xr-x 3 root root 4096 Jun  6  2009 cblas
-rw-r--r-- 1 root root   35 Oct 26  2009 70klibc
-rw-r--r-- 1 root root   71 Mar  6  2010 99fltk-1.1
...
-rw-r--r-- 1 root root   59 Mar 16 03:43 50gconf
-rw-r--r-- 1 root root   33 Mar 16 04:52 08xulrunner
-rw-r--r-- 1 root root   44 Mar 17 17:39 37fontconfig
drwxr-xr-x 2 root root 4096 Mar 17 18:37 gcc
-rw-r--r-- 1 root root  269 Mar 17 18:37 05gcc-i686-pc-linux-gnu
-rw-r--r-- 1 root root   37 Mar 17 19:05 00glibc
-rw-r--r-- 1 root root   14 Mar 17 19:17 50gtk2
-rw-r--r-- 1 root root  140 Mar 17 19:34 03opengl
-rw-r--r-- 1 root root   88 Mar 17 19:37 90nss
-rw-r--r-- 1 root root   22 Mar 17 19:50 44qt4
-rw-r--r-- 1 root root   29 Apr  5 18:07 90virtualbox
-rw-r--r-- 1 root root   55 Jun 17 18:08 43kdepaths


As you might not expect, the Gentoo output is less consistent but more user friendly IMNSHO.
hkwint

Jun 17, 2011
1:46 PM EDT
Sorry for wasting lots of space, but I was wrong... It seems it's lots simpler - or much more complex. Debian nowadays defaults to "ls --time-style=long-iso".

Here it is:

http://people.debian.org/~osamu/pub/po4a/html/ch09.en.html#_...

Quoting:The actual default display format for each locale depends on the version of the standard C library (the libc6 package) used. I.e., different releases of Debian had different defaults.


So, Debian is both hard to understand and inconsistent. While Gentoo just uses POSIX.

Hey, did I tell recently, "many times I don't like Debian because many times it's stupid, and many times Gentoo is more user friendly?"

Think I should.
Fettoosh

Jun 17, 2011
1:53 PM EDT
Quoting:P.S. Can I be allowed to use Bling* to look up the meaning of your alias?


ahhh, Well, I guess you could use a search engine since you weren't able to guess it. But I rather prefer you use Google since Bing/Bling is not my cup of tea.

Now I am not sure if it is your comment that is causing the comments to be chopped off at the right, but if it is, be nice and fix your text in the "quote".

TxtEdMacs

Jun 17, 2011
3:02 PM EDT
[serious]

I have seen comments being cut off previously, however, on this laptop with a 17 inch screen I am seeing no cutoff now. Moreover, since you are seeing my serious tags (only for me, not part of LXer) with the brackets, I doubt I am having an effect on the LXer display characteristics.

If you preview a comment, just above the comment being displayed there is a list of LXer tags and being [serious] should not be affecting LXer's visual characteristics. I thought you were joking, hence, I replied in kind. However, should you have a basis for believing my tags have a deleterious effect mention it to jimbauwens. It was my impression s/he worked on the code for the comments section. Or go directly to Bob, since I might be mistaken and he would know whom to contact.

[/serious]
jimbauwens

Jun 17, 2011
4:20 PM EDT
YBT wrote:However, should you have a basis for believing my tags have a deleterious effect mention it to jimbauwens. It was my impression s/he worked on the code for the comments section. Or go directly to Bob, since I might be mistaken and he would know whom to contact.


First of all, I'm a he :) Second, I didn't code anything here on LXer, its all done by Bob and Dave, and Bob is the one you should contact for bug reports.
The only thing I did was take LXer down a couple of times x)
jimbauwens

Jun 17, 2011
4:21 PM EDT
@Hans, Thanks for all the information!
Now I understand :)

And in case you are wondering, here is my locale:

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


My OS is English, as I hate Dutch :)
Fettoosh

Jun 17, 2011
4:29 PM EDT
@Txt,

I was mixing serious with joking but, after I inspected the code more closely, you will be happy to learn that your comment is NOT causing the cutoff. Sorry about that

Actually, It is both jimbauwens & hkwint due to the text copied from Terminal. Hopefully they will read this note and fix it by editing their comments by cut & paste from this page itself.

Sorry again.

BernardSwiss

Jun 17, 2011
7:27 PM EDT
Quoting:P.S. Can I be allowed to use Bling* to look up the meaning of your alias?

* What it should have been named. As Bling it would have killed off Google.


You mean it's NOT called "Bling"?

;-P

No wonder my (perverse, masochistic) attempts to at least try it out have failed so miserably!

hkwint

Jun 19, 2011
10:39 AM EDT
Yeah, sorry, LXer eats carriage returns when it's hungry. It seems on odd days of even months it is hungry.

So if you copy/paste from the termenal, thou shalt use "code" tags (between square brackets) or come with something else, LXer's 12th commandment tells.
Fettoosh

Jun 19, 2011
1:40 PM EDT
Not a big deal because when it happens, I use Ctrl - to zoom out as needed, or until text is no longer legible.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!