mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-25 22:07:01 +00:00
Merge pull request #48 from PoplarYang/master
fix typo '//dev/shm/200m' and add 'current time point for N days ago or after N days'
This commit is contained in:
commit
a606d6be45
19
README.md
19
README.md
@ -1145,6 +1145,21 @@ date --date @1615852800
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Print current time point for N days ago or after N days
|
||||||
|
```bash
|
||||||
|
# get this time a day ago
|
||||||
|
date -d"1 day ago" +"%F %H:%M:%S"
|
||||||
|
|
||||||
|
# get this time tomorrow
|
||||||
|
date -d"-1 day ago" +"%F %H:%M:%S"
|
||||||
|
|
||||||
|
# get this time 7 days ago
|
||||||
|
date -d"7 days ago" +"%F %H:%M:%S"
|
||||||
|
|
||||||
|
# get this time a week ago
|
||||||
|
date -d"1 week ago" +"%F %H:%M:%S"
|
||||||
|
```
|
||||||
|
|
||||||
##### wait for random duration (e.g. sleep 1-5 second, like adding a jitter)
|
##### wait for random duration (e.g. sleep 1-5 second, like adding a jitter)
|
||||||
```bash
|
```bash
|
||||||
sleep $[ ( $RANDOM % 5 ) + 1 ]
|
sleep $[ ( $RANDOM % 5 ) + 1 ]
|
||||||
@ -3240,9 +3255,9 @@ fallocate -l 10G 10Gigfile
|
|||||||
|
|
||||||
##### Create dummy file of certain size (e.g. 200mb)
|
##### Create dummy file of certain size (e.g. 200mb)
|
||||||
```bash
|
```bash
|
||||||
dd if=/dev/zero of=//dev/shm/200m bs=1024k count=200
|
dd if=/dev/zero of=/dev/shm/200m bs=1024k count=200
|
||||||
# or
|
# or
|
||||||
dd if=/dev/zero of=//dev/shm/200m bs=1M count=200
|
dd if=/dev/zero of=/dev/shm/200m bs=1M count=200
|
||||||
|
|
||||||
# Standard output:
|
# Standard output:
|
||||||
# 200+0 records in
|
# 200+0 records in
|
||||||
|
Loading…
Reference in New Issue
Block a user