Linux Articles

Page 43 of 134

Delete the History of the Last n Commands on Linux

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

In Linux, the command history is a record of previously executed commands stored in a file called .bash_history, located in each user's home directory. The history command displays this history, and commands are assigned sequential numbers that can be executed using !number syntax. For example, typing !123 will execute the command numbered 123 in the history. There are several options to customize command history behavior: The history -c command clears the current session's command history. The HISTFILE environment variable specifies a different file to store command history. The HISTSIZE and HISTFILESIZE variables control the maximum number of ...

Read More

Monitoring Network Usage in Linux

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

Network monitoring in Linux involves tracking and analyzing network traffic, bandwidth usage, and connection statistics to ensure optimal system performance. Unlike general system monitoring that focuses on CPU and memory, network monitoring specifically targets data flow across network interfaces and helps identify bottlenecks, suspicious activity, and resource-hungry applications. Network Monitoring Tools Linux provides several powerful command-line tools for network monitoring, each serving different purposes − nload − Displays real-time network traffic statistics with visual graphs for interface monitoring. Speedometer − Shows network usage with customizable display formats and measurement units. iftop − Lists active network connections ...

Read More

Specify an Editor for Crontab on Linux

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

The default editor for crontab on Linux is the vi editor. However, this can be changed by setting the VISUAL or EDITOR environment variable to the desired editor before running the crontab command. For example, to use nano as the editor for crontab, the command would be − export VISUAL=nano; crontab -e or export EDITOR=nano; crontab -e This will open the crontab file in nano for editing. Methods to Change Crontab Editor Temporary Change To temporarily change the editor for a single crontab session, set the environment variable inline ...

Read More

Storing a Command in a Variable in a Shell Script

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 771 Views

In shell scripting, you can store a command in a variable to improve code organization and reusability. This technique allows you to define commands once and execute them multiple times throughout your script. Basic Command Storage The basic syntax for storing a command in a variable is − variable_name="command" For example − current_date="date" list_files="ls -la" To execute the stored command, you need to use command substitution or eval − # Using eval (less secure) eval $current_date # Using command substitution (preferred) $($current_date) Storing Commands in ...

Read More

Running Script or Command as Another User in Linux

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

There are several ways to run a script or command as another user in Linux. The most common methods are using the su command (switch user), the sudo command (superuser do), and the runuser command. Each approach has different use cases, security implications, and requirements. These commands are essential for system administration tasks where you need to execute operations with different user privileges without logging out and back in as another user. Using su Command The su command allows you to switch to another user's account. The basic syntax is: su [options] [username] ...

Read More

Running Multi-Line Shell Code at Once From Single Prompt

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

Running multi-line shell code at once allows you to execute complex commands and scripts efficiently without typing each line individually. There are several techniques to accomplish this, from creating shell scripts to using command-line operators and here-documents. Shell Script Method The most common approach is creating a shell script file. Use any text editor to write your code and save it with a .sh extension: #!/bin/bash echo "Hello, World!" echo "This is a shell script." Execute the script using: bash script.sh Here-Document (EOF) Method The here-document technique uses the

Read More

Remove Lines Which Appear in File B From Another File A in Linux

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

Removing lines from one file that appear in another file is a common task in Linux system administration and data processing. This operation, also known as set difference, can be accomplished using several command-line utilities, each with its own advantages and use cases. Using the grep Command The grep command is the most straightforward approach for this task. It uses pattern matching to filter lines. grep -v -f fileB.txt fileA.txt > outputFile.txt This command uses the -v option to invert the match (show non-matching lines) and -f to specify the file containing patterns to ...

Read More

What are the fundamental differences between Windows and Linux?

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Mar-2026 679 Views

Windows and Linux are two of the most widely used operating systems, each with distinct philosophies, architectures, and target audiences. Understanding their fundamental differences helps users choose the right platform for their needs. Windows Windows is a proprietary operating system developed by Microsoft. It evolved from the Disk Operating System (DOS) and has become the most popular desktop operating system worldwide. Windows is designed with user-friendliness in mind, featuring a graphical user interface that requires minimal technical knowledge to operate effectively. Modern Windows versions are standalone operating systems that no longer require DOS as a foundation, though ...

Read More

How to create a process in Linux?

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Mar-2026 14K+ Views

A process is a program loaded into memory and currently executing. In simple terms, a process is a program in execution state that the operating system manages and schedules for CPU time. Creating Processes with fork() System Call In Linux, a new process is created using the fork() system call. This system call creates a new process by making an exact copy of the calling process's address space. The original process becomes the parent process, while the newly created process becomes the child process. When fork() is called, both parent and child processes continue execution from the ...

Read More

Init process on UNIX and Linux systems

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Mar-2026 8K+ Views

The Init process is the parent of all processes in UNIX and Linux systems, executed by the kernel during system boot. Its primary role is to create processes from configuration stored in /etc/inittab. Init spawns getty processes on terminal lines for user logins and controls all autonomous system processes required for proper operation. After reading /etc/inittab, init determines how the system should be configured for each runlevel and sets the default runlevel. Init then starts all background processes after establishing the system's operational state. Process Hierarchy Process Tree Structure ...

Read More
Showing 421–430 of 1,337 articles
« Prev 1 41 42 43 44 45 134 Next »
Advertisements