Author: idmhelp
find command – examples
- Find – Most recent directory or folder
- Finding all files containing a text string on Linux
-
find / -type f -exec grep -H 'text-to-find-here' {} \;
- Further Example
-
OUD – Backup
LogRotate
https://support.rackspace.com/how-to/understanding-logrotate-utility/
Here is the shell script :
How to setup an SSH configuration
# How to setup an SSH configuration :
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_rsa. Your public key has been saved in /home/oracle/.ssh/id_rsa.pub. The key fingerprint is: 77:7d:c0:10:98:9f:71:55:95:ff:5a:36:2a:69:05:1d oracle@slc03mzv
# Generate the remote hostname keys
$ ssh-keygen -R host.example.com
# Copy the generate key over to the remote hosts.
$ ssh-copy-id oracle@host.example.com The authenticity of host 'host.example.com (10.244.15.16)' can't be established. RSA key fingerprint is 4f:43:cb:f2:c7:da:eb:a1:61:0c:9b:cb:42:0c:cb:ac. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'host.example.com' (RSA) to the list of known hosts. Warning: the RSA host key for 'host.example.com' differs from the key for the IP address '10.244.15.16' Offending key for IP in /home/oracle/.ssh/known_hosts:1 Are you sure you want to continue connecting (yes/no)? yes oracle@host.example.com's password: Warning: untrusted X11 forwarding setup failed: xauth key data not generated Warning: No xauth data; using fake authentication data for X11 forwarding. Now try logging into the machine, with "ssh 'oracle@host.example.com'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
# If you get following errors while login, you can update the known_hosts with ip address as well.
$ ssh host.example.com Warning: the RSA host key for 'host.example.com' differs from the key for the IP address '10.244.15.16' Offending key for IP in /home/oracle/.ssh/known_hosts:1 Matching host key in /home/oracle/.ssh/known_hosts:13 Are you sure you want to continue connecting (yes/no)? yes Warning: untrusted X11 forwarding setup failed: xauth key data not generated Warning: No xauth data; using fake authentication data for X11 forwarding. Last login: Mon May 23 06:23:16 2016 from dhcp.in.example.com
# If you get any ip address related error, update the ip address in the known_hosts file
$ vi /home/oracle/.ssh/known_hosts host.example.com, ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArjg18OaP/3kBgcOQ87DsEwbrEJA4n/e/2E4LBikgptHKfEdlXKh1DQGeLVBjS+cxWGmQ3Q+j2BPci540QwxDaP2zOY/syjJRWQSM1YMAsL+7BJtGCoSgBmdcSBxyZftnUGdl6/81EiuEzfox4yM4pIFbi6yD4ykxk4qPEzDCvEOxqFeHqtCkfxsqRI5quf38QbRHSCYrkgugRGDRSRQMEybksde0GV208JhbjVZUKjnc1xrQP2YcrWY12kfnk+GsGDkAbHPAQZdtH2T4/nywdqJp9vSwXirB2sbVXHiAH0Xf2DSlrplOtb5Hb/Z3NnGnt5q5BMNrSXMfWB+PALjZuQ==
# After setting up the ssh, it will not ask any password when you login to remote host. ( The option Y here enables trusted X11 forwarding )
$ ssh -Y hostname
Ref Links :
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys–2
http://stackoverflow.com/questions/20840012/ssh-remote-host-identification-has-changed
http://serverfault.com/questions/538045/offending-key-warning-when-i-do-ssh-to-vps
AWK Example – 1
Unix – Get Memory Stat
jps -lvm
Unix Tools – HA Proxy
Sed – Master Doc
$ change string in file, but saving the changes in another file, not orginal one?
$ sed -e “s/zmuser/${user}/g” original.txt > another.txt
Unix Grep Master Docs
# Returns the jars containing the missing class.
$ for i in `find $OIM_HOME -name '*.jar'`; do unzip -t $i | grep com/thortech/xl/util/tcUtilityFactoryInternal && echo $i; done 2>/dev/null
# echo after a grep search
$ echo "$(grep -R $id) found in the file"
# show several surrounding lines
grep -B 3 -A 2 foo README.txt
If you want the same number of lines before and after you can use -C num.
Text you want to be red
Your text here