What is the proc directory in Linux?

One of the most used simulated file systems in the Linux operating system is the Proc file system. This file system is generated on the fly when the system reboots and then destroyed when the system suspends. It serves as the kernel’s controller and knowledge center, containing valuable data regarding currently operating activities. The proc file system frequently serves as a conduit for communicating amongst kernel and Linux userspace. This guide will make you understand how to use the proc file system to check directories and folders in the Ubuntu Linux system.

Let’s get started. If you want to check the whole simulated proc directories using the Proc command in your Linux system, you can do it. Firstly, go to the activity bar and search for the command-line shell. Open it by tapping on it. You can also open it using the shortcut key “Ctrl+Alt+T”. When the command-line shell has been opened, now you can easily use the simple list command to list all simulated proc directories as below. You’ll see that every PID of a procedure has its dedicated repository if we list the folders. You will get a huge long list of directories and their users and privileges, as shown in the snap.

What is the proc directory in Linux?

If you only want to list the proc directories using the proc command, you can execute the below query in the terminal. You can find that the output has been highlighted for directories only.

$ ls –l /proc | grep ‘^d’

What is the proc directory in Linux?

In a Linux system, users can list all the currently running processes via the proc file system. So, try out the below “ps” command followed by the flag “-aux” to list all the running processes. The output shows the usernames, process IDs, percentage of CPU usage, memory usage, and a lot more.

What is the proc directory in Linux?

Let’s check for any specific process using its process ID. So, try the below-stated list query along with the Process ID in it. The output shows that there is currently no entry for this process ID in the proc file system.

What is the proc directory in Linux?

The/proc directory contains a folder to every currently running task or process in the Linux Operating system, which comprises kernel procedures. Some of the directories in the proc file system /proc/PID are cmdline, mem, cpu, diskstats, cwd, filesystems, version, environ, exe, maps, root, stat, statm, and many more. If you want to get information regarding different things of Linux system via Proc file system, you can do so by navigating to a proc directory or without it. Firstly, we will see it by navigating to a proc directory using the simple “cd” command in the shell as below.

What is the proc directory in Linux?

Now, as you have been navigated towards the proc directory, you can check more directories and their information. So let’s check for the memory information of a Linux system using the proc command. Try executing the below “cat” command to open the memory information folder. The output shows the data and details regarding memory usage, free memory, cached, buffers, and many more things.

What is the proc directory in Linux?

Let’s navigate to another subfolder, “12” in a proc directory using the “cd” command below.

What is the proc directory in Linux?

Now we are in the “12” folder. You can list all the files and folders in it using the below list command.

What is the proc directory in Linux?

Now you can check any listed file from the below image using the cat command. Let’s look at the “stat” file to look within it using the below cat command followed by the path. The output is showing statistics regarding it.

What is the proc directory in Linux?

Let’s check the status of a file system using the below cat query in the shell along with the path of a proc file “status”. The output is showing different information regarding it.

What is the proc directory in Linux?

Now we will have a look at different proc folders without navigating into a proc directory via the “cd” command. For this motive, we will be using the “less” command. Firstly, let’s have a look at the crypto folder to check information regarding it as below.

What is the proc directory in Linux?

The output in the snap below shows the details about the crypto folder, e.g., its name, driver, module, priority, type, size, and many more things. Press the “q” button to quit this window.

What is the proc directory in Linux?

If any user wants to check the version of the currently working Linux system on their setup, they can try the below “less” command along with the path of the version folder via the proc file system.

What is the proc directory in Linux?

And the output below is showing the version of the Linux system and the Gcc compiler and GNU versions. Tap on the “q” key from the keyboard to come back to a terminal.

What is the proc directory in Linux?

To check the memory information of a Linux operating system, try out the below “less” query in the shell, followed by the memory information folder path.

What is the proc directory in Linux?

So, the output is showing us detailed data about the memory usage of the Linux operating system. It shows the total memory, free memory, available memory, buffers, cached, active, inactive memory, and any other information. Hit the “q” key from the keyboard to quit it.

What is the proc directory in Linux?

Suppose somebody wants to check the information regarding disks and their statistics. In that case, they can easily utilize the underneath “less” query with the name of a folder mentioned as a path in the proc file system.

What is the proc directory in Linux?

The following window will be opened quickly. You can see the statistics regarding the disks of the Ubuntu Linux system, their partitions, and loops. Hit the “q” button to come out from this window into the command terminal.

What is the proc directory in Linux?

Conclusion:

In this guide, we have explained the proc file system in Ubuntu 20.04 system. I hope all the above-elaborated PROC file system commands and queries work for you.

About the author

What is the proc directory in Linux?

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.

Where is proc located?

The Linux /proc File System is a virtual filesystem that exists in RAM (i.e., it is not stored on the hard drive). That means that it exists only when the computer is turned on and running. It's not accurate to say that the kernel "updates the proc". Rather, the proc file system finds the data in the kernel.

What is the purpose of proc?

The /proc file system is a mounted file system used to trace a process system call, receive signals, and incurred machine faults. The /proc file system provides access to the state of each active process and thread in the system.

How does Linux proc work?

The proc file system acts as an interface to internal data structures about running processes in the kernel. In Linux, it can also be used to obtain information about the kernel and to change certain kernel parameters at runtime (sysctl).

What is proc in bash?

The /proc directory contains subdirectories with unusual numerical names. Every one of these names maps to the process ID of a currently running process. Within each of these subdirectories, there are a number of files that hold useful information about the corresponding process.