"touch" syntax


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers "touch" syntax
# 1  
Old 08-11-2006
"touch" syntax

Why is it that I can not set the time the way I want it even I used the syntax at the man page? Say, I want to change the access time of filex from the current time to another time.
# 2  
Old 08-11-2006
Code:
$ touch ./file
$ ls -l ./file
-rw-r--r--  1 zb  people  0 Aug 11 10:10 ./file
$ touch -t 06061531 ./file
$ ls -l ./file
-rw-r--r--  1 zb  people  0 Jun  6 15:31 ./file

The (minimal) format for -t is MMDDhhmm. There are other additional parts of the timestamp that can be specified - the man page does indicate this.

Cheers
ZB
# 3  
Old 08-19-2006
Sir,

Here is the sypnosis when I look at man page:

touch [-acm] [-r ref file] file ...
touch [-acm] [-t time] file ...
touch [-acm] [date_time] file ...

But when I use them, I can't change the time ...

When I used touch -t, it was not being accepted ...
# 4  
Old 08-19-2006
what os r u using ? linux or sun os aix .. from my understanding in class that some os will accept some command and some other you have add or min an option..
# 5  
Old 08-24-2006
Try this

touch -d <date> <file_name>

Code:
touch -d "Aug 15" xyz.doc

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Permission error when "touch"ing file with different user

Hi, There are 2 users (T886072 & T864764) that need to be provided full (rwx) access to a directory. I made the changes to the directory permissions using chmod and setfacl : root@digidb2:# chmod 700 /u02/ftpfiles/MFRS16/discount_rates/ root@digidb2:# setfacl -s... (3 Replies)
Discussion started by: anaigini45
3 Replies

3. UNIX for Beginners Questions & Answers

Automate "touch" bash script not working.

#!/bin/bash -i SAVEIFS=$IFS IFS=$"\n\b" picc=$* if ; then echo $TDATE if ; then touch dummy touch -t "tdate" dummy touch -r "dummy" "$picc" else echo -e "No mod date value to apply. If there is one in your shell,\ninvoke \eStarted asking advice on this (on Linuxquestions.org).... (9 Replies)
Discussion started by: iamwrong
9 Replies

4. 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

5. Shell Programming and Scripting

awk - Must "touch" a $n-variable to get OFS used?

I'm having a small problem with awk. I tried to use it for replacing ";" with <tab>. But I have to "touch" one variable to get the <tab> in OFS to be used.$ echo "xx;yy;zz" | awk -F';' 'BEGIN { OFS="\t" } { print $0; }' xx;yy;zz # no OFS used $ echo "xx;yy;zz" | awk -F';' 'BEGIN {... (6 Replies)
Discussion started by: 244an
6 Replies

6. 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

7. Shell Programming and Scripting

Can I make "touch" create executable files by manipulating umask?

I'm getting to grips with this concept of the umask. What I thought was, setting umask uga+rwx would result in creating files with all permissions for everyone. Seems not to be the case though. Read and write bits get set, but not the execute bit. Is there some gap in my understanding, or is... (2 Replies)
Discussion started by: tphyahoo
2 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. UNIX for Advanced & Expert Users

Command similar to "touch" for modify File size

Hi All, I'm trying to find a command like similar to "touch" which would let me change the file size property. For ex: I have a file of size 1MB using the command i would like to set/update the size something like 1KB. Is it possible? Is there any such command which would accomplish this... (3 Replies)
Discussion started by: sriharshareddyk
3 Replies
Login or Register to Ask a Question