linux practical - shell commands Flashcards
how to check the version of the bash shell
echo $SHELL
how to change the password in linux
passwd
how do you clear the terminal
clear
who do you display who is the current login user in the terminal
whoami
the login user name is also displayed on the terminal prompt
how to display the current system date
date
eg output:
Tue Sep 15 12:00:29 SGT 2022
Display the Day of the Week
Format: %A
Example: date +%A
Output: Tuesday
Display the Day of the Month
Format: %d
Example: date +%d
Output: 14
Display the Month
Format: %B
Example: date +%B
Output: January
Display the Year
Format: %Y
Example: date +%Y
Output: 2022
Flashcard: Change Date Separator
Format: 2023 - 01 - 14
example: %Y-%m-%d
Output: 2022-01-14
Description: In this example, the date separator is changed from default ‘/’ to ‘-‘
Display the Timezone
Format: %Z
Example: date +%Z
Output: EST
Display the Day of the Week (abbreviated)
Format: %a
Example: date +%a
Output: Tue
Flashcard: Display the Month (numerical)
Format: %m
Example: date +%m
Output: 01
Display the current year in a different format (YY)
Command: date +%y
Description: Display the current year in the format of YY (Year)
Why the date command failed run when the format string does not have the single or
double quotes
When a format string contains spaces, it should be quoted by single or double quotes.
how to display the current calendar of the month
cal