Questions tagged [touch]

touch is a command line utility to change file timestamps.

Filter by
Sorted by
Tagged with
11
votes
1answer
2k views

What does !!: mean in bash? [duplicate]

Watching a video (https://vimeo.com/56166857 & https://www.youtube.com/watch?v=9CTfGS0gEOk @ 1m:34s), the presenter (TJ Holowaychuk) wrote: touch !!:2{...} I can't find what !!:2 means anywhere. ...
1
vote
1answer
16k views

Without changing your current directory, create an empty file in another directory in Linux?

Suppose my current working directory is: /Users/Directories Under Directories, there are two separate directories called: firstname & last name. I move into the first name directory: $ ...
7
votes
1answer
745 views

Why can touch change only all times, or nothing when not owner

We have a file foobar not owned by me, but it is in my group: $ ll total 4,0K -rw-rw-r-- 1 root hbogert 4 jan 19 12:27 foobar I can touch it and it will update all times: $ stat foobar File: '...
0
votes
1answer
172 views

Creating .spam folders in each mail user's account

My previous question, Cleaning out mail folders with cron task didn't result in a good enough answer to help me. I have narrowed down the task as follows: I wish to move mail out of each user's .spam/...
6
votes
3answers
12k views

How to change files creation time? (touch changes only modified time) [duplicate]

How to change files CREATION time? I tried to use 'touch' command but it changes only the last modified time - it does not change the first date - creation date. (After checking by 'stat' it still ...
0
votes
0answers
499 views

Selective touch screen input in linux (wacom - or X11?)

I was wondering what would be the most straightforward way to have a selective touch screen input with wacom devices. I have an x1 yoga (laptop/tablet with the latest gen wacom touch and pen input. ...
0
votes
1answer
252 views

Creating alert notification if process stops touching file

I have set up a very simple script so that I can test whether a process is running or not and if so then it will touch a file and everything will be fine. However if process is not running and file ...
3
votes
1answer
4k views

How to change created time stamp one week ago?

I want to change the created timestamp of many images one week ago. Code % http://askubuntu.com/a/62496/25388 touch -d "7 days ago" *.png Output touch: invalid date format ‘1 one ago’ OS: Debian ...
1
vote
0answers
674 views

How to change last modification date and time, regardless of timezone and DST?

I have two files and I need to change their last modification date: both should be midnight, one on 25th June and the other one on 25th November. Basically, this: touch -cmt 201606242359.60 summer-...
1
vote
1answer
1k views

How to touch, rm and touch in Unix? [duplicate]

I want to empty current file so I do: touch it, remove it and touch because I do not want to remove non-existing file; example touch "$filenameTarget" rm "$filenameTarget" ...
1
vote
0answers
360 views

No touchscreen input in App when Ubuntu launches

Ubuntu 16.04 using a touchscreen. We are developing an application that will launch when the OS first starts up. We plan to use the computer with touch screen only. No mouse or keyboard. The problem ...
4
votes
1answer
634 views

How to use touch to set modified/created timestamp of a file?

This sounds like an easily researched question. It isn't. I'm following the following highly recommended post on an Ubuntu Stack Exchange site that I happened to run across. But the suggestion ...
0
votes
1answer
93 views

move file based on iso8601 date format that is 1 week old

I have a set of backups that run on a cron job every 4 hours (00:00, 04:00...etc). These files are named based on; NOW=$(date +%F-%a-%H.%M)-filename which translates to 2016-10-25-Tue-04.00-filename. ...
35
votes
1answer
44k views

How to create a file and parent directories in one command? [duplicate]

Is there a flag/option for touch, mkdir, >, or some other command that will allow me to create a file and any non-existent parent directories at the same time? For instance, let's say I'm in an ...
18
votes
2answers
14k views

How to set file permissions with touch command

It seems that whenever I create a file with touch the permissions are set to: -rw-r--r--. Is there some way that I can configure the permissions with touch or does this have to be done after with a ...
1
vote
3answers
857 views

Deleted /usr/bin/touch and /bin/touch. Can't seem to install anything now, nor create any files?

After updating GNOME to 3.20.2 I had some problems with my touchpad so in that confusion I mistakenly deleted /usr/bin/touch and after that I even became more stupid and deleted /bin/touch. Now after ...
55
votes
11answers
10k views

Use of touch and vi?

Is there a benefit of creating a file with touch prior to edit.. like: touch foo vi foo versus getting it to editor straight-away? Like: vi foo I see quite a few tutorials using the former (touch ...
-1
votes
1answer
1k views

Getting “Permission denied” when trying to create a file despite correct permissions

I’m using Amazon Linux and running a script through a Jenkins job, including this line touch /usr/java/jboss/standalone/deployments/myproject.war.dodeploy which results in the error … touch: cannot ...
6
votes
4answers
62k views

touch: cannot touch ‘test’: Permission denied

I am trying to create a file in a directory but I am getting: `touch`: cannot touch ‘test’: Permission denied Here are my commands: [user@xxx api]$ ls -l total 184 ... drwxrwxr-x 2 root root ...
24
votes
4answers
3k views

What is the use of the -f option for `touch`?

From man touch: -f (ignored) But I don't get what is meant by ignored. I've tried following: $ ls -l file -rw-rw-r-- 1 pandya pandya 0 Mar 20 16:17 file $ touch -f file $ ls -l file -rw-rw-r--...
1
vote
3answers
1k views

how to create a file automatically?

I'm trying to create a script that can: look for a file containing "foobar" as name a script is executed on this file and the output must be stored in a new CSV file, which is created automatically ...
2
votes
1answer
666 views

Change time stamp to specific date keeping existing time

I have about 100 .jpeg images that I would like to change the file time stamp for. I have seen many examples of using touch to modify the time stamp based on the number of days, hours, etc., but those ...
-1
votes
1answer
50 views

Help with permissions

I am trying to set up permissions, but I don't know what exactly, as a user. Could anyone tell me which permission will allow me to execute the touch and echo commands in a directory?
2
votes
0answers
761 views

Touch screen drivers

I have an Android tablet which is using Atom CPU, so I want to get Linux onto it. I used Gentoo(4.2.4 kernel), everything is fine except for the touch screen. On Android I can see the following ...
5
votes
1answer
1k views

How to create files named 'a to z' - any trick? [duplicate]

I need to create 26 files named a to z in single command. I thought touch command would be sufficient with the regex, but it doesn't expand [a-z] instead it creates a single file with name "[a-z]". $ ...
4
votes
2answers
7k views

Script for changing modification time of files and directories recursively

I have many big folders with thousands of files in them and I want to use touchto set their modification times to be "original time"+3 hours. I got this script from a similar thread in superuser: #!/...
3
votes
4answers
2k views

Touching issue: Creating a filename from 2 variables

I am trying to create a filename from 2 variables. This is the error msg: touch: cannot touch `/root/tinstalls/2--06/06/15': No such file or directory 2--06/06/15 19:54 This is the code: tdate=$(...
0
votes
1answer
185 views

Execution bit not being set [duplicate]

I have just set up an EC2 instance to play around with and am testing file permissions; however, I notice that the execution bit is not being passed down to the lower level (read and write are, just ...
13
votes
2answers
6k views

Why does touch create new files?

I am aware that the touch command is used to update the date of last modification on a file. It is also used to create a new file if requested file does not exist on file system. Since touch (as it's ...
2
votes
2answers
749 views

date: bad conversion error on HP-UX but not on Linux

On Linux: $ touch 1 12 No problem,create 1 and 12. On SysV or HP-UX 11.31: $ touch 1 12 date: bad conversion I have tried with LANG=C, same error. Why?
2
votes
0answers
444 views

Touch-friendly LXDE app launcher

I am about to make a tablet with a raspberry pi and would like an interface for launching apps that is touch-friendly. The gnome app launcher seems very well suited for this to me. Because of the ...
2
votes
2answers
3k views

Touch the file to future time stamp

I have created the file which is 30 minutes old by using following command TZ=ZZZ0 touch -t "$(TZ=ZZZ0:30 date +%Y%m%d%H%M.%S)" $HOME/reference Similarly how can I create a file 30 minutes of future ...
1
vote
0answers
340 views

Arch: How can I hide the pointer when I'm using my touch screen?

I just installed Arch on my Lenovo Yoga 2 11" convertible laptop, and it's great so far, but when I use my touch screen, the pointer follows my touches, which it doesn't do on Ubuntu or Fedora. How ...
3
votes
3answers
483 views

How to bump file timestamps by 3 months (for a directory tree)?

I am looking at the touch command line utility (on Linux), and from the examples I found in tutorials, I see how one can bump the access or modification timestamp to a specified time, the current time,...
4
votes
3answers
1k views

Get modification date that can be used with touch -m

I need to get the modification date of a file so that I can set it on other files using touch -m. stat or perl -le 'print((stat shift)[9])' Didn't return what I wanted. I think that you are supposed ...
-2
votes
1answer
6k views

Bash script, ask for user input, to change a directory, sub directorys, and file's mtime atime linux recursively

Using GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) I am a bash scripting novice, not sure where to begin except at shebang #!. The following command. touch -a -m -t 201501010000.00 ...
6
votes
2answers
1k views

Find and create empty files with the same name in another location

I want create empty files with the same name, but in another location. Is it possible? find some files use only filenames touch an empty file in another place Something like this: find . -type f -...
3
votes
3answers
17k views

How to create multiple files/directories with randomized names?

I'm trying to create some files that has different names and with different extensions. Let say I want to create for example 3 files with following name and extension: File001.000 File002.001 File003....
2
votes
2answers
1k views

How to disallow file modification time change for non root users

I don't want anybody to create a file then change the creation date to backward date(For example using touch or system call). In my Ubuntu hosting account I'm getting many hacked php code getting ...
1
vote
3answers
1k views

How to get proper format from date for the touch -A argument?

I would like to change all of the timestamps of some files to the immediate date. It appears that I would need to use touch -A * (more or less; realizing that I am going to use a more complex form of ...
1
vote
3answers
3k views

shell script for auto-touching files

I have written a shell script to touch all the files in the /tmp directory. However, there was an error message saying that /bin/touch: Argument list too long. What's the cause of the problem? #!/bin/...
4
votes
4answers
1k views

Make many subdirectories at once

Suppose I have a directory /, and it contains many directories /mydir, /hisdir, /herdir, and each of those need to have a similar structure. For each directory in /, there needs to be a directory doc ...
13
votes
3answers
10k views

How do I set a file's mtime in epoch format?

I know how to get a file's mtime in epoch format: stat --format=%Y <file> But I have not been able to figure out how to set a file's mtime in epoch format. The touch(1) man page appears to ...
3
votes
1answer
2k views

Set file creation date to its modification date on OSX

I need to batch edit file creation date (some stupid audio recorder set the file creation date to UNIX epoch and the correct recording date in the modification date) to set it to the files ...
0
votes
2answers
413 views

clone create date [duplicate]

I would like to clone only the create date and the filenames in source and destination are different. The name part of it is the same, it's the extension that isn't. AVI videos in one directory, MP4 ...
7
votes
3answers
30k views

Efficient way to create multiple files

I have been testing find directory which is taking max inodes and while testing I had run touch test_{1..1391803}.txt But it's give me error "-bash: /usr/bin/touch: Argument list too long", now I'm ...
0
votes
1answer
2k views

Updating last modified time of a file

I have created a script to read 15 pcap files from a folder and merge then into one file using mergecap command. I want the merged file to have the creation time same as the first file of the 15 files ...
1
vote
0answers
614 views

Changing file time using touch

Im trying to change the file time of a m#merge the files to a temporary file. mergecap -w "${dir_dcn}"/merge_dcn.pcap "${FILES_dcn[@]}" touch -r "${FILES_dcn[14]}" dcn_file ls -l dcn_file >> ...
84
votes
15answers
18k views

What are the legitimate uses of the `touch` command?

What's the point of the touch command? I know I can create empty files with it, but so is also the case with echo -n. Otherwise, why would someone need to change the timestamps of a file? Unless to ...
26
votes
4answers
63k views

touch: cannot touch file: No such file or directory [duplicate]

I am getting the error: touch: cannot touch `/opt/tsrm/compliance/cme/log/20121207.log`: No such file or directory on the touch command: touch $LOGFILE I also checked the link: touch: cannot touch ...