or if you want to get just the amount of ram you can do:
cat /proc/meminfo | head -n 1
Another fun thing to do with ram is actually open it up and take a peek. This next command will show you all the string (plain text) values in ram.
sudo dd if=/dev/mem | cat | strings
Sometimes in troubleshooting, we want to know what processor we are dealing with along with how much CPU is currently being used by our OS and programs. We can do this with these two commands.
cat /proc/cpuinfo top
Keeping a computer within a safe temperature is the key to maintaining a stable system.
To list all the PCI devices in your system issues the following command:
For USB use:
It is oftentimes helpful to know what hard drives are connected to a system and what name was given them in the Linux directory. This info allows us to mount the hard drive and manipulate it.
sudo fdisk -l
Ever want to find all the packages that are installed on your system? You can find all the packages and also find out why they are on your system. You can even determine what packages depend on them if any.
Find all installed packages
dpkg --get-selections | less
Find out why a package is installed and what depends on it
aptitude why packagename
Find out where the package stores all of its files
dpkg -L packagename
ps -A | grep ProgramName kill 7207
Ctrl + Alt + f3 return with, Ctrl + Alt + f7
There are many great network scanners and assessment tools available for Linux but netstat is very easy to use often the first step in troubleshooting network issues. We will leave the rest of the network tools for a later article as there is so much to cover.
This command will allow you to see all the files that are currently open on your system. Limiting the directory or coupling this command with grep is often useful for finding files that are still openly restricting the ability to unmount a device. Lsof will also output the process id or PID. You can then kill the process using the kill command above.
The watch command will repeat a command at a set interval (default 2 seconds) and output the response. This is useful for watching directories that change, watching hard drives fill up when a lot of data is being transferred, or using it with lsusb to watch for USB devices being plugged in.
watch ls watch df -h
Often times when running a cron command you want to include the absolute path to the command. Sometimes I run scheduled PHP tasks. This can be accomplished by using the ‘whereis’ command.
dmesg | less
For more logs just cd into the /var/log directory and start using, cat, less, tail, grep, find or any other tool to view and search.
This is a set of tools designed for technical/advanced users who wish to know more about their hardware and related components for servicing. This tool comes with various commands namely lsvpd, lscfg, lsmcode, lsvio & vpdupdate. Let’s proceed below to know more about them.
It is a hardware inventory database program designed to re-implement AIX’s (IBM version of UNIX) related commands.
Vital Product Data contains information about your hardware or software. They include the configuration such as serial numbers, manufacturers, part numbers, etc.
Field Replaceable Unit refers to those components of the Circuit board in which any faulty part can be replaced by a technician or non-technician lacking deep knowledge about the hardware.
As of now, the tool is not available in the official Ubuntu repository but hey good news! The authors made a *.deb package version for you so you don’t have the headache of compiling it yourself. Head over here and download the package.
Then fire up your terminal and cd to the required directory and key in this command –
Now let’s run one of the tools: lsvpd; which is a viable one for now. But before that you have to know all the above-mentioned tools require root privileges, then again you have to update the VPD at least once. Alright then –
We have the following field:
The one highlighted green stands alone from other fields and the blue arrowed below shows similar output associated with various hardware.
Well, that alone is not understandable and the documentation is read as “machine-readable” so here are some of the few terms –
If you want more output then you have to pass the “debug” argument to lsvpd this way –
If you want output that distinguishes a global VPD (********) and partition private (========) then –
sudo lsvpd -m
You could also pass hardware serial and type model explicitly to get info about it using -s and -t respectively. However, that is not recommended.
And for the nerdy users, you can point your VPD database file to a different directory bypassing –
Here is a sample running lscfg tool –
And a sample screenshot running lsmcode with debugging enabled.
Installing and living with the Linux Diagnostic Tools is not pretty though because:
And later you’ll have to find a way out of this error while updating VPD using vpdupdate tool.
The solution I found out was to archive the VPD database in this way. sudo vpdupdate -a Otherwise, you could also delete all the contents of /var/lib/lsvpd/ and that helps too. Don’t forget to rerun vpdupdate tool again.
This is pretty much about it. In case you wish to learn more about a tool, it’s best you refer to it using man. Otherwise here are the two websites I recommend you to read: lsvpd and lscfg.