Categories
Uncategorized

Find file in dir and all sub dirs

find foldername -name "filename"
Categories
Uncategorized

ssh key with root

Copy ssh key from clientsvr to backupsvr

From clientsvr, generate ssh key, accept al defaults

su
cd ~
ssh-keygen

On backupsvr, edit the ssh confile, /etc/ssh/sshd_config

replace
PermitRooLogin no
With
PermitRootLogin yes
PermitRootLogin without-password

Reload sshd daemon:

systemctl restart sshd

Back to clientsvr

ssh-copy-id -i root@backupsvr
ssh root@backupsvr

Back to backupsvr:

emacs /etc/ssh/sshd_config
remove
PermitRootLogin yes
exit emacs
reload sshd
systemctl restart sshd

==== If ssh_copy-id is not available ====

From local host (from client)

cat .ssh/id_rsa.pub | ssh myRemoteServer 'cat >> .ssh/authorized_keys && echo "Key copied"'
Categories
Uncategorized

Emacs shortcuts

Select Multiple lines, cut and paste:
ctrl + space --> to mark the starting point
ctrl + w --> to cut
ctrl + y --> to paste selection

String Replacement:
Esc, Shift %
Enter new text to replace press return
Enter new replacement text press return
Press ENTER to cancel
Press . (dot) to raplace the first occurrence
Press ! to replace all selected text

Comment out multiple lines

ctrl + space --> to mark the starting point, then make your selection with up/down arrows
Esc ; 
enter

#To uncomment
Esc ;
Enter

Delete trailing ^M

Esc-x delete-trailing-whitespace

Search a region

C-x n n
C-s itemtosearch
C-x n w

Replace Commas with Return or empty space

Ctrl x replace-string
Enter
,
Enter
Ctlr-j
Enter

Go to the beginning of a word

Esc-m

Convert all letters to upper case

Esc-x
uppercase-region
Enter