Sponsored Content
Top Forums UNIX for Dummies Questions & Answers touch -t time, using different userid Post 302391710 by dpc.ucore.info on Tuesday 2nd of February 2010 09:01:32 AM
Old 02-02-2010
I understand chmod and chown rules. However I can't find a reason for requiring ownership for modifing a timestamp. I'd be happy to see one.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

userid

I would like to know the difference between the real user-id and the effective user-id. If user-A runs a program owned by user-B then which is the real user-id and which is the effective user-id ? (1 Reply)
Discussion started by: sundaresh
1 Replies

2. Shell Programming and Scripting

how to touch a file with prev time stamp

i want to find the files which are modified in last 30 to 120 minutes i am using "find . -mmin +30 -mmin -120 " it is giving me the error find: bad option -mmin find: path-list predicate-list can somebody help me out . Thank you (5 Replies)
Discussion started by: Prat007
5 Replies

3. UNIX for Dummies Questions & Answers

Touch all files and subdirectories (recursive touch)

I have a folder with many subdirectories and i need to set the modified date to today for everything in it. Please help, thanks! I tried something i found online, find . -print0 | xargs -r0 touch but I got the error: xargs: illegal option -- r (5 Replies)
Discussion started by: glev2005
5 Replies

4. Shell Programming and Scripting

how to make a log.txt and add date and time when use ls,touch and find

Hey guy, how to make the log.txt file and record date and time when ls, touch and find command run? Thanks Boly (13 Replies)
Discussion started by: chenboly
13 Replies

5. Red Hat

userid with nothing to do on the os/app

Hi All, I got this userid apache with the same userid and groupid and /sbin/nologin and the /www/a home folder is empty. Can I just delete this userid? How can I investigate if userid have something to do with the application? Thanks for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

6. Shell Programming and Scripting

What is the command to get name associated with userid?

Hi, 1#what is the command to get name associated with userid? 2#I am using unix on Mainframes thru OMVS. So any one know to to capture TSO command output to a variable on OMVS environment. I tried with below script, but its not working! #!/bin/ksh output=$(tso whois PA1234) echo... (6 Replies)
Discussion started by: prashant43
6 Replies

7. UNIX for Dummies Questions & Answers

userid and pw

questions: a. where can I customized the password of userid in solaris? say I wanted 10digits long, all caps? thanks (4 Replies)
Discussion started by: lhareigh890
4 Replies

8. Shell Programming and Scripting

How to change time stamp with touch command?

Hi, I wish to change time stamp of a directory with all its subdirectories and files on server. I am able to find following two ways but want to know which will be the better one. I have not tried anyone of them because I am not sure if it can effect my data: find * -type d -exec touch... (5 Replies)
Discussion started by: bioinfo
5 Replies

9. UNIX for Advanced & Expert Users

Help with touch: bad time specification

Here is the part of the script: I have modified the file name.:) SSFILE=${My_HOME_DIR}/log/my_file_ss.log export MM=`date '+%m'` export DD=`date '+%d'` export HH=`date '+%H'` export MIN=`date '+%M'` export HOURAGO=`echo ${HH} -1 |bc ` echo $HOURAGO export TTIME=${MM}${DD}${HOURAGO}00... (5 Replies)
Discussion started by: N1a_Raider
5 Replies

10. Red Hat

Touch - changing date and time

Hi, I am facing a problem with the command - TOUCH on Linux. See the example below: File on Linux: rw-rw-r-- user1 user1 Jan 01 09:00 test.txt The file - test.txt was created by the user - user1. Now, I want to change the date and time, but using other user - user2 The user2... (12 Replies)
Discussion started by: brjohnsmith
12 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 operand 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). When existing file access and modification times cannot be determined (which will occur if a call to stat(2) fails), both times can be changed to known values by settime and utime(2). However, in this case, touch -a (without -m) and touch -m (without -a) will fail because the unchanged time cannot be preserved. 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 |Committed | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
stat(2), time(2), utime(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.11 9 Sep 2008 touch(1)
All times are GMT -4. The time now is 10:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy