Linux Articles

Page 52 of 134

How to find out which process was killed by Linux OOM killer?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 884 Views

The Out of Memory (OOM) killer is a Linux kernel mechanism that terminates processes when the system runs out of available memory. When a process is killed by the OOM killer, the system logs this information to help administrators identify which processes were terminated and why. To find out which process was killed by the Linux OOM killer, we use the grep command to search through system log files. The grep command filters searches in files for specific patterns and is essential for analyzing log data. Basic grep Command Syntax grep [options] pattern [files] ...

Read More

How to find out which processes are using swap space in Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 2K+ Views

Swap space is a storage area on disk used by Linux when the physical memory (RAM) is full. When the operating system needs more memory resources and RAM has no space left, inactive pages are moved to swap space. While swap space helps extend available memory, it should not be considered a replacement for more RAM due to slower disk access speeds. There are several methods to identify which processes are using swap space in Linux. The most straightforward approaches include using system utilities like smem, the top command, or custom shell scripts. Using the Top Command ...

Read More

How to find the most recent file in a directory on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 3K+ Views

The Linux find command is one of the most widely used utilities that allows us to traverse a file hierarchy. It is primarily used to locate specific files or directories, and we can combine it with other Linux commands or flags to perform complex operations. Let's explore a basic example of the find command to understand how it works. In the example below, I am searching for a file named sample.sh using the find command: find sample.sh Output sample.sh Notice that if the find command locates the file, it prints ...

Read More

How to free Inode usage on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 3K+ Views

The inode (also known as index node) is a data structure that stores metadata about files and directories in Linux file systems. Each file or directory uses one inode, which contains information like permissions, ownership, timestamps, and pointers to data blocks. When inodes are exhausted, you cannot create new files even if disk space is available. Checking Inode Usage You can check the inode usage on your system using the df command with the -i option − df -i This displays inode information for all mounted filesystems − Filesystem ...

Read More

How to get Linux console window width in Python?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 537 Views

In order to get the width and height of the Linux console in Python, there are different modules available that we can make use of. Two of them are the os module and the subprocess module. In the case of the os module, we make use of the popen() method that is used to open a pipe to and from command which will help in retrieving the width and height of the Linux window. Using os.popen() Method Consider the code for the same shown below − import os rowSize, columnSize = os.popen('stty size', 'r').read().split() ...

Read More

How to get only the file name using find command on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 1K+ Views

The Linux find command is one of the most widely used utilities that allows us to traverse a file hierarchy. It is primarily used to locate specific files or directories, and we can combine it with various flags and options to perform complex operations. Let's explore a basic example of the find command to understand how it works. In the example below, we are searching for a specific file named sample.sh in the current directory: find sample.sh Output sample.sh If the find command locates the file, it prints the file ...

Read More

How to get the last dirname/filename in a file path argument in Bash?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 1K+ Views

Working with file paths is a common task in Bash scripting, and extracting the last component (filename) or parent directory name from a path is frequently needed. Bash provides several utilities to manipulate file paths effectively, with basename and dirname being the most commonly used commands. Getting the Last Filename with basename The basename command extracts the final component from a file path, removing all preceding directory components. This is useful when you need just the filename from a complete path. Basic Usage basename /path/to/file.txt file.txt Working with Environment Variables ...

Read More

How to get the start time of a long running Linux Process?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 994 Views

Whenever we want to get an update about a specific process or different processes, we make use of the ps command which is short for "Process Status". This command tells us about the state of current processes, their characteristics, and much more. When combined with several flags and options, we can enhance the ps command to output the start time of different processes running on a Linux machine. This is particularly useful for monitoring long-running processes and system diagnostics. Basic Commands to Display Process Start Time The command to print the start time of processes varies slightly ...

Read More

How to grep a string in a directory and all its subdirectories in Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 4K+ Views

The grep command in Linux is used to search for specific patterns or strings within files. It is one of the most essential Linux utilities for filtering and finding text content across files and directories. The pattern we search for is typically called a regular expression, and grep can search through single files, multiple files, or entire directory structures. Basic Syntax grep [options] pattern [files] Common Options Option Description -r or -R Search recursively through directories and subdirectories -n Display line numbers with matched ...

Read More

How to grep and replace a word in a file on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 4K+ Views

While there are plenty of ways to print and make use of specific words from a particular file in a Linux directory, when we talk about grepping a particular word and then replacing it with some other word, we need to use specific Linux utility commands. The two Linux utility commands that we must be aware of are − find − used to locate a particular file or directory sed − short for stream editor and is used to perform functions like searching, editing and replacing Basic Grep and Replace Operation To solve the ...

Read More
Showing 511–520 of 1,338 articles
« Prev 1 50 51 52 53 54 134 Next »
Advertisements