Questions tagged [touch]
touch is a command line utility to change file timestamps.
115
questions
2
votes
2
answers
51
views
How to create a file for every directory on a tree?
For the following tree structure:
.
└── dir1
└── dir2
└── dir3
What would be a simple way to create a file (could be empty), for every directory, so the resulting tree will look like:
...
0
votes
0
answers
32
views
Visualizer for evtest logs
I'm looking for a tool that can visualize or make it a bit easier to interpret the logs that are produced from the evtest tool. I've googled for several times and could not find such a tool to ...
0
votes
1
answer
35
views
Will touch behave the same in all systems (overriding an existing file)?
Just a Cron test command to consider, create an empty file in the user's home directory every minute:
* * * * * touch ${HOME}/example.example
Will touch behave the same in all systems (overriding an ...
2
votes
1
answer
62
views
Why does using touch, to create an empty file with no filetype, create various kinds of files?
On macOS I am running a shell script that uses touch to create an empty file without an extension. The files created using the same script randomly have different Kinds, i.e. "Document", &...
0
votes
1
answer
381
views
how can i touch "File Inode Change Date/Time" [duplicate]
i have an mp4 file and running exiftool i can see that the "File Inode Change Date/Time" tag changes when i touch it, but it changes to the current time and not to the date that i have ...
2
votes
2
answers
289
views
Can't specify file creation date
I would like to automate the creation of some files so I created a script.
I want also to specify the creation date of those files.
In a terminal for example, to create a file.txt with creation date ...
1
vote
0
answers
44
views
Execute a command on all folders that are older than their mirrored folder
Here is my problem. Every night I move data to a remote location, the data retains its modified date correctly, but the folders do not consistently. What I would like to do is to check the folders ...
0
votes
1
answer
88
views
Pipe vs Command substitution [duplicate]
Testing with the linux command line and pipe I tried to do echo {1..3} | touch and it doesn't work. I achieved the results with touch $(echo {1..3}).
Why I can't pass the list generated by echo to ...
-1
votes
1
answer
48
views
How to change all files in directory creation/modification date to 0/0/0?
I want to change all files in directory creation/modification date to 0/0/0.
I tried to use find $PWD -exec touch -m -d '0/0/0' {} + command.
-1
votes
1
answer
137
views
change last modification date for many files using references
I have performed a backup and on restoring it, unfortunately, all file access times were set to the timestamp of the DateTime of this restoring process.
How now to set all timestamps from the backup (...
5
votes
1
answer
141
views
A very strange behaviour of filesystem, Schrödinger's file
I'm fresh to Unix, and I would like to have your help with this strange behavior
I have a user directory /Users/den
den$ ls -la
total 208
drwxrwx---+ 19 den staff 608 18 Jan 16:35 .
drwxr-xr-x ...
6
votes
2
answers
609
views
How to mirror directory structure and files with zero size?
I am trying to mirror the directory and file structure of a particular directory. However, I want the mirrored files to have no size. So for example, if I had the following directory tree:
...
0
votes
1
answer
225
views
Issue creating a regular file for a directory
I have tried this but it is not working
touch dir_practice ../cambridge/library/
touch dir_practice ./sample_dir/cambridge/library/****
0
votes
2
answers
452
views
Force create nonexistent directory via vi or touch? [duplicate]
There are -p option in mkdir command to create parent directories as needed
wolf@linux:~$ tree
.
0 directories, 0 files
wolf@linux:~$
wolf@linux:~$ mkdir dir1/dir2/dir3
mkdir: cannot create ...
0
votes
1
answer
388
views
Creating a new file and with a verbose switch
When creating a new directory using the mkdir command, I can simply add the -v option to find out whether or not the new directory is created. It saves time on not issuing a ls -F command. Is there ...
1
vote
1
answer
2k
views
Zsh: How to create a directory and file inside it with one command?
I am curious whether it is possible to create a directory and file inside this directory with one command, similar to mkdir -p but for a text file and intermediate directory.
I read through the touch ...
0
votes
0
answers
345
views
Unable to write to a folder on a drive on AiX system
I logged in the server with the below user id.
myhost:hkgdb:/wd/user1>id
uid=214(user1) gid=321(dba) groups=1(staff)
I'm getting the following error while writing to a file:
myhost:hkgdb:/wd/...
0
votes
0
answers
268
views
What does "touch /reconfigure" before a reboot do?
We have a situation that spontaneous shutdowns are occurring on our Wind River Linux 6 system, and in the syslog, I see a /bin/touch /reconfigure followed by an /sbin/init 0. I can tell from another ...
-1
votes
1
answer
66
views
How to create directory and files inside the directory
I want to know how to place files using touch command inside an directory whether it is multiple or single file.help is appreciated
1
vote
2
answers
4k
views
touch: missing file operand with filename containing hash #
My system is
Kernel: 5.3.0-26-generic x86_64 bits: 64 Desktop: Cinnamon 4.4.8 Distro: Linux Mint 19.3 Tricia
Touch version is touch (GNU coreutils) 8.28
When the following command is given -
$ ...
-1
votes
1
answer
812
views
Creating an empty file inside a folder
Does anyone know how to enter a Linux command to create an empty file called test1 in the directory systems while you are still in your home directory using the touch command?
4
votes
5
answers
3k
views
How do I create multiple files names from list.txt in bash?
I want to create multiple files at a time using names from a file list.txt, how can I do it?
Sample list.txt:
EOG090W002U
EOG090W00C1
EOG090W00DC
EOG090W00DE
EOG090W00E5
EOG090W00HR
EOG090W00MH
...
0
votes
1
answer
358
views
Qt and dual monitor with touch screen
I have a Qt-based program (using eglfs platform), and 2 monitors, one LVDS and the other one is connected by HDMI. The LVDS monitor is a touch screen.
The screen of HDMI is placed to the right of the ...
0
votes
1
answer
268
views
X11 and dual monitor problem
I have a customized linux (Debian, we've removed the desktop environment), where we run our application with X11. The screen size is 1024x768, and the app's window fills the screen.
Now the ...
1
vote
1
answer
1k
views
Change file "Birth date" for ext4 files?
Is it possible to change a file "Birth date" (according to the stat file "Birth" field)?
I can change the modification/access time with touch -t 200109110846 file, but can't find the corresponding ...
1
vote
2
answers
168
views
Create multiples files with brace expansion combining letters and numbers
I am trying to create a series of files with brace expansions. I want create the files fileA1 to fileZ100 with all possible combinations (Something like touch file[A..Z][1..100]).
If I run the ...
1
vote
1
answer
103
views
Why "*" works differently in different commands?
For example, in rm -r abc* "*" means any string. However, if we use it in touch abc* abcd* abcde* (and we don't have any files in directory starting with abc or abcd or abcde) "*" means just a symbol, ...
-3
votes
2
answers
689
views
How to create a file with specific command to run in linux?
I would like to create a file with:
name:
Hyper
command run:
"/opt/Hyper/hyper" %U
or
name:
Google Chrome
command run:
/usr/bin/google-chrome-stable --no-sandbox
( when we click in this icon,...
3
votes
2
answers
7k
views
Creating a file in Linux? (Touch vs Echo)
I'm pretty new to Linux in general, so I'm not too familiar with do's and don'ts of some commands.
I wanted to create a file and noticed that:
touch file.txt `
creates a file, but so does:
echo &...
1
vote
1
answer
141
views
How to create files from a list which contain space [duplicate]
I would like to create files from the following list.
There is no problem if the list doesn't have a space ... but the problem is it has a space
user@linux:~$ cat file.txt
Apples
Bing Cherry
Crab ...
0
votes
2
answers
578
views
Build path name with variable as input to touch [duplicate]
I want to store a path I often use as an environment variable, then call this variable to construct a path name.
$ mypath="~/local/bin/"
$ newFile="${mypath}newFile.sh"
$ echo $newFile
~/local/bin/...
4
votes
0
answers
102
views
Why does the touch command work in one directory, but not in the other?
On the same mount, the touch command sometimes doesn't work
Using different directories on the same mount, the touch command gives different results
**bob@syno ~ % ll -d /volume1/media ; ll -d /...
0
votes
2
answers
2k
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
2
answers
234
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
1
answer
119
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 ...
1
vote
2
answers
3k
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 ...
0
votes
3
answers
2k
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?
4
votes
1
answer
3k
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 ...
1
vote
3
answers
961
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
1
answer
843
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 ...
5
votes
1
answer
7k
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
1
answer
122
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
2
answers
74
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
1
answer
1k
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
1
answer
323
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 ...
34
votes
4
answers
5k
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 ...
3
votes
4
answers
7k
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 ?
22
votes
1
answer
22k
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
1
answer
2k
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-...
1
vote
1
answer
1k
views
Set file modification date from date stored as filename
I have a lot of files where filename contains file creation date (IMG_YYYYMMDD_hhmmss.jpg):
IMG_20171015_133516.jpg
IMG_20171015_133827.jpg
IMG_20171015_142634.jpg
IMG_20171015_142834.jpg
...