- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Can "date" be changed system wide?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 06:30 AM
тАО04-23-2008 06:30 AM
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 07:06 AM
тАО04-23-2008 07:06 AM
SolutionSuggest to your user that (s)he create an alias for 'date' in the '.profile'. Something like:
# alias date='date "+%Y/%m/%d"'
As for changing the format of the date in 'ls' there are several ways to do this, including the method below (from the ITRC a long time ago):
#!/usr/bin/sh
# cat llsec
# This script checks if a /var/tmp/ls.cat message catalog exists,
# and if not, creates one where the display formats of ls(1) are
# changed to always display time in "%b %2d %H:%M:%S %Y" format,
# like
# "May 23 13:43:56 2002"
#
# It then proceeds to run ll(1) using this modified message catalog.
# Note that if root should run this, a secure locations should be
# used instead of /var/tmp.
# Usage: <script-name>
# e.g.: ./llsec /etc/passwd
if [ ! -s /var/tmp/ls.cat ]; then
echo Creating /var/tmp/ls.cat >&2
dumpmsg /usr/lib/nls/msg/C/ls.cat |
sed -e "s/%b %2d.*$/%b %2d %H:%M:%S %Y/" |
gencat /var/tmp/ls.cat -
fi
export NLSPATH="/var/tmp/%N.cat"
exec ll "$@"
Regards!
...JRF...
- Tags:
- ls.cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 07:07 AM
тАО04-23-2008 07:07 AM
Re: Can "date" be changed system wide?
alias date="date +'%-4.4h %2.1d %H:%M'"
or whatever format he wants.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 07:08 AM
тАО04-23-2008 07:08 AM
Re: Can "date" be changed system wide?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 07:16 AM
тАО04-23-2008 07:16 AM
Re: Can "date" be changed system wide?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 09:14 AM
тАО04-23-2008 09:14 AM
Re: Can "date" be changed system wide?
See "man locale" for more information.
Use "locale -a" to get a listing of available locale settings.
You can test with a command like "LC_TIME=fi_FI.utf8 date" or "LC_TIME=fi_FI.utf8 ll" to see the effects.
This environment variable will change the default time representation in all programs that use the strftime() function, i.e. almost everywhere.
When (or if) you'll find a suitable setting, you can make it permanent by setting & exporting the variable in the user's .profile.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 09:32 AM
тАО04-23-2008 09:32 AM
Re: Can "date" be changed system wide?
#!/bin/sh
locale -a | while read foo
do
echo -ne "$foo: \t"
LC_TIME=$foo date
done
(Warning: this will produce some strange characters that might confuse some terminals/terminal emulators.)
Apparently the HP-UX standard locales won't offer what the user is asking. If the user insists, you might be able to create your own locale definition file. See "man 1m localedef" and "man 4 localedef" if you wish to try this.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2008 09:38 AM
тАО04-23-2008 09:38 AM