Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
If your in docker swarm and you want to see log data of a specific service you can use --since as below:

docker service logs project_redis --since "1m" -f

It sometimes has unexpected behaviours and does not print logs. Rather than --since you can use tail it is better in case you want to see recent logs:

docker service logs project_redis --tail 1

#docker #swarm #since #tail #log
tail command in Linux is used to see content of a file from the end. It is usually used for checking log files in server. The interesting thing about tail is that you can use this command to get the last line. So in a bash script if you want to get last row of the below output:

root@server:~# ls -l
total 24
-rw-r--r-- 1 root root 291 May 26 05:19 es_queries
-rw-r--r-- 1 root root 1198 Jun 19 10:34 users.json
-rwxr-xr-x 1 root root 272 Jun 19 11:22 monitor_disk_space.sh
-rwxr-xr-x 1 root root 433 Jun 19 10:00 another_script.sh

You would do:

root@server:~# ls -l | tail -1
-rwxr-xr-x 1 root root 433 Jun 19 10:00 another_script.sh
That's why we have used this command in the previous post on df -k /.

#bash #tail #script #ls