Updated format to be more consistent (#30293)
Changed the usage section to be more consistent with the rest of the directory, also added a link to Wikipedia for further details and further consistency.
This commit is contained in:
committed by
Christopher McCormack
parent
9741e64f21
commit
e16e634dcc
@ -2,20 +2,17 @@
|
|||||||
title: Bash touch
|
title: Bash touch
|
||||||
---
|
---
|
||||||
|
|
||||||
## Bash command: touch
|
# Bash command: touch
|
||||||
|
|
||||||
**Change timestamps of files.**
|
|
||||||
**Quickly create new files.**
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
```
|
|
||||||
touch [options] filename
|
|
||||||
```
|
|
||||||
|
|
||||||
Creates empty file if filename does not exist or modifies timestamps of existing files to current time.
|
Creates empty file if filename does not exist or modifies timestamps of existing files to current time.
|
||||||
|
|
||||||
This command can create multiple empty files in one line of code.
|
This command can create multiple empty files in one line of code.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```
|
||||||
|
touch [options] filename
|
||||||
|
```
|
||||||
|
|
||||||
Commonly used options:
|
Commonly used options:
|
||||||
- `-t` change timestamp to specific date ((YYYYMMDDHHMM.SS)) instead of current time.
|
- `-t` change timestamp to specific date ((YYYYMMDDHHMM.SS)) instead of current time.
|
||||||
- `-r` use timestamp from first file to second file.
|
- `-r` use timestamp from first file to second file.
|
||||||
@ -23,14 +20,18 @@ Commonly used options:
|
|||||||
- `-m` Similarly, if the requirement is to only change the modification time, use the -m command line option.
|
- `-m` Similarly, if the requirement is to only change the modification time, use the -m command line option.
|
||||||
- `-h` Is useful if you only want to change the symbolic link, instead of the referenced file.
|
- `-h` Is useful if you only want to change the symbolic link, instead of the referenced file.
|
||||||
|
|
||||||
### Example
|
## Examples
|
||||||
```
|
```bash
|
||||||
touch -t YYYYMMDDHHMM.SS filename
|
touch -t YYYYMMDDHHMM.SS filename
|
||||||
|
```
|
||||||
|
```bash
|
||||||
touch -r file1 file2
|
touch -r file1 file2
|
||||||
|
```
|
||||||
|
```bash
|
||||||
touch -am file3
|
touch -am file3
|
||||||
```
|
```
|
||||||
|
|
||||||
### More Information:
|
## Additional Resources
|
||||||
* [Man pages](http://man7.org/linux/man-pages/man1/touch.1.html)
|
- [Wikipedia](https://en.wikipedia.org/wiki/Touch_(Unix))
|
||||||
|
- [Man pages](http://man7.org/linux/man-pages/man1/touch.1.html)
|
||||||
* [Examples and options to use with the touch command](https://ss64.com/bash/touch.html)
|
- [Examples and options to use with the touch command](https://ss64.com/bash/touch.html)
|
||||||
|
Reference in New Issue
Block a user