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
Linux Articles
Page 51 of 134
How should strace be used on Linux?
strace is a powerful Linux utility that traces system calls and signals made by a process. It provides detailed insights into how programs interact with the kernel, making it essential for debugging, performance analysis, and understanding program behavior. The strace command intercepts and records all system calls made by a process, including file operations, memory allocation, network communication, and signal handling. This makes it invaluable for diagnosing issues, monitoring system activity, and learning how programs work internally. Installation Before using strace, install it on your system using the appropriate package manager − Ubuntu/Debian − ...
Read MoreHow to activate virtualenv on Linux?
A virtual environment is a tool that helps keep dependencies required by different projects in separate places. In Python, we commonly use the term venv to refer to virtual environments. This isolation prevents conflicts between different project dependencies and keeps your system Python installation clean. Python's venv module creates lightweight virtual environments with their own site directories, isolated from the system's site directories. Each virtual environment has its own Python binaries and can maintain its own set of installed packages independently. Creating a Virtual Environment To create a virtual environment, use the following command structure − ...
Read MoreHow to change the root directory of an Apache server on Linux?
Apache web server is one of the most widely used HTTP servers across all platforms, including Linux distributions and Windows. As an open-source server, Apache efficiently delivers web content and handles multiple concurrent requests. In this article, we'll explain how to change the DocumentRoot directory for your Apache web server on Linux systems. Understanding DocumentRoot The DocumentRoot is the directory from which Apache serves files to visitors accessing your website. By default, Apache typically uses one of these locations: /var/www/html Or alternatively: /var/www The exact default location depends on ...
Read MoreHow to check if a particular service is running on Ubuntu?
We know that we can make use of the top command to print all the processes that are running in the background. Though the top command is used to print the list of processes or threads that are currently managed by the Linux kernel, it is still not a convenient way to check if a particular service is running in the background or not. In order to understand how to check whether a particular service is running or not, we first must understand what a service actually means in Linux. A service is basically a process or group of ...
Read MoreHow to check the syntax of a Bash script without running it in Linux?
There are always chances that we will make some type of error whenever we are programming. Compilers and interpreters are always there to help us in these cases, but in order to use them we must run the program or some sort of an IDE that constantly checks for these errors and reminds us every time, so that we can correct them. What if we don't want to write our code in a fancy IDE and also don't want to run the program either, in that case we are left with very few options if any. In case you ...
Read MoreHow to compare the files available in two directories using diff command in Linux?
The diff command in Linux is a powerful tool for comparing files and directories. When working with two directories containing multiple files, diff helps identify which files are unique to each directory, which files are common, and what differences exist between files with the same name. Understanding the diff Command The diff command (short for difference) compares files line by line and can also compare entire directories. When comparing directories, it identifies files that exist in one directory but not the other, as well as files that differ in content. Example Setup Let's work with two ...
Read MoreHow to create a CPU spike with bash command on Linux?
If you have been programming, then you might have observed certain cases and scenarios where the program gets stuck or the process is running in an infinite loop which in turn puts pressure on the core of that thread which is handling that process. There are many such cases where this is quite a possibility. We usually make use of different techniques to avoid such cases, like handling them in code logic itself or using third party tools to deal with them. Linux also provides us with a command that we can use to keep track of the different ...
Read MoreHow to create a zip file and ignore directory structure in Linux?
In order to be able to zip files and ignore directory structure that gets created with them, we first must understand what the zip command on Linux actually means and how we can make use of it. The zip command that Linux provides allows us to specify a compression level with a number prefixed with dash, typically between 0 and 9. It is used to reduce file size through compression and serves as a file packaging facility. The compression process involves taking one or more files and compressing them into a single zip archive, along with metadata about those ...
Read MoreHow to exit from a Linux terminal if a command failed?
It is a common scenario that certain commands might fail for various reasons − differences between GNU and BSD versions of core utilities, logical errors, or missing dependencies. When commands fail, you may want to terminate the process or exit the terminal without manually pressing CTRL + C. Here are several methods to handle command failures gracefully. Using bash exit command with || The logical OR operator (||) allows you to execute a command only if the previous command fails. This is useful when you want to exit the terminal immediately upon command failure. my_command || ...
Read MoreHow to find all files with names containing a string on Linux?
In Linux command line, finding all files with names containing a specific string is accomplished using the grep command. The grep command is a powerful text processing utility that searches for patterns within files and displays matching lines. The grep command filters searches in files for particular patterns of characters. It is one of the most frequently used Linux utilities for displaying lines that contain the pattern you are searching for. The pattern being searched is typically referred to as a regular expression. Syntax grep [options] pattern [files] Common grep Options -c ...
Read More