From the course: Linux: System Maintenance

Explore a system - Linux Tutorial

From the course: Linux: System Maintenance

Start my 1-month free trial

Explore a system

- [Instructor] When you're maintaining a system, sometimes you know all about it. Maybe it's a standard configuration. Maybe you built it yourself. Maybe you use it everyday. But sometimes you'll need to learn a little bit about the system. What specific operating system is it running? Is it a virtual machine or a physical machine? How much RAM and disk space does it have? Who is using the system right now? In order to find out some general information about the system, we can use a series of commands to fill in the blanks and get to know whatever system we're using. First let's take a look at the hostnamectl command. This tells us, among other things, the system's hostname, and whether or not it's virtualized. I can see that from the Chassis here. Mine says vm because I'm using a virtual machine, but you could also see desktop or laptop here depending on what kind of system you're using. If it's virtualized, I can see what kind of virtualization it's using. And here's the operating system that we're using. Here's the kernel, and the system architecture, and we can dive deeper with this information here. For example, if you want to find out more about the operating system that's running, you can take a look at the release information, which does vary by distro. With cat /etc/*-release. Using the wildcard captures a whole range of options, so it'll work in many different environments. Because of that, there will be some duplicated information sometimes, because we're looking at more than one file. But it's a quick way of learning about the environment. For example, here on my system, I can see that I'm using CentOS 7.2.1511. I'll clear the screen. We can also find out some information about our hardware here. Lscpu, or listcpu, can tell us about the processors that the system is using. Here I can see that I have a dual processor system, and it's an Intel Xeon processor. Yours will probably be different. I can take a look at how much memory the system has with the free command. Or to make things a little clearer, I can use the -h option for human readable sizes. I can see this machine has about two gigabytes of RAM, of which 1.2 gigabytes is currently free. I can also take a look at how much disk space is available and used with the df command. Or as with the free command, df - h for human readable sizes. I can see my root partition here is 40 gigabytes, and of that 35 gigabytes are free. There's a few more commands that can be helpful in exploring a system. The who command shows me what users are logged into the system, and I can take a look at the network adapter and address information with the ip a command, or ifconfig on older systems. This shows me the network adapters, MAC addresses, and IP addresses, and their status. I'm most interested in the ethernet one here, enp0s3, which I can see is active, and has an IP address of 10.0.2.4. I can take a peek at what hardware is connected to the system too, with lsusb to show USB devices. I don't have any plugged in right now, and lspci to show devices on the PCI bus. That's a quick look, and we'll dive much deeper into many of these commands throughout the course.

Contents