Ask Your Question

How do I insert spaces in the [+format] string of the date command

asked 2016-12-20 15:50:52 -0500

Andrei Costache gravatar image


I am running Fedora Core 25, GNU Coreutils 8.25. I use one of the virtual consoles (Ctrl+Alt+F3).

When I run:

date +%a%b

I get:


I would like to insert a space between Tue and Dec, therefore I run:

date +%a %b

However, instead of a space between Tue and Dec, I get:

date: extra operand %b

Can you guys help me out to get the space between Tue and Dec?

Many thanks, Andrei

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-12-20 16:55:47 -0500

Rabin gravatar image

updated 2016-12-21 04:22:58 -0500

use " (quotes) to aggregate parameters which include spaces

date "+%a %b"
edit flag offensive delete link more


This basic explanation of usage of quotes in terminal commands may be useful:

florian gravatar imageflorian ( 2016-12-20 23:30:13 -0500 )edit

Here is the official documentation of the bash shell:

florian gravatar imageflorian ( 2016-12-20 23:31:41 -0500 )edit

Question Tools

1 follower


Asked: 2016-12-20 15:50:52 -0500

Seen: 307 times

Last updated: Dec 21 '16