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 50 of 134
Linux – How to find the files existing in one directory but not in the other directory?
Let's consider a case where we have two directories, say d1 and d2, and both these directories contain some files, which may be the same or different. Now we want to list out the names of those files that are present in one of these directories (say d1) and not present in the other directory (say d2). In order to do that we must be familiar with either the diff command or the comm command, as both these commands can be used to solve the above problem. Using the diff Command Let's first explore the diff command, ...
Read MoreHow to find the files in Linux that have been changed in the last 24 hours?
One thing that is constant about working with Linux is that we will make changes to one file or another with time. There are some files that stay unchanged, for example the files inside the /usr/local/ directory while there are some files that are just temporary and get deleted automatically, like the files or folders you insert in the /tmp directory. Since we know that change is imminent to files and folders, Linux also provides us with different ways to keep track of the files or folders that we change or have changed. The most common way to check ...
Read MoreGenerating a SHA-256 hash from the Linux command line
There are plenty of ways to generate a hash on any operating system, but when we talk about generating an almost-unique and fixed size bit hash, then nothing can replace the SHA algorithm. Before making use of the Linux command to generate a SHA-256 hash, we must know what SHA actually is and what it is good for. What is SHA-256? SHA-256 in very simple terms is a cryptographic hash function that has a digest length of 256 bits. It is an algorithm that generates an almost-unique and fixed size 256-bit (32-byte) hash. This algorithm was developed ...
Read MoreGetting root permissions on a file inside of vi on Linux
There are many scenarios where we think that we have opened a file to make changes using the root user, but when we actually try saving the changes, we realize that the file was opened with a normal user or with a user that doesn't have the specific permission to edit the file. In such cases, we usually have only one option and that is to close the file with the command shown below − :q! And then, open the file again with the command shown below − sudo su vi file.txt ...
Read MoreHow to find all the distinct file extensions in a folder hierarchy (Linux)?
Finding all distinct file extensions in a folder hierarchy is a common task in Linux system administration and file management. This operation requires combining several powerful Linux utilities to recursively traverse directories and extract unique file extensions. Required Linux Commands The two essential Linux utility commands for this task are − find − Locates files and directories recursively based on specified criteria sed − Stream editor used for text manipulation, searching, and pattern replacement Finding Extensions in a Single Directory For a single directory, you can iterate through files without using the find ...
Read MoreHow to increase the scrollback buffer in a running screen session on Linux?
Screen (also known as GNU Screen) is a terminal multiplexer that allows you to start a screen session and open multiple windows within that session. Processes running in Screen continue to execute even when their windows are not visible, making it ideal for long-running tasks and remote sessions. When working with Screen sessions, you may need to increase the scrollback buffer to view more historical output. The scrollback buffer stores previous terminal output that you can scroll back to review. Installing Linux Screen If Screen is not already installed on your Linux distribution, use one of the ...
Read MoreHow to list one filename per output line in Linux?
There are several Linux commands available to list files and directories. By default, the ls command displays output in multiple columns across the terminal width. However, there are various methods to format the output so that each filename appears on a separate line, which is useful for scripting and better readability. Default ls Command Behavior The standard ls command displays files and directories in a multi-column format: ls api cluster docs LICENSE Makefile.generated_files pkg staging vendor build cmd ...
Read MoreHow to send a file as an email attachment using the Linux command line?
In order to send a file as an attachment to an email using Linux, we can use command line email clients or the standard Linux mail command. This is particularly useful for automation, scripting, and server environments where GUI email clients are not available. There are multiple command line email clients available to achieve the attachment task, but the most common and widely used is mutt. Using Mutt Email Client Mutt is a command line based email client that allows us to send and read emails from command line in Linux based systems. It also supports important ...
Read MoreHow 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 More