Chuyển đến nội dung chính

Bài đăng

Đang hiển thị bài đăng từ Tháng 2, 2023

Replace text in multiple files

How to find and replace text in multiple files? In Windows, we could use Find and Replace (FNR) (download link: )

Useful SQL Scripts, Funtions

Get date, time Retrieve the current date and time select getdate() (or in MySQL: select now()) Retrieve only date, only time  select * from flights where convert(date, ariveddate) = '2021-02-22' select * from flights where convert(time,arriveddate) >'13:00' String update articles set imageurl = convert(varchar(10), articleid)+ '.jpg' Wildcard character select ('^'+Pattern), Pattern,* from Pictures where Pattern like '%[.]%' and CHARINDEX('^', Pattern)<>1 Trim select count(*) from flights where code like '%  '  update flights set code = trim(code) where code like '%  '  update Flights set AircraftCode = trim(AircraftCode) where CHARINDEX(' ',AircraftCode) > len(trim(AircraftCode))

CentOS Linux commands

  Basic commands Shutdown/restart > reboot > shutdown Clear screen Ctrl + L To clear the terminal screen, following is the command that you need to run:  clear CD $ cd .. $ cd / List  List s directory contents of files and directories $ ls | more $ ls | less Kết  hợp với các phím để cuộn lên xuống: shift + page up/down Get command helps $ df --help Get size of directories - du d isk u sage // d isplay amount space u sed của thư mục hiện tại $ du -sh //xem size của các thư mục, files trong thư mục hiện tại $ du -sh * Check disk space usage - df d isk f ilesystem $ df -h Computer memory and swap - free free command is used to get the detail used and unused information of the computer memory and s

How To Reset A VM in VMWare Via SSH

  vim-cmd vmsvc/getallvms vim-cmd vmsvc/power.getstate <vmid> vim-cmd vmsvc/power.shutdown <vmid> vim-cmd vmsvc/  <vmid> vim-cmd vmsvc/power.on <vmid> Error: "The virtual machine inventory file is damaged or unreadable..." For ESXi 3.5, 4.x, 5.x, 6.x Log in to the VMware ESX/ESXi host as the root user. For more information on VMware ESXi 4.1 and ESXi 5.x Technical Support Mode, see Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910) To list all running virtual machines and their corresponding VMIDs, run these commands: vim-cmd vmsvc/getallvms cd /etc/vmware/hostd/ Make a copy of vmInventory.xml file by running this command: cp vmInventory.xml vmInventory.xml.bak   Stop the vpxa and hostd services by running these commands: /etc/init.d/vpxa stop /etc/init.d/hostd stop   Rename the vmInventory.xml file by running this command: Note: This action unregisters all virtual machines from the host. mv vmInventory.xml vmInventory_xml.bak   Start

Some Secure Shell Clients

An SSH client is a program that enables secure remote access to a server or computer using the SSH (Secure Shell) protocol. It allows users to connect to a remote host securely, encrypting the data sent between the client and the server, and providing authentication mechanisms to ensure that only authorized users can access the system. SSH clients are commonly used in the administration of remote servers, as well as in secure file transfers, tunneling, and other network-related tasks. Some popular SSH clients include OpenSSH, PuTTY, and SecureCRT. SSH (Secure Shell) is a network protocol that provides a secure and encrypted channel over an unsecured network, such as the internet. The protocol uses a client-server model, where the SSH client initiates a connection to the SSH server, and then the two communicate securely. An SSH client is software that runs on a local computer and allows users to connect to a remote server or computer using the SSH protocol. The client provides an interf