buy tb500

Archive for November, 2022

sed to find and replace in file (in linux)

Wednesday, November 30th, 2022

sed -i” -e ‘s/alayan\.co/al\-ayan\.com/g’ alayan_wp.sql

journalctl commands to check the logs

Thursday, November 17th, 2022

Time Ranges

To see messages logged within a specific time window, we can use the --since and --until options. The following command shows journal messages logged within the last hour.

$ journalctl --since "1 hour ago"

To see messages logged in the last two days, the following command can be used.

$ journalctl --since "2 days ago"

The command below will show messages between two dates and times. All messages logged on or after the since parameter and logged on or before the until parameter will be shown.

$ journalctl --since "2015-06-26 23:15:00" --until "2015-06-26 23:20:00"

For greater accuracy, format the date and time as “YYYY-MM-DD HH:MM:SS”. You can also use any format that follows the systemd.time specification.

Docker deletes all containers that have a status of exited

Monday, November 7th, 2022

docker rm $(docker ps -a -q -f status=exited)

or

docker container prune

the two commands are same, the latest one is the newest one. in the new version of Docker

This command deletes all containers that have a status of exited. In case you’re wondering, the -q flag, only returns the numeric IDs and -f filters output based on conditions provided. One last thing that’ll be useful is the --rm flag that can be passed to docker run which automatically deletes the container once it’s exited from. For one off docker runs, --rm flag is very useful.