mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-12-22 16:26:35 +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)
|
||||
```bash
|
||||
sleep $[ ( $RANDOM % 5 ) + 1 ]
|
||||
@ -3240,9 +3255,9 @@ fallocate -l 10G 10Gigfile
|
||||
|
||||
##### Create dummy file of certain size (e.g. 200mb)
|
||||
```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
|
||||
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:
|
||||
# 200+0 records in
|
||||
|
Loading…
Reference in New Issue
Block a user