Operating System Articles

Page 100 of 171

Get the Contents of a Web Page in a Shell Variable on Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 3K+ Views

One of the most useful and powerful features of the Linux command line is the ability to manipulate text. This can be especially useful when working with web pages, as web page content can often be saved as plain text and then manipulated with command-line tools. In this article, we will explore how to store the content of a web page into a shell variable in Linux. What is a Shell Variable? A Shell variable is a value stored in memory that can be used by the shell (command-line interface) and other programs. Shell variables are usually defined ...

Read More

fd An Alternative to the Linux find Command

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 3K+ Views

The fd command is a popular alternative to the find command in Linux. It is a faster and more user-friendly version of find, written in Rust for performance. Key features of fd include the ability to search using regular expressions, a more natural syntax for specifying search parameters, and the ability to search using specific file extensions or names. Installation The fd command can be installed on Linux and macOS using the package manager of your distribution. On Debian based distributions − sudo apt-get install fd-find On Fedora and CentOS − ...

Read More

Displaying Files Side by Side in Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 19K+ Views

Working with files on Linux often involves comparing or analyzing multiple files at once. A useful way to do this is to view the files side by side in the terminal, allowing for easy comparison and analysis. This article explores various methods to view files side-by-side on Linux, including the diff and sdiff commands, as well as text editors like vim and emacs. Using the diff Command The diff command is a standard Linux utility that compares two files and displays the differences between them. By default, it shows a unified diff format, but can display files side ...

Read More

Extracting a WAR File in Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 13K+ Views

WAR (Web ARchive) files are compressed archives used to package Java web applications for deployment. Since WAR files are essentially ZIP archives with a .war extension, they can be extracted using standard Linux command-line tools. This article demonstrates how to extract WAR files on Linux using two primary methods. A WAR file contains all components needed for a web application, including HTML pages, CSS stylesheets, JavaScript files, Java classes, configuration files, and libraries. Extracting these files allows developers to inspect, modify, or troubleshoot web applications. Prerequisites Before extracting WAR files, ensure you have the following tools installed ...

Read More

Remove the Last N Lines of a File in Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 12K+ Views

There may be times when you need to remove the last few lines of a file on Linux. For example, you may have a log file that is constantly being added and you want to keep only the most recent entries. In this tutorial, we'll explore different methods to remove the last N lines of a file on Linux. Use the head Command The head command can display the beginning of a file. By using the -n option with a negative number, we can exclude the last N lines from the output. To remove the last N ...

Read More

Find the Current Working Directory of a Running Process in Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 9K+ Views

One of the basic tasks when working with processes on a Linux system is determining the current working directory of a process. The current working directory, also known as the "current directory" or "current working folder, " is the directory in which a process runs and interacts with files. Knowing the current working directory of a process can be useful for debugging, understanding the environment in which a process is running, or monitoring process activity. In this article, we will discuss how to find the current working directory of a running process on Linux. We will cover several methods ...

Read More

Run Cron Job Only If It Isn't Already Running in Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 2K+ Views

Cron is a utility in Linux that allows users to schedule commands or scripts to run automatically at a specific date and time. However, sometimes it may be necessary to ensure that a cron job does not run more than once at a time, preventing resource conflicts or data corruption. In this article, we will discuss two effective methods to prevent overlapping cron tasks: using process tracking and using a .pid file. Method 1: Process Detection with pgrep One way to avoid overlapping cron task execution is to check for the presence of the task's process before running ...

Read More

Move All Files Including Hidden Files Into Parent Directory in Linux

Pradeep Jhuriya
Pradeep Jhuriya
Updated on 17-Mar-2026 10K+ Views

In Linux, hidden files (also called dotfiles) are files whose names begin with a dot (.) character. These files typically store configuration data or system settings that should be handled carefully. When you need to move all files from a subdirectory to its parent directory, including these hidden files, Linux provides several effective methods. Using the mv Command The mv command is the standard tool for moving files and directories from one location to another. It can also be used to rename files and directories. Moving Visible Files Only To move all visible files from a ...

Read More

Search Within Specific File Types Using grep on Linux

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 9K+ Views

The grep command in Linux is a powerful text search utility that allows you to search for specific patterns within files. When working with large directory structures containing various file types, you can combine grep with specific options to search only within files of particular types, making your searches more targeted and efficient. Basic File Type Search with grep To search for a specific pattern within a specific file type, use the --include option with the -r (recursive) flag. This combination allows you to search through directories while filtering by file extension. grep -r 'example' --include='*.txt' ...

Read More

Read the Source Code of Shell Commands on Linux

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 4K+ Views

Reading the source code of shell commands on Linux helps developers understand how commands work internally and learn system programming techniques. Most Linux commands are compiled binaries, so you cannot simply view their source code with text editors like you would with script files. Understanding Command Types Before searching for source code, it's important to identify the type of command using the type command − type ls type cd type echo This will show whether a command is a binary executable, shell builtin, alias, or function. Only binary executables and scripts have readable source ...

Read More
Showing 991–1000 of 1,707 articles
« Prev 1 98 99 100 101 102 171 Next »
Advertisements