Command on Command LineVinay Muley
Being a Software Engineer is not just writing code, debugging, and deploying them. At times one has to use the command line and remotely operate on a server to get system details to monitor the system, change some configurations, or sometimes could be to find network-related issues. Command-line basically allows users to perform all the actions they could perform using GUI and even could do more powerful actions. This way you feel connected to your system.
Apart from the day-to-day operations like copying, moving, or deleting directories or files from one location to another we can use Command line tools like curl or wget to test APIs and that too without writing any code in a file. This can come in handy to test some APIs on the go and also to download files from a server. Other tools that can come in a developers day to day use are ssh(Secure Shell), SCP(Secure Copy), and telnet. SSH is used to remotely access a system which could be a server or a system that is in the same network. SCP as the name suggests can be used to copy a file from your local system to a remote system or to a system within a network or it can be used to copy from a remote to your local system. In a world where connectivity is an important part of our day-to-day operations, these commands are very useful in the community and are widely used. There are a number of tools to use on the command line depending on your use case. Be it to check the open ports or active connections to a system or to change a file’s permissions and make them executable.
A bunch of commands when combined and written in a file is a shell script. It also allows users to handle conditions, declare variables, and more just like another program. This can be useful to make some tasks automated with the help of cron jobs which basically can work as a scheduler to execute certain tasks at a particular time. For example, a script that backup data at a specific time interval. There can be many examples where you can use shell scripts. I have been using shell scripts to perform repetitive tasks. A process used to crash in one of my applications that I wanted to monitor, so I created a script that executed every minute through crontab and used to check if the process status is running and if not found running, it used to restart the process again. Another script that I use is to start all the apps that I need when my system boots. This script is set @reboot in the crontab. Shell scripts ease out most of the day-to-day repetitive tasks and we don’t have to enter commands one at a time.
With this much power of the command line in hand, it could also be a risk to your systems and could result in data loss from your systems if you enter any command unknown to you. So making sure to read and verify the command, its options, and arguments won’t do any harm.