I’ve been writing quite a bit of PowerShell code. The huge difference between PowerShell and Bash is that when executing a command, PowerShell returns collections of objects not just texts. That said, I still need to build my Bash muscle because Bash is useful after all in Linux world.
Today, I’m going to see what process is listening to which port on the local machine. It’s really critical to know this when you are troubleshooting a service that’s having a problem. Execute the following command.
$ sudo netstat -tlup
-t means –tcp. -u means –udp. -l means –listening and -p means –program. Let me show you the actual screenshot of the result.
As you can see, it lists all the processes (programs) that are listening on the machine. If you grep this result, you will be able to narrow down the result more to find the process that’s listening to certain port. Let’s see what’s up with ssh.
$ netstat -tulp | grep ssh
It’s listening the port “ssh”. Well, ssh usually listens to the port 22 so translate that in your head. I wonder if there is a way to actually show 22… I don’t know right now.
When something is not working, the first thing you should do is if a process is even listening to the expected port. This command will help you troubleshoot any service that may be serving people.
I downloaded CentOS 8 and I’ve installed the minimal install on my ESXi. There are some changes from CentOS 7 installation but there weren’t anything that got me confused.
I will paste some screenshot so that you get some feel for what to expect with CentOS 8 installation screen.
There is nothing too special in CentOS 8 installation. Just make sure what you want to install in Software Selection before you “Begin Installation.”
I will cover these things later but nmtui, yum, systemctl, hostnamectl are still available. Restarting network got me kind of confused because you have to systemctl restart NetworkManager in CentOS 8. Otherwise, it’s been pretty much the same so far.
There was a case where one of my CentOS servers running out of space at the root which is mapped to /dev/sda5. I didn’t think I was using it much but the df -h was telling me otherwise. So here is what I did.
$ cd /
$ sudo du -h --max-depth=1
The command shows which directory is taking up how much space in human readable format. Thanks to that, I figured out what the problem was. 🙂
I just watched the entire video of “How Netflix Thinks of DevOps” twice. It’s amazing to hear about the world class company’s system architecture and its culture. There is a lot to learn not only about its technology but their mindset and culture.
The part that I was most inspired about was the culture part. So many companies and recruiters are only interested in the number of years of experience and how many years of experience you have on certain technology. Don’t get me wrong. Experience is very important and as a person who has 21 years of experience, I have learned so much through my experience.
What I’m saying is quite often we engineers are not asked about the mindset and culture we bring to the company. I think the culture and mindset is very important. Extremely important. What I feel the most important thing is is the person someone you think you can work with and be able to contribute to your organization? When a company or recruiter asks me “how do you rate yourself with PowerShell out of 10?”, it really turns me off. Such a shallow way of gauging an engineer’s skill set. Isn’t it time when we are asked different kind of questions in hiring process?
As much as having technical knowledge is important, having the right mindset is critically important as an engineer.
After I published this article, I thought of definition of DevOps.
DevOps should not really be a job title. It’s a set of tools, automated processes, mindset and culture that helps move code from development to QA to staging to production systems as fast as possible with quality and values to customers. Agree?
I have an issue with PowerShell as I have VS Code on my Windows machine. When I’m using a regular PowerShell console, it uses one profile and when I’m on VS Code’s PowerShell console in Terminal, it uses different profile. I don’t want to have to manage both. I want to be able to consolidate to one.
When you are in regular PowerShell console, if you type $profile and hit enter, you will get a path like the following.
Microsoft.PowerShell_profile.ps1 but Microsoft.VSCode_profile.ps1 does not exist. So I thought I would create a symlink. Here what you can do. cd into the directory first and execute the following command as an administartor.