Posts

Showing posts from June, 2018

Step-by-Step: Split a string in shell and get the last field

Image
Introduction String manipulation is a crucial skill in shell scripting. One common task is to split a string and retrieve specific fields, such as the last one. This can be useful for various purposes, such as parsing file paths, URLs, or command outputs. In this guide, we'll explore different methods to split a string and get the last field in shell scripting, starting from basic techniques and moving towards more advanced examples. How to split a string in shell and get the last field. in this tutorial, i written a small program use bash script split string /www/huu/phan/com/xyz to new path /www/huu/phan/com and last field of new path /www/huu/phan/com is com . How to Split a string in shell and get the last field Input: one_path is /www/huu/phan/com/xyz Output: new_path is  /www/huu/phan/com last_field of new_path is com My bash shell as below: #!/bin/bash ############### # # Author: HuuPV # My blog: www.huuphan.com # ############### # How to split a string in shel...

Lock and Unlock zimbra account from command line

Image
Introduction Zimbra Collaboration Suite (ZCS) is a powerful, open-source email and collaboration platform. Managing user accounts efficiently is crucial for administrators to maintain security and ensure smooth operations. One essential skill is knowing how to lock and unlock Zimbra accounts via the command line. This capability is particularly useful for handling compromised accounts, maintaining system security, and troubleshooting user access issues. This article provides a comprehensive guide on how to lock and unlock Zimbra accounts from the command line. We’ll cover basic and advanced usage scenarios, helpful tips, and answers to frequently asked questions. By the end, you’ll be equipped to handle account management tasks confidently using Zimbra CLI commands. Why Lock or Unlock Zimbra Accounts? Use Cases for Locking Accounts Security Breaches : Prevent unauthorized access to compromised accounts. Policy Violations : Temporarily restrict access for accounts violating usage polici...

Linux diff command

Image
In this tutorial, I use diff command output on screen. How to compare different line by line in  files. How to compare side by side, color , output do not output common lines with diff command. What diff command work? compare files line by line For example my topic, I compare line by line in 2 file: file1.txt and file2.txt The content file1.txt file [huupv@huupv huuphan.com]$ cat file1.txt <####################################> author: huupv My Blog: www.huuphan.com Hello everbody! <####################################> The content file2.txt file [huupv@huupv huuphan.com]$ cat file2.txt <####################################> author: huupv My Blog: www.devopsrole.com Hello everbody! <####################################> The default compare line by line with diff comand [huupv@huupv huuphan.com]$ diff file1.txt file2.txt The output as below: 3c3 < My Blog: www.huuphan.com --- > My Blog: www.devopsrole.com The output nu...