LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   DATE Display command needed... (https://www.linuxquestions.org/questions/linux-server-73/date-display-command-needed-4175430853/)

redhat70 10-06-2012 11:20 AM

DATE Display command needed...
 
Hi,

drwxr-x--- 4 root root 4096 Jul 6 11:35 bin
drwxr-x--- 3 root root 4096 Jul 6 11:35 cit
-rw-r----- 1 root root 98 Jul 6 11:35 FILE_ID.DIZ
drwxrwxrwx 2 root root 4096 Jul 6 11:35 logs
drwxr-x--- 2 root root 4096 Jul 6 11:35 nls
drwxr-x--- 4 root root 4096 Jul 6 11:35 scanner
drwxrwxrwx 2 root root 4096 Jul 6 11:35 upload

In the Output, Their is No YEAR display .

Can anybody give me the command to Display the YEAR Also along with the Date and Month of th File created .

I can see JUL 6, But their is no YEAR display.

So, Please help me the command which can show the YEAR as weel along with the Date.

Regards,
Aparna.

druuna 10-06-2012 11:25 AM

The ls command has some options that might be handy:
Code:

ls -l --time-style=long-iso
The long-iso keyword can be one of several, check the ls man page.

EDIT:

Some other examples to get you going:
Code:

ls -l --time-style=+%c
ls -l --time-style=+%F
ls -l --time-style="+%b %d %Y"

The format options can be found in the date man page.

redhat70 10-08-2012 08:45 AM

Thanks a Lot for responding to my query.

Habitual 10-08-2012 09:13 AM

Code:

ls --time-style="+%b %d %Y %l:%M %p"  --color=auto
gives me this output:
Code:

drwxr-xr-x  4 jj users 4.0K Oct 08 2012 10:00 AM Bin/
drwxr-xr-x  2 jj users 4.0K Sep 07 2012  5:30 PM Desktop/
drwxr-xr-x  5 jj users 4.0K Oct 05 2012  9:24 PM Documents/
drwxr-xr-x 15 jj users 4.0K Oct 06 2012  5:00 PM Downloads/
drwxr-xr-x 16 jj users 4.0K Dec 18 2011  5:37 PM Music/
drwxr-xr-x  5 jj users 4.0K Jul 23 2012  7:57 PM Pictures/
drwxr-xr-x  2 jj users 4.0K May 06 2012  6:54 PM Public/
drwxr-xr-x  2 jj users 4.0K Dec 15 2011  9:18 PM Templates/
drwxr-xr-x  2 jj users 4.0K Mar 05 2012  8:39 AM Videos/
drwxr-xr-x  5 jj users 4.0K Sep 22 2012  9:52 PM VirtualBox VMs/

Just another method...

HTH.

redhat70 10-10-2012 02:50 PM

Hi,

Thanks for sharing the command.

i want to know,is their any other command alternate to :

/etc/redhat-release to fetch the Linux version ?

redhat70 10-10-2012 02:52 PM

Hi,

# ls -l --time-style="+%b %d %Y %l:%M %p" --color=auto

their was no -l option in your output.

So i have added it.

kamran.ayub 10-11-2012 02:16 AM

redhat release
 
For alternative of
cat /etc/redhat-release

you may use
cat /etc/issue

Rupadhya 10-11-2012 03:32 AM

I use Fedora, so I don't know if this works on Redhat, but to tell what kernel I am using I type
# uname -a
Linux rajhome2 3.6.1 #1 SMP Thu Oct 11 02:17:09 CDT 2012 i686 i686 i386 GNU/Linux

Does that help?

- Raj

redhat70 10-13-2012 03:15 PM

Hi,

what does this output means :

# cat /etc/issue
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
Kernel \r on an \m


===================================

I want to know, what does Kernel \r on an \m ?

What does this mean ?

Your help is highly appreciable...

Thank you in advance.

Regards,
Aparna.

Rupadhya 10-13-2012 03:49 PM

Quote:

Originally Posted by redhat70 (Post 4804918)
Hi,

what does this output means :

# cat /etc/issue
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
Kernel \r on an \m


===================================

I want to know, what does Kernel \r on an \m ?

What does this mean ?

Your help is highly appreciable...

Thank you in advance.

Regards,
Aparna.


Must be some kind of substitution that isn't happening. Can you do a
Code:

uname -a
at a command prompt? The -a option means all.
- Raj

redhat70 10-13-2012 03:54 PM

#uname -a

Linux LOPASCO2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

Rupadhya 10-13-2012 10:07 PM

I think that means you are running a Linux system with the 2.6.18-128.el5 kernel, compiled on Wed Dec 17 11:41:38 EST 2008 for the x86_64.
- Raj

chrism01 10-15-2012 09:17 PM

In general I find that
Code:

cat /etc/*release*
works on most distros.
Unfortunately there are distro dependent variations on the exact name of that file.

As you can see from the above, this gives you the distro version, uname gives you the kernel info.

For those that implement it, lsb_release may work.

Rupadhya 10-16-2012 01:00 AM

I found this script somewhere. I am not sure where but, you can save it as ver_linux and then chmod+x ver_linux.
From the directory you have it saved in you can execute it by ./ver_linux.

Here it is...
Code:

#!/bin/sh
# Before running this script please ensure that your PATH is
# typical as you use for compilation/istallation. I use
# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
# differ on your system.
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
echo 'If some fields are empty or look unusual you may have an old version.'
echo 'Compare to the current minimal requirements in Documentation/Changes.'
echo ' '

uname -a
echo ' '

echo "Gnu C                " `gcc --version`

make --version 2>&1 | awk -F, '{print $1}' | awk \
      '/GNU Make/{print "Gnu make              ",$NF}'

ld -v 2>&1 | awk -F\) '{print $1}' | awk \
      '/BFD/{print "binutils              ",$NF}'

fdformat --version | awk -F\- '{print "util-linux            ", $NF}'

mount --version | awk -F\- '{print "mount                ", $NF}'

insmod -V  2>&1 | awk 'NR==1 {print "modutils              ",$NF}'

tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' |  awk \
'NR==1 {print "e2fsprogs            ", $2}'

reiserfsck 2>&1 | grep reiserfsprogs | awk \
'NR==1{print "reiserfsprogs        ", $NF}'

cardmgr -V 2>&1| grep version | awk \
'NR==1{print "pcmcia-cs            ", $3}'

pppd --version 2>&1| grep version | awk \
'NR==1{print "PPP                  ", $3}'

isdnctrl 2>&1 | grep version | awk \
'NR==1{print "isdn4k-utils          ", $NF}'

ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
-e 's/\.so$//' | awk -F'[.-]'  '{print "Linux C Library        " \
$(NF-2)"."$(NF-1)"."$NF}'

ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -1 | awk \
'NR==1{print "Dynamic linker (ldd)  ", $NF}'

ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
      '{print "Linux C++ Library      " $4"."$5"."$6}'

ps --version 2>&1 | awk 'NR==1{print "Procps                ", $NF}'

ifconfig --version 2>&1 | grep tools | awk \
'NR==1{print "Net-tools            ", $NF}'

# Kbd needs 'loadkeys -h',
loadkeys -h 2>&1 | awk \
'(NR==1 && ($3 !~ /option/)) {print "Kbd                  ", $3}'

# while console-tools needs 'loadkeys -V'.
loadkeys -V 2>&1 | awk \
'(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools        ", $3}'

expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'

if [ -e /proc/modules ]; then
    X=`cat /proc/modules | sed -e "s/ .*$//"`
    echo "Modules Loaded        "$X
fi

It checks a bunch of things for building software. I have run it a couple of times.

- Raj


All times are GMT -5. The time now is 05:53 AM.