Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to find out the exact year in "Last modified time" using ls command Post 302070987 by spoodie on Tuesday 11th of April 2006 07:13:54 AM
Old 04-11-2006
Maybe I'm stating the bleeding obvious but I believe the year is displayed when the file was last modified in previous years, ie. not the current year. So you can assume that when the time is displayed the file/directory was modified in the current year.

If you're using Linux you can use the --time-style argument to force displaying of the year, but I'm not sure about UNIX:
Code:
ls -l --time-style=+%Y

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

2. UNIX for Advanced & Expert Users

add seconds to: date"|"time"|"HHMMSS

Hey all, I have a shell that invokes a AWK. In this AWK i want invoke a function that receives 3 parameters: date: 20080831 time: 235901 duration: 00023 that function receive this 3 parameters and sum to this value two more seconds: 2008083123590100025 Remember that in case that... (3 Replies)
Discussion started by: anaconga
3 Replies

3. Shell Programming and Scripting

How to remove "New line characters" and "spaces" at a time

Dear friends, following is the output of a script from which I want to remove spaces and new-line characters. Example:- Line1 abcdefghijklmnopqrstuvwxyz Line2 mnopqrstuvwxyzabcdefghijkl Line3 opqrstuvwxyzabcdefdefg Here in above example, at every starting line there is a “tab” &... (4 Replies)
Discussion started by: anushree.a
4 Replies

4. UNIX for Advanced & Expert Users

command for recently modified files - "find" command not working

I have three files a.txt , b.txt , c.txt in a directory called my_dir1 .These files were created before two or three months . I have a tar file called my_tar1.tar which contains three files a.txt , b.txt , d.txt . Somebody untarred the my_tar1.tar into my_dir1 directory. So existing two files were... (1 Reply)
Discussion started by: joe.mani
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
5 Replies

7. Shell Programming and Scripting

"ps -ef" command and exact matching

Hi Guys, I am working in ksh88 and need the output of "ps -ef" command to give me the exact match of my pattern, for example: $ ps -ef 'gen_sub' UID PID PPID NLWP PGID SID STIME TIME COMMAND op 9209 8249 1 9209 9209 14:52:57 00:00 /usr/bin/ksh... (3 Replies)
Discussion started by: aoussenko
3 Replies

8. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

9. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

10. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
touch(1)							   User Commands							  touch(1)

NAME
touch, settime - change file access and modification times SYNOPSIS
touch [-acm] [-r ref_file | -t time] file... touch [-acm] [date_time] file... settime [-f ref_file] [date_time] file... DESCRIPTION
The touch utility sets the access and modification times of each file. The file operand is created if it does not already exist. The time used can be specified by -t time, by the corresponding time fields of the file referenced by -r ref_file, or by the date_time op- erand. If none of these are specified, touch uses the current time (the value returned by the time(2) function). If neither the -a nor -m options are specified, touch updates both the modification and access times. A user with write access to a file, but who is not the owner of the file or a super-user, can change the modification and access times of that file only to the current time. Attempts to set a specific time with touch will result in an error. The settime utility is equivalent to touch -c [date_time] file. OPTIONS
The following options are supported in the touch and settime utilities: touch The following options are supported for the touch utility: -a Changes the access time of file. Does not change the modification time unless -m is also specified. -c Does not create a specified file if it does not exist. Does not write any diagnostic messages concerning this condition. -m Changes the modification time of file. Does not change the access time unless -a is also specified. -r ref_file Uses the corresponding times of the file named by ref_file instead of the current time. -t time Uses the specified time instead of the current time. time will be a decimal number of the form: [[CC]YY]MMDDhhmm[.SS] where each two digits represent the following: MM The month of the year [01-12]. DD The day of the month [01-31]. hh The hour of the day [00-23]. mm The minute of the hour [00-59]. CC The first two digits of the year. YY The second two digits of the year. SS The second of the minute [00-61]. Both CC and YY are optional. If neither is given, the current year will be assumed. If YY is specified, but CC is not, CC will be derived as follows: +-----------------------------------------------------------+ |If YY is: CC becomes: | | 69-99 19 | | 00-38 20 | | 39-68 ERROR | +-----------------------------------------------------------+ The resulting time will be affected by the value of the TZ environment variable. If the resulting time value precedes the Epoch, touch will exit immediately with an error status. The range of valid times is the Epoch to January 18, 2038. The range for SS is [00-61] rather than [00-59] because of leap seconds. If SS is 60 or 61, and the resulting time, as affected by the TZ environment variable, does not refer to a leap second, the resulting time will be one or two seconds after a time where SS is 59. If SS is not given, it is assumed to be 0. settime The following option is supported for the settime utility: -f ref_file Uses the corresponding times of the file named by ref_file instead of the current time. OPERANDS
The following operands are supported for the touch and settime utilities: file A path name of a file whose times are to be modified. date_time Uses the specified date_time instead of the current time. This operand is a decimal number of the form: MMDDhhmm[YY] where each two digits represent the following: MM The month of the year [01-12]. DD The day of the month [01-31]. hh The hour of the day [00-23]. mm The minute of the hour [00-59]. YY The second two digits of the year. YY is optional. If it is omitted, the current year will be assumed. If YY is specified, the year will be derived as follows: +-----------------------------------------------------------+ |YY Corresponding Year | | 69-99 1969-1999 | | 00-38 2000-2038 | | 39-68 ERROR | +-----------------------------------------------------------+ If no -r option is specified, no -t option is specified, at least two operands are specified, and the first operand is an eight- or ten-digit decimal integer, the first operand will be assumed to be a date_time operand. Otherwise, the first op- erand will be assumed to be a file operand. USAGE
See largefile(5) for the description of the behavior of touch when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of touch: LANG, LC_ALL, LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. TZ Determine the timezone to be used for interpreting the time option-argument or the date_time operand. EXIT STATUS
The following exit values are returned: 0 The touch utility executed successfully and all requested changes were made. >0 An error occurred. The touch utility returned the number of files for which the times could not be successfully modified. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
time(2), attributes(5), environ(5), largefile(5), standards(5) NOTES
Users familiar with the BSD environment will find that for the touch utility, the -f option is accepted but ignored. The -f option is unnecessary because touch will succeed for all files owned by the user regardless of the permissions on the files. SunOS 5.10 22 Jun 2001 touch(1)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy