Getting ram information

cat /proc/meminfo

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

Getting cpu info

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

Linux top command

Check the temperature of your CPU

Keeping a computer within a safe temperature is the key to maintaining a stable system.

cat /proc/acpi/thermal_zone/THRM/temperature

Check Linux Temperature
cat linux temperature

List PCI and USB devices

To list all the PCI devices in your system issues the following command:


For USB use:


Check out how much hard drive space is left

df -h

Linux show hard drive space

See what hard drives are currently detected

It is often times 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

fdisk -l

Installed Programs


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 packages is installed and what depends on it

aptitude why packagename

Find out where the package stores all of its files

dpkg -L packagename

Kill a process

ps -A | grep ProgramName
kill 7207

Linux kill firefox


Go to a terminal

Ctrl + Alt + f3
return with, Ctrl + Alt + f7

Show all network connections

There are many great network scanners and assessment tools available for Linux but netstat is a very easy to use often a 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.


List all files that are currently open on the system

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 open restricting the ability to unmount a device. Lsof will also ouput the process id or PID. You can then kill the process using the kill command above.


Keep an eye on something for awhile

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 transfered, or using it with lsusb to watch for USB devices being plugged in.

watch ls
watch df -h

Find where a binary is stored and its libraries

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 acomplished by using the ‘whereis‘ command.

whereis php5


See if you have kernel boot issues

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.

Subscribe via Email

Subscribe to Nixtutor via Email

Enter your email address:

Was this information useful?

24 Responses

  1. Adam


    This could be very useful; thank you!

  2. Eric Wendelin


    Nice dude! I forgot about the watch command. Thanks!

  3. miro


    Best command

    fuser file.txt

    prints the process using the file.

  4. Mark Sanborn



    Nice tip!

  5. [...] General Troubleshooting in Linux Useful collection of tips. (tags: linux) [...]

  6. Chris


    I actually think the last command you issued is probably the first thing to check on a linux box thats having problems. Actually, its applicable to solaris as well and probably *BSD (guess I should check that later). I’ve uncovered more kernel module issues and bad hardware through it than almost anything else on my linux machines.

    The temperature command is really interesting as well but I wonder how accurate it will be on various machines. It’ll be dependent upon the kernels understanding of the specific hardware monitoring chips installed on the board correct?

  7. Mark Sanborn


    You are right about the temperature. I have seen systems where the temperature command returns null.

    However, for the systems that return something it should be accurate as motherboards that support ACPI have to follow that specification.

  8. Brian


    Great list. A faster way to get a process ID is the command pidof. Also you can kill a process from top by pressing “k” followed by the process id that you want to kill.

  9. Mark Sanborn


    Wow, awesome tips thanks Brian!

  10. Casual Nixtutorer


    What terminal font do you use, Mark?

  11. Mark Sanborn


    The default monospace. :)

  12. BigKahunaca


    Something unrelated, but your Copyright is still listed as 2008. Might want to change it.

  13. BigKahunaca


    Good site btw, looking forward to more articles.

  14. Mark Sanborn


    BigKahunaca, Thanks it’s fixed now…

  15. Slacker 12.2


    Nice nice nice!! Keep it coming :)

  16. Yang


    Mark, here’s maybe a typo: dpkg –get-selections | less

    It should be: dpkg -–get-selections | less

    You missed a slash.

  17. Mark Sanborn



    Actually I think it is there but the font makes it appear to be a single dash. I will see what I can do to make them separate.

  18. Yaro


    One issue with the “installed packages” section is that those programs only exist on distributions built on the Debian package system. I use Arch, it has its own packages and methods. And none of my tools are Debian-based. And of course, there’s the direct “competitor” to the Debian package system, the Red Hat packaging system, which also uses its own tools and is incompatible with the Debian system.

    I don’t know the RPM commands, but here’s the pacman commands for Arch:

    Find all installed packages
    pacman -Q (I recommend piping this to less or more.)

    Find out where the package stores all of its files
    pacman -Ql packagename

    Unfortunately, I don’t think pacman or it’s EXCELLENT frontend wrapper (yaourt) has an aptitde why equivalent.

  19. Spuffler


    For Ubuntu Netbook Remix v9.04, as installed and running on my EeePC 900A, the correct CPU temperature value is found using:

    cat /proc/acpi/thermal_zone/TZ00/temperature

    and FWIW, the memory strings trick produces several screens full of fairly raw output; noobs might want to pipe the output into a txt file if they do not understand how to get a terminal to scroll back by several screens….

  20. Yaro


    Spuffler – Why pipe into a file? That sounds like a gross and, even worse, unneeded way to use space. Just pipe it through less like a good boy. No wasted space and one can scroll up and down and review.

    Also, I see very little practical purpose in peeking at strings in memory.

  21. Jeff


    Ubuntu/Debian based systems use dpkg.

    Elitist snobbish bastards like me use “emerge -vpe world|less” on our systems.

    But the rest was good.

  22. robb


    nice tips for linux beginners.
    now add some bash stuff for a little advance topic.

  23. David


    how to do check for no sound

  24. Kojle


    Very useful!
    Happy New Year