Skip to content

Instantly share code, notes, and snippets.

@tamld
tamld / rename-file.sh
Last active November 29, 2022 15:50
bash file rename extension file
#!/bin/bash
#!bash -c "
#1 line
#Rename the files from text to txt extension
#for file in *.text; do mv -- "$file" "${file%.text}.txt" ; done
#Multiple lines
# Rename all *.txt to *.text
for file in *.txt; do
@tamld
tamld / Search&replace.md
Last active December 9, 2022 05:18
search and replace

^ Caret matches the beginning of the line \s This matches any white space character

  • This is quantity operator for \s it match zero or more $ Dollar sign matches end of the line \n and this one matches new line character

#1 Remove all new line without any character ##\n and space behind

Recommend used

\n

@tamld
tamld / ssh-to-Windows-by-publickey.md
Last active January 17, 2023 14:16
ssh remote to Windows Administrator

SSH access to Windows from a Linux machine


Windows:

  • Install the OpenSSH server and start the OpenSSH service
  • Generate the keygen with command:
ssh-keygen -t rsa
  • Access folder ssh by default: %programdata%/ssh, edit the file sshd_config
@tamld
tamld / installfonts.sh
Created November 4, 2022 04:49
install powerlevel10k fonts
#!/bin/bash
#Install fonts
### Check if a folder fonts does not exist ###
if [ ! -d "$HOME/.fonts" ] #folder does not exit
then
echo "Directory $HOME/.fonts DOES NOT exists."
mkdir $HOME/.fonts
fi
# Base Url from where fonts are to be downloaded