As a Linux user, we use ssh command to log in to remote machines. The more you use ssh command, the more time you are wasting in typing some significant commands. We can use either alias defined in your .bashrc file or functions to minimize the time you spend on CLI. But this is not a better solution. The better solution is to use SSH-alias in ssh config file. A couple of examples where we can better the ssh commands we use. Connecting to ssh to AWS instance is a pain. Just to type below command, every time is complete waste your time as well. ssh -p 3000 -i /home/surendra/mysshkey.pem [email protected] to ssh aws1 Connecting to a system when debugging. ssh -vvv [email protected] to ssh xyz In this post, we will see how to achieve shorting of your ssh commands without using bash alias or functions. The main advantage of ssh alias is that all your ssh command shortcuts are stored in a single file and easy to maintain. The other advantage is we can use same alias for both SSH and SCP commands alike. Before we jump into actual configurations, we should know difference between /etc/ssh/ssh_config, /etc/ssh/sshd_config, and ~/.ssh/config files. Below is the explanation for these files. Difference between /etc/ssh/ssh_config and ~/.ssh/config System-level SSH configurations are stored in /etc/ssh/ssh_config. Whereas user-level ssh configurations are stored in ~/.ssh/config file. Difference between...Read More
Author: Surendra Anne
This is our third post on “30 mindmap series” from “The Linux Juggernaut”. In this post, we are sharing GIT tool for understanding it from different angles. We tried to include couple of things Git commands Git concepts Git stages Git terminology Git installation and setup Git public services GIT mind...Read More
The substring is a part of string/variable. We can create substrings from a ruby string variable. We already dealt with substrings in Shell scripting in our early post. This substring can be one character length or multiple characters length. Below are some examples which we are going to have a look. Print first character of a string Print first n characters of a string Print nth character of a string Print from nth to mth character of a string Print last character of a string Print last n characters of a string. Bit of background for Ruby string indexes As Array’s have indexes to access elements of an array, Strings/Variables to have index values. The first character of a string index number is 0; the second one is 1 and so on. If you want to get last character index either you have to count some character in that string or use negative numbers. For example, if you want the last element of a string use -1, last but one use -2, etc. We use Ruby IRB, which is an interactive Ruby Shell to show examples in this post. In this post, my string str1 is set to “The Linux Juggernaut.” Print first character of Ruby variable To print first character use index ‘0’ as shown below. Example: irb(main):001:0> str1 = 'The Linux Juggernaut' => "The Linux Juggernaut" irb(main):002:0>...Read More
Get more stuff like this
in your inbox
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Thank you for subscribing.
Something went wrong.
we respect your privacy and take protecting it seriously
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.