Questions tagged [touch]

touch is a command line utility to change file timestamps.

Filter by
Sorted by
Tagged with
6
votes
7answers
3k views

Creating 50 directories with 50 files inside

I am trying to create 50 directories (dir-01..dir-50). And I want to create 50 files (01.txt..50.txt) inside each of the 50 directories. For example: dir-01/01.txt..50.txt dir-02/02.txt..50....
1
vote
1answer
801 views

Touch command “Invalid timestamp” android phone

I have used the adb shell command to shell into my android device. I then tried to run the command... touch -t 201108231405.14 *.png To changed the modified time of all the files in the Photos ...
0
votes
2answers
485 views

Execution order of touch command arguments

I have a list of files that are space separated and I want to use the touch command to update their timestamps in that order. But when I supply the filenames as arguments, the timestamps get updated ...
1
vote
1answer
345 views

Changing file modification time to access time in bulk

I have a bunch of files in a directory where the modification time was changed (incorrectly) with touch -m The access time of these files is still close enough to what the modification time was, so I'...
1
vote
1answer
2k views

How do I touch every file in a directory? [duplicate]

I'm using Amazon Linux with bash shell. I'm trying to touch every file in a certain directory, but this command is failing: [myuser@mymachine scripts]$ find /usr/java/jboss/standalone/deployments/...
1
vote
2answers
2k views

Working with /dev/null with cat or cp vs touch

In a tutorial about public key infrastructure the author sets up a database to work with when setting up a Root Certificate Authority: cp /dev/null ca/root-ca/db/root-ca.db cp /dev/null ca/root-ca/db/...
7
votes
2answers
4k views

What does 'touch' stand for?

My question is not so much a question of computer science as it is a question of etymology. The command touch changes file access and modification times. What does 'touch' stand for?
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
21k 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
901 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
187 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/...
7
votes
3answers
14k 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
530 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
325 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 ...
4
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
708 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
370 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
750 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
94 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. ...
46
votes
1answer
62k 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
17k 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
972 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 ...
54
votes
11answers
11k 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
2k 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 ...
9
votes
4answers
79k 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
2k 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
721 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
51 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
784 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
2k 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]". $ ...
5
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
188 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
7k 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
784 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
467 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 ...
3
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
357 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
573 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
2k 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
7k 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
2k 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 ...
2
votes
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 ...
15
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 ...