Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

get current timestamp shell

// If you want to get unix timestamp, then you need to use:
timestamp=$(date +%s)
Comment

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 :: telegram on archlinux 
Shell :: unzip linux gz 
Shell :: github see the username 
Shell :: ubuntu install jq 
Shell :: how to store a 6 digit number as 6 separate integers 
Shell :: ArgumentError: Malformed version number string 0.32+git 
Shell :: batch command run exe 
Shell :: 7z e into folder linux 
Shell :: comment in cmd 
Shell :: rpm fusion repo install fedora 
Shell :: uninstall vscode completely windows 10 
Shell :: arch console set default keyboard layout 
Shell :: for k in range bash 
Shell :: change hstr editor 
Shell :: hapus folder di linux 
Shell :: Upgrading/ updating dart sdk 
Shell :: git set alias 
Shell :: alpine linux list processes 
Shell :: ionic offline documentation 
Shell :: f.lux for ubuntu 18.04 
Shell :: uninstall brew from linux 
Shell :: sqlmap enumerate tables in databases 
Shell :: install qt4-qmake ubuntu 
Shell :: install qemu 
Shell :: netcdf4 install conda 
Shell :: how to copy file using ssh from computer to server 
Shell :: awk how to remove lines in one file that are found in another file 
Shell :: flutter uninstall package inside project 
Shell :: "C:UsersMY PCAppDataRoaming pm/node_modules/node/bin/node: line 1: This: command not found" 
Shell :: xclip does not work 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =