bash - Kote

Remove old files in bash using ‘find’

How to quickly remove old files or likely old log files using bash? Just a few lines in bash can solve it.
Firstly, list all files older than 7 days for required directory:

find /home/my-user/my-logs -type f -mtime +7

After that, delete all those files:

find /home/my-user/my-logs -type f -mtime +7 -delete

Here are the man page for the find command in arch manual page.

Working with SSH keys for remote sessions in Linux

SSH keys can be used as an excellent choice for authenticating remote hosts. Using keys instead of simple usernames and passwords have many advantages, however, what is more, essential for me to – use an ssh key helps establish a connection faster and more secure. Let’s review how to create, share and use keys. Continue reading “Working with SSH keys for remote sessions in Linux”

HSTR (HiSToRy) – Advanced console history search

HSTR or HH is a great tool that speeds up console usage due to the intelligent search for recent and favorite commands. Before that, I used to have a few hacks like running grep for history ($ history | grep {my-search-request}), but with a new HH help, I feel like I can focus on tasks and not worry about recent commands entered as they can be accessed fast and convenient.

Continue reading “HSTR (HiSToRy) – Advanced console history search”