Skip to main content
almarefa.net

Posts (page 61)

  • How to Get Disk Information on Linux? preview
    6 min read
    To get disk information on Linux, you can use various commands and tools available in the terminal. Here are a few ways to obtain disk information:df: The "df" command displays the amount of disk space used and available on the file system. Running "df -h" provides the output in a more readable format, with sizes displayed in human-readable units (e.g., GB, MB). du: The "du" command estimates the file and directory sizes by recursively traversing through the file system.

  • How to Write the End Of A File With A New Line In Linux? preview
    5 min read
    To write the end of a file with a new line in Linux, you can use various methods or commands based on your preference. Here are a few commonly used approaches:echo Command: You can use the echo command to append a new line to the end of a file. The syntax is: echo >> filename This will create a new line at the end of the file specified by filename. Append Command: The >> redirection operator can also be used to append a new line to a file.

  • How to Execute SQL Commands Through A Linux Shell Script? preview
    7 min read
    To execute SQL commands through a Linux shell script, you can use the following steps:Install a terminal-based database client: First, ensure that you have a database client installed on your Linux system. Some popular options include PostgreSQL's psql client, MySQL's mysql client, or SQLite's sqlite3 client. Choose the appropriate database client based on your database system.

  • How to Send an Email Using the Sendmail Command In Linux? preview
    3 min read
    To send an email using the sendmail command in Linux, follow these steps:Open the terminal or command line on your Linux system. Enter the following command to start composing the email: echo -e "Subject: Your email subject\n\nYour email content" | sendmail recipient@example.com Replace "Your email subject" with the desired subject for your email and "Your email content" with the actual content you want to send. Replace "recipient@example.

  • How to Avoid Creating Tmp Files on Linux? preview
    6 min read
    There are a few ways to avoid creating temporary (tmp) files on Linux. Here are some suggestions:Use RAM disks: Instead of writing temporary data to the file system, you can create a RAM disk or tmpfs mount. RAM disks are stored in the computer's memory, allowing for faster read and write operations. Any data written to a RAM disk is temporary and will be lost upon system restart. Use /dev/shm: The /dev/shm directory is a shared memory filesystem available in most Linux distributions.

  • How to Remove Duplicate Files In Linux? preview
    6 min read
    To remove duplicate files in Linux, you can use various methods and commands. Here are some common approaches:Using fdupes: The fdupes command-line tool is commonly used to find and remove duplicate files. It can be installed using package managers like apt or yum. Once installed, you can run the command followed by the desired directory path. Fdupes will locate duplicate files and prompt you to either delete or preserve them.

  • How to Get System Uptime on Linux Using C++? preview
    5 min read
    To get the system uptime on Linux using C++, you can use the sysinfo() function. Here is an explanation of the steps involved:Include the necessary header file: Begin by including the header file in your C++ program. This file contains the definition of the sysinfo() function. Declare a struct sysinfo variable: Create a variable of type struct sysinfo. This struct holds various system-related information, including uptime.

  • How to Change the Permission Mode In Linux? preview
    6 min read
    To change the permission mode in Linux, you can use the "chmod" command. The chmod command allows you to modify the permissions for files and directories.The basic syntax of the chmod command is: chmod options permissions filename The "options" parameter is optional and is used to specify any additional options for the command. Permissions define the level of access given to the owner, group, and others.

  • How to Execute A MongoDB Query In A Linux Script? preview
    5 min read
    To execute a MongoDB query in a Linux script, you can make use of the MongoDB command-line tool called mongo. Here's how you can achieve it:Start by installing the MongoDB client tool, mongo, on your Linux machine if it is not already installed. Open a terminal window and navigate to the directory where your script is located. Create a new shell script file using a text editor of your choice (e.g. vi, nano, or gedit). In the script file, begin by specifying the shebang (#.

  • How to Read And Change Values From Memory In Linux? preview
    7 min read
    In Linux, reading and changing values from memory involves accessing and modifying memory locations using low-level programming methods. Here are the general steps to perform this:Obtain the memory address: Identify the memory address you wish to read or change. This can be a specific variable or structure in a program, or even system-level memory regions. Mapping memory: In Linux, process memory is divided into segments like code, data, heap, and stack.

  • How to Install OpenXLSX on Linux? preview
    2 min read
    To install OpenXLSX on Linux, follow these steps:Open a terminal.Ensure that you have the necessary prerequisites to build and install OpenXLSX. These prerequisites typically include the CMake build system, a C++ compiler, and the zlib compression library. Install them if they are not already present on your system.Download the OpenXLSX source code from the official repository. You can either download a zip archive or clone the Git repository using the git command.

  • How to Find Recent Modified Files In Linux? preview
    4 min read
    To find recently modified files in Linux, you can use the find command combined with the -mtime option.The general syntax for this command is:find <directory> -mtime <n>Here, <directory> represents the directory in which you want to search for modified files, and <n> indicates the number of 24-hour periods ago since the files were modified.For example, if you want to find files modified within the last 24 hours in the current directory, you can use:find .