Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [touch]

touch is a command line utility to change file timestamps.

0
votes
2answers
29 views

Usage of touch with pipeline

I want to be able to use the touch command with the pipeline to create multiple files depending on the output of a command. Like for example: grep "hello(.*)" file.txt | touch But it doesn't work! ...
2
votes
2answers
72 views

Difference between `touch file` and `>file`

Say there is an empty directory and I run the commands >file1 and touch file2 while in that directory, but I forget which command created which file. I don't know what command I ran first and I ...
0
votes
0answers
28 views

Wrong button event mapping for active stylus (linux elan touchscreen driver)

The touchscreen on my Asus TP412UA Notebook is working perfectly with linux. However, I have noticed that my stylus emits a wrong event if I press one of the buttons. Elevating the pen from screen ...
0
votes
1answer
25 views

How to add both date and space to a filename [duplicate]

If I execute touch $(date '+%F %T'), I expect one file whose filename comprises the date and time to be created; but instead two files are created: one whose name is the date, and the other whose name ...
0
votes
1answer
166 views

If rc.local is run as root why can't it touch a file

I wish to execute a script every time on boot-up using /etc/rc.local. My script for example is called startscript.sh which is stored in /home/debian as below. It first tries to create a file called ...
1
vote
0answers
38 views

Send to USB attached touch screen monitor with xrandr

I have a project which involves buying a 5'' inch USB Touch Screen (from Raspberry Pi) to create an "info" screen: to control brightness, volume, current music, open shortcuts, etc... I have the ...
0
votes
3answers
56 views

Create file in subdirectories that doesn't exist (../new_folder/new_folder/new_file.ext)

For now i use this: mkdir -p a/b/c/d/e; touch a/b/c/d/e/file.abc; Is there more efficient ways?
2
votes
1answer
413 views

Use touch command to set modification time of a file to the Unix epoch

Edit: Better worded question: How do I only use the touch command to set the modification time of a file to the unix epoch? I know that the unix epoch value can be retrieved using "data %s", but how ...
0
votes
3answers
278 views

In Linux, what does “touch .” (touch dot) do?

I have searched for a similar question here, but found nothing related. In Linux, the dot (.) refers to the directory itself. The touch command creates a file, if it does not exist. But what does ...
0
votes
1answer
162 views

Change modification timestamps using touch with time offset across group of files

I'm trying to change the modification timestamps using touch on a group of images that gets accessed by an external program that sorts them by modification date. The current mod times of these files ...
4
votes
1answer
237 views

How to `touch` and `cat` file named `-` [duplicate]

How do I use GNU touch to update a file called -? How do I use GNU cat to display a file called -? I'm running: % cat --version | head -n1 cat (GNU coreutils) 8.29 % touch --version | head -n1 ...
0
votes
1answer
58 views

Batch copy metadata (date) from .mpg to .mp4 (touch -r)

I have a large number of YYMMDD.HHMMSS.mpg files. What I want is to copy the metadata to (the converted) YYMMDD.HHMMSS.mp4 files. Can this be done in batch? touch -r *.mpg *.mp4
-3
votes
2answers
40 views

To create files under existing nested directories in Fedora 23 [closed]

I can't use touch to make files in existing nested directories. I was just wondering if my syntax is off. $ touch dir1/dir2/dir3/file.txt
0
votes
1answer
98 views

Change creation time of files (RPM) from download time to build time

I am going to create my own internal repository service via createrepo and want to provide an Java repository as well. Downloading the JRE and JDK packages automatically and as described at Stack ...
2
votes
1answer
81 views

How Can i control the 'total' output in 'ls -l' command? [duplicate]

the question is, how can control the ls -l total output ? first impression with example that give us total = 0 els3@els3PC:~/test$ touch file els3@els3PC:~/test$ ls -l total 0 -rw-r--r-- 1 els3 els3 ...
32
votes
4answers
4k views

When creating an empty file, why might one prefer 'touch file' over ': >> file'?

Never realized that you could do this until just now: : >> file It seems to be functionally similar to: touch file Is there a reason why most resources seem to prefer touch over this shell ...
1
vote
4answers
1k views

creating a file with touch using a variable

I have this variable : toto=123456 why does touch "$toto.hihi.log" works and creates a file called 123456.hihi.log but touch "$totohihi.log" doesn’t do anything ?
7
votes
1answer
4k views

What happens if we use touch command while the file already exists

I already have a file named param.txt with some data on it. If I run touch param.txt in the same folder will my data get lost?
0
votes
1answer
716 views

How to touch everything in a directory including hidden, like directory up `..`?

This question has parallels to question "touch all folders in a directory". How to touch everything in a directory, recursively including hidden entries, like "directory up" .. and . without de-...
0
votes
1answer
338 views

Set file modification date from date stored as filename

I have a lot of files where filename contains file creation date (IMG_RRRRMMDD_hhmmss.jpg): IMG_20171015_133516.jpg IMG_20171015_133827.jpg IMG_20171015_142634.jpg IMG_20171015_142834.jpg ...
1
vote
1answer
268 views

How to change folder's creation date to match the creation date of the .nfo file inside?

I need to do it for over 600 folders with varying names and the .nfo file inside doesn't necessarily have the same name as the folder, he is just a few of them. m0j0@unity ~/files/TV.TL/TEST $ ls -lr ...
-1
votes
2answers
7k views

I get message “File name too long” when running for..in and touch

I want to touch each file in a directory: files=$(ls -a "node_modules/suman-types/dts") echo "files $files"; for file in "$files"; do echo "touching file $file"; touch "node_modules/suman-...
1
vote
0answers
124 views

touch is creating files one hour behind the current time. How to set it with current time?

All ordinary users on my linux box have an issue. When they create a file using $ touch test.txt or using script and do ls -ali | grep test.txt I notice that the time of the file is one hour behind ...
0
votes
2answers
808 views

When does touch command need the file to exist? [duplicate]

I've noticed sometimes I touch a file that does not exist at all and after the command, the files get created. However, depending on what directory I'm touching, I get "No such file or directory" ...
4
votes
1answer
241 views

re-touching files over sshfs

Machine A's file system is mounted on machine B via sshfs. A process running on B, which was initiated from A by ssh touches a file on the mounted file system of A to communicate a signal; the signal (...
6
votes
6answers
2k 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
443 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
304 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
118 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'...
0
votes
1answer
996 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
1k 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/...
5
votes
2answers
1k 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
7k 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: $ ...
6
votes
1answer
425 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
144 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
7k 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
439 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
127 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 ...
1
vote
1answer
2k 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
538 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-...
0
votes
1answer
698 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
313 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
392 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
81 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. ...
15
votes
1answer
16k 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 ...
16
votes
2answers
8k 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
526 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
8k 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
999 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 ...