LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2009, 06:48 AM   #1
kea_kea
LQ Newbie
 
Registered: Mar 2006
Posts: 23

Rep: Reputation: 0
Date format of `ls` via ssh


Hi,

I'm sorry to say that but I was not able to find how to set a default format for `ls -l` to have the same format a) on my local machine, at bash prompt; b) on my remote machine after logging in via ssh; c) at remote command execution via ssh. So

if I make an `ls -l` locally (a), the result is:
-rw------- 1 kea users 0 2009-11-30 13:38 somefile

if I log in remotely (b) the result is the same (TIMEFORMAT is set in /etc/profile in both machines)

but after an `ssh remotecomputer "ls -l somefile" the result is:
-rw-r--r-- 1 kea users 0 Nov 30 13:38 somefile

If I tell the required time-style to ls explicitly it works...:
`ssh remotecomputer "ls -l --time-style=+'%a %b %d %T %Y' somefile"`

...but I would like to have a default date format for this case, too.

The question is how to set up the same default date format for remote command execution?

Thx, KEA.
 
Old 11-30-2009, 12:59 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,836

Rep: Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758
Each shell loads defaults. Your ssh shell is simply loading different ones.
Try sourcing /etc/profile.d/*
 
Old 11-30-2009, 03:30 PM   #3
kea_kea
LQ Newbie
 
Registered: Mar 2006
Posts: 23

Original Poster
Rep: Reputation: 0
Business_kid,

there are some (c)sh files in /etc/profile.d/, none of them contains a 'time-style' nor a 'format' string, and none of them has a file name which would be around ls or ssh (ati-fglrx.sh ... tetex.sh). In addition I'm not sure that in case of remote command execution ssh executes a .bashrc or any similar one.
 
Old 12-01-2009, 05:18 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,836

Rep: Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758
~/.bash_profile, ~/.bashrc, mebbe /etc/bashrc or /etc/environment /etc/sysconfig/* ? It's set somewhere. grep is great. I only have slackware here.
 
Old 12-01-2009, 05:35 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Try running

Code:
echo $LANG
on both machines. The default is probably different. You can set it in you .bash_profile (or similar).

If it is the same look closely at the output of
Code:
env
on both machines.

Cheers,

Evo2.
 
Old 12-02-2009, 10:55 AM   #6
kea_kea
LQ Newbie
 
Registered: Mar 2006
Posts: 23

Original Poster
Rep: Reputation: 0
$LANG is the same in both computers. TIMEFORMAT is the same (grepped from `env`) in bot machines. Timeformat is set in /etc/profile (I inserted the needed format string there). I suppose (but not tested exactly) that in case of remote command execution ssh does not run any of the common rc files (.bashrc & co.). But there must be the setting of the default date format of ls somewhere, but I cannot find it. At least by grepping recursively in /etc

Both machines run Slackware (same version).

I have no idea.

KEA.
 
Old 12-03-2009, 03:20 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,836

Rep: Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758
If this still bugs you, try
ls -l
ssh 127.0.0.1
ls -l
and see if it's some setting in ssh
 
Old 12-04-2009, 01:40 AM   #8
kea_kea
LQ Newbie
 
Registered: Mar 2006
Posts: 23

Original Poster
Rep: Reputation: 0
I spoke about remote command execution not about remote login. In the latter case a normal login shell is used while in the first case NOT. So I think that the default behaviour of the command `ls` ought to be configured somehow because the lack of environment variables (in the first case).
 
Old 12-05-2009, 02:56 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,836

Rep: Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758Reputation: 758
Okay.

I have slamd64-12.2(=64 bit slackware) and slackware-12.0(i486) on 2 separate boxes here. When I log log in or ssh in, I get this format

Code:
lrwxrwxrwx  1 dec  users      5 2009-01-22 19:03 winedir -> .wine
-rwxr-xr-x  1 dec  users  52572 2008-05-17 11:27 winetricks
dr-xr-xr-x  2 dec  users   4096 2006-05-14 19:17 words-1.97
drwxr-xr-x  2 dec  users   4096 2008-07-09 16:41 xantia
-rw-r--r--  1 dec  users   1970 2009-09-25 19:14 xorg.start
So wherever you deviate from that is the unusual setting. Can we take it there? Because you can solve this without digging by inserting one alias in bash_profile

alias ll="ls -l <desired date format> and use ll instead of ls
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Date format ZAMO Linux - General 1 02-11-2009 02:56 AM
Date format ust Linux - Newbie 2 12-21-2007 01:39 PM
date format monu Linux - Newbie 6 10-08-2007 10:47 AM
Date format Bill Jones Linux - Newbie 1 12-23-2006 11:07 AM
date format kalleanka LQ Suggestions & Feedback 9 11-15-2006 11:36 AM


All times are GMT -5. The time now is 02:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration