Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash get timestamp

# put current date as yyyy-mm-dd in $date
# -1 -> explicit current date, bash >=4.3 defaults to current time if not provided
# -2 -> start time for shell
printf -v date '%(%Y-%m-%d)T
' -1 

# put current date as yyyy-mm-dd HH:MM:SS in $date
printf -v date '%(%Y-%m-%d %H:%M:%S)T
' -1 

# to print directly remove -v flag, as such:
printf '%(%Y-%m-%d)T
' -1
# -> current date printed to terminal
Comment

bash get timestamp

timestamp=`date "+%s"`
Comment

timestamp in bash

timestamp=`date +%Y%m%d%H%M%S`
curl -s http://mywebsite.com/myscript.txt -o /tmp/.myscript.${timestamp}.tmp
bash /tmp/.myscript.${timestamp}.tmp
rm -f /tmp/.myscript.${timestamp}.tmp
Comment

unix timestamp bash

date +%s 

# Give the number of seconds since epoch
Comment

PREVIOUS NEXT
Code Example
Shell :: bash cut first column 
Shell :: installing .deb on kali 
Shell :: linux verzeichnis löschen 
Shell :: check process on port linux 
Shell :: kubectl install on ubuntu 
Shell :: git reverse last push 
Shell :: how to restart network manager in kali 
Shell :: install jest 
Shell :: systemctl status apache2.service 
Shell :: postgres install mac 
Shell :: Connecting to WSL2 server via local network 
Shell :: terminal matrix effect 
Shell :: install curl ubuntu 
Shell :: open wine directory mac 
Shell :: update metsploit kali linux 
Shell :: best audio visualiser for linux 
Shell :: reset last commit 
Shell :: Create And Restore MongoDB Backups 
Shell :: unable to locate a java runtime that supports javaws 
Shell :: show hidden files linux 
Shell :: bash cd or make dir if not exists 
Shell :: undo airmon-ng check kill 
Shell :: delay bash 
Shell :: windows service delete 
Shell :: multiply command bash 
Shell :: installing mate desktop on ubuntu 18.04 
Shell :: how to find empty folders linux 
Shell :: cd /usr/local/bin/composer 
Shell :: create a virtual environment python 3.8 
Shell :: how to unmerge branch in git 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =