You can use the following methods to get the current day of the week in Bash:
Method 1: Get Day of Week as Number (e.g. 1=Monday, 7 = Sunday)
date +%u
Method 2: Get Day of Week as Full Name (e.g. “Sunday”)
date +%A
Method 3: Get Day of Week as Abbreviated Name (e.g. “Sun”)
date +%a
The following examples show how to use each method in practice.
Example 1: Get Day of Week as Number in Bash
This article is currently being written on a Sunday.
We can use the following syntax to get the current day of the week as a number between 1 and 7 in Bash:
date +%u
The following screenshot shows how to use this syntax in practice:

This returns 7, which is the number that corresponds to Sunday as the day of the week.
If you want to extract the day of the week as a number for a specific date, you can use the following syntax instead:
date -d 2024-10-15 '+%u'
The following screenshot shows how to use this syntax in practice:

This returns 2, which represents the day of the week (Tuesday) for the date 2024-10-15 that we specified.
Example 2: Get Day of Week as Full Name in Bash
We can use the following syntax to get the day of the week as a full name in Bash:
date +%A
The following screenshot shows how to use this syntax in practice:

This returns Sunday, which is the day of the week represented as the full name.
Example 3: Get Day of Week as Abbreviated Name in Bash
We can use the following syntax to get the day of the week as an abbreviated name in Bash:
date +%a
The following screenshot shows how to use this syntax in practice:

This returns Sun, which is the day of the week represented as the abbreviated name.
Related Tutorials
The following tutorials explain how to perform other common tasks in Bash:
Bash: How to Get Month Name
Bash: How to Compare Dates
Bash: How to Extract Date from String
