Here you go:
date +%Y%m%d%H%M%S
As man date
says near the top, you can use the date
command like this:
date [OPTION]... [+FORMAT]
That is, you can give it a format parameter, starting with a +
.
You can probably guess the meaning of the formatting symbols I used:
%Y
is for year%m
is for month%d
is for day- … and so on
You can find this, and other formatting symbols in man date
.
Related Contents:
- YYYY-MM-DD format date in shell script
- Print a file’s last modified date in Bash
- Convert Unix timestamp to a date string
- Convert date time string to epoch in Bash
- How to find the difference in days between two dates?
- How do I split a string on a delimiter in Bash?
- Check existence of input argument in a Bash shell script
- How to echo shell commands as they are executed
- How can I compare numbers in Bash?
- Why is whitespace sometimes needed around metacharacters?
- How to urlencode data for curl command?
- How to represent multiple conditions in a shell if statement?
- How can I suppress all output from a command using Bash?
- Running script upon login in mac OS X [closed]
- How can I detect if my shell script is running through a pipe?
- Returning a boolean from a Bash function
- Only get hash value using md5sum (without filename)
- Remove duplicate entries in a Bash script [duplicate]
- Quick-and-dirty way to ensure only one instance of a shell script is running at a time
- How to check if running in Cygwin, Mac or Linux?
- How can I debug a Bash script? [closed]
- How to tell if a string is not defined in a Bash shell script
- Count occurrences of a char in a string using Bash
- How to specify a multi-line shell variable?
- Relative paths based on file location instead of current working directory [duplicate]
- Curl with multiline of JSON
- What does “export” do in shell programming? [duplicate]
- What is the exact meaning of IFS=$’\n’?
- Detect if homebrew package is installed
- Equivalent of rm and mv in windows .cmd
- Difference between terms: “option”, “argument”, and “parameter”?
- What does “-ne” mean in bash?
- Bash: Copy named files recursively, preserving folder structure
- Why sudo cat gives a Permission denied but sudo vim works fine? [duplicate]
- How do I launch a Git Bash window with particular working directory using a script?
- Print a character repeatedly in bash [duplicate]
- executing shell command in background from script [duplicate]
- is there an escape character for envsubst?
- Boolean operators ( &&, -a, ||, -o ) in Bash
- Get UTC time in seconds
- Run one command after another, even if I suspend the first one (Ctrl-z)
- Multi-dimensional arrays in Bash
- Calling one Bash script from another Script passing it arguments with quotes and spaces
- What does the Bash operator
- VSCode Integrated Terminal Doesn’t Load .bashrc or .bash_profile
- Is there a way to make bash job control quiet?
- Get the name of the caller script in bash script
- source all files in a directory from .bash_profile
- How to initialize a bash array with output piped from another command? [duplicate]
- how to write a process-pool bash shell