Linux Proc System Directory – Ls (List Directory) Command Examples – Quick Tips


Listing the Linux /proc Directory Contents – A System Directory Below The / (Root) Directory

Logging In as “root equivalent” To See System Directories and the proc Directory

Run one of the following two commands to log in at the Linux prompt to “work as equivalent to root” to view the contents of the system directories and proc.

Type in su – and press Enter (be sure to use the dash with this command). Doing this makes you “equivalent to root” (unless you’re working with Ubuntu, Kubuntu, Edubuntu – or a variation of these distros).

If you’re using Ubuntu or a “derivative” of this distro, run “sudo -i” (without the quotes) to do the same as above.

The /proc Directory

This directory is the parent of a “virtual filesystem” and doesn’t actually exist on disk!

It is created in memory when Linux boots. And among other things, the files in this directory contain current settings that are used by the kernel (which is the “core” of the operating system).

For example, the file named cpuinfo in this directory contains settings regarding the cpu (processor) in a system.

And the file named meminfo shows the way that memory is being used and the file named version contains information regarding the current version of the kernel.

List the items in the root directory. This shows several Linux system directories – and notice that the directory named proc appears in the output.

# ls /

Now list the items in the proc directory and notice the files named cpuinfo, meminfo and version in the output.

# ls /proc

The Linux cat command is used to output (display) the contents of a file (typically a text file), such as the files in /proc.

Run the Linux clear and cat commands as shown in the example below to clear the current screen output and see the contents of the cpuinfo file. A ; (semicolon) is used between these commands and be sure to put a space on each side of the semicolon.

# clear ; cat /proc/cpuinfo

This shows lots of information about the cpu in your system.

Press the up arrow key to have the command above appear again and press backspace to remove “cpuinfo” and type in meminfo to see memory information.

If necessary, you can scroll up through the output with the up arrow at the top right in your terminal emulation window.

And then repeat the steps above to see the contents of the file named version.

Now output the contents of both of the files below.

# clear ; cat /proc/version ; cat /proc/cpuinfo

The Linux uname command is commonly used to see system information and the -a option shows “all” information. This command gets the information for it’s output from the cpuinfo and meminfo files.

# uname -a

The Linux proc directory and command examples shown here apply to ALL Linux distributions, including Ubuntu, Debian, SUSE, openSUSE, Fedora, Red Hat and Slackware Linux.


Leave a Reply