In this tutorial, I will write about Useful shell commands. Tips and trick about kill process, How to remove ssh host and SCP command. Bash script the essential for DevOps Roles.
Table of Contents
Useful shell commands
Kill Process
ps aux | grep <keyword> | grep -v grep | awk '{ print "kill -9", $2 }' | sh
For example, How to kill running Tilix process as the picture below
Kill the process Tilix
[huupv@huupv devopsroles]$ ps aux | grep tilix | grep -v grep | awk '{ print "kill -9", $2 }' | sh
How to remove ssh host
ssh-keygen -R <IP address/host_name>
SCP command
Upload to server
scp -i <ssh key private file> -r <local directory/file> <user>@<remote server>:<remote directory/file>
Download from server
scp -i <ssh key private file> -r <user>@<remote server>:<remote directory/file> <local directory/file>
Conclusion
Thought the article, How to use “Useful shell commands” as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!