Tuesday, October 2, 2018

touch command examples

touch Command

1) Create a blank file
touch abc.txt

2) Creating multiple blank file
touch abc.txt abc1.txt abc2.txt abc3.txt

3) Creating multiple blank files with Regular Expression
touch {A..Z}.txt
touch {0..9}.csv

4) Changing the file access time
touch -a abc.txt

5) Changing the file modification time
touch -a abc.txt

6) Changing modification time of multiple files using RE
touch -m *.txt

7) Changing the file access and modification time of a file
touch -am abc.txt

8) Changing the file access and modification time of a file with reference of another file
touch -r xyz.txt abc.txt

No comments:

Post a Comment

Remove CTRL-M characters from a file in UNIX

 We can remove ^M by below methods 1st Method - Using sed command Type below command:    sed -e "s/^M//" filename > newfilena...