On CentOS 7, the last
command doesn't support the --since
option to filter users who have logged in within the past two weeks. However, you can use some other commands and scripts to achieve this. Here's a Bash script that can help you find users who have logged in within the past two weeks.
Save this script to a file, for example, show_recent_logins.sh
, and make it executable with the following command:
chmod +x show_recent_logins.sh
Then, you can run the script to display users who have logged in within the past two weeks.
The script calculates the date two weeks ago, extracts login data using the last
command, and filters the results to display users who logged in after that date.