Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Operating System Articles
Page 110 of 171
Find the Process That is Using a File in Linux
When working with files in Linux, you may encounter situations where you cannot unmount a filesystem or access a file because it shows as "busy". This occurs when a process is actively using the file, keeping it open for reading or writing. To resolve this, you need to identify which process is using the file. This tutorial covers the essential commands to find processes that are using specific files in Linux systems. Note − Linux commands are case-sensitive. Commands to Find the Process Linux provides several commands to identify processes working with files. These commands gather ...
Read MoreFixing the "Too many open files" Error in Linux
On Linux servers under heavy load, the "too many open files" error occurs frequently. This error indicates that a process cannot open new files (file descriptors) because it has reached the system-imposed limit. Linux sets a default maximum open file limit for each process and user, and these default settings are often modest for production workloads. The number of concurrent file descriptors that users and processes can open is constrained by system limits. When a user or process attempts to open more file descriptors than allowed, the "Too many open files" error appears. The solution involves increasing the maximum ...
Read MoreHow to Set Wget Connection Timeout in Linux?
Wget is a free GNU command-line utility for downloading files from web servers using HTTP, HTTPS, and FTP protocols. When downloading files over unreliable network connections, you may encounter timeouts that cause downloads to fail. Linux provides several wget timeout options to handle these situations effectively. Installing Wget in Linux Most modern Linux distributions come with wget pre-installed. To check if wget is available, open your terminal and type wget. If installed, you'll see "wget: missing URL". If not installed, you'll see "command not found". Ubuntu and Debian sudo apt install wget CentOS ...
Read MoreHow to Show the wget Progress Bar Only in Linux?
Remote management of UNIX/Linux/BSD servers via SSH session is a common practice. For installation, you might need to download software or other files. While Linux has several graphical download managers, the wget command-line tool is preferred for non-interactive downloads. The wget command supports various Internet protocols including HTTP, HTTPS, and FTP. Basic Wget Usage The simplest use of wget is downloading a single file to your current directory. Type wget followed by the file URL − $ wget https://www.tutorialspoint.com/index.htm --2022-12-26 10:18:13-- https://www.tutorialspoint.com/index.htm Resolving www.tutorialspoint.com (www.tutorialspoint.com)... 192.229.221.69 Connecting to www.tutorialspoint.com (www.tutorialspoint.com)|192.229.221.69|:443... connected. HTTP ...
Read MoreParse Command Line Arguments in Bash on Linux
Command-line arguments are parameters passed to bash scripts that allow users to customize script behavior without modifying the script itself. These arguments can be processed sequentially as positional parameters or parsed as options using built-in utilities like getopts and external tools like getopt. Note − Linux commands are case-sensitive. Basic Command Line Arguments Bash automatically stores command-line arguments in special variables: $0 − Script name $1, $2, $3... − Positional arguments $# − Number of arguments $@ − All arguments as separate strings $* − All arguments as a single string #!/bin/bash ...
Read MoreSkip Hidden Files and Directories During Recursive Copy
Recursive copying is a common task in Linux systems, but sometimes we need to exclude hidden files and directories (dotfiles) during the process. Hidden files in Linux are those that start with a dot (.) and are typically used for configuration files and system data that should remain invisible during normal operations. This tutorial demonstrates various methods to skip hidden files and directories when performing recursive copy operations using different Linux utilities. Note − Linux commands are case-sensitive. Using cp Command with Shell Globbing The standard cp command can be combined with shell globbing patterns to ...
Read MoreTesting Bash Scripts With Bats in Linux
Bash Automated Testing System (BATS) is a testing framework designed specifically for bash scripts. It allows developers to write automated tests for their bash code, ensuring scripts function correctly before deployment and improving code reliability in production environments. BATS provides a structured approach to testing bash scripts similar to testing frameworks available for other programming languages like Python or Java. It uses a simple syntax that makes writing and maintaining tests straightforward for shell script developers. What is BATS? BATS stands for Bash Automated Testing System. It is a TAP-compliant testing framework that runs tests written in ...
Read MoreThe "Oldconfig" Target In The Linux Kernel Makefile
The Linux kernel provides various configuration targets through its Makefile system to help developers and system administrators build customized kernels. The oldconfig target is a crucial configuration option that allows you to update an existing kernel configuration while preserving your previous settings and only prompting for new options introduced in newer kernel versions. Note − Linux commands are case-sensitive. Understanding the Kernel Build System The Linux kernel build system uses a sophisticated Makefile structure to manage the compilation process. The configuration system determines which features, drivers, and subsystems get included in the final kernel image. There are ...
Read MoreHow to Call an External Program Using awk
Awk is a powerful text processing tool that can automate various tasks such as data manipulation, filtering, and reporting. One of its most interesting features is the ability to call external programs from within an awk script, extending its functionality beyond text processing. Understanding the system() Function The system() function is used to execute external commands from within awk. The syntax is straightforward: system(command) The command argument is the external command you want to execute. When system() is called, awk passes the command to the shell for execution. The shell executes the command and ...
Read MoreRead Random Line From a File in Linux
In Linux, reading a random line from a file can be a useful task in various scenarios. For example, when you want to select a random word from a dictionary or randomly select a line from a log file for analysis purposes. There are several ways to read a random line from a file in Linux. In this article, we will explore different methods to achieve this task along with their pros and cons. Method 1 − Using shuf Command The shuf command is a simple and efficient way to read a random line from a file in ...
Read More