Satish Kumar has Published 1040 Articles

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

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:48:17

5K+ Views

You can use the grep command in Linux to remove the lines from file A that appear in file B. The basic syntax is − grep -v -f fileB.txt fileA.txt > outputFile.txt This command uses the -v option to invert the match, so that it returns lines that do ... Read More

Running Multi-Line Shell Code at Once From Single Prompt

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:47:32

18K+ Views

You can run multi-line shell code at once by using a shell script or by using a command line tool such as the bash or sh command to execute the code in a single prompt. To create a shell script, you can use a text editor to write the code ... Read More

Running Script or Command as Another User in Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:46:40

21K+ Views

There are several ways to run a script or command as another user in Linux. One way is to use the "su" command, which stands for "switch user." For example, to run a command as the user "john, " you would use the following syntax: "su john -c 'command'" Another ... Read More

Storing a Command in a Variable in a Shell Script

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:36:54

554 Views

In a shell script, you can store a command in a variable by using the syntax − variable_name="command" For example − current_date="date" You can then execute the command stored in the variable by prefixing it with $ − $current_date This will execute the command date. Storing the ... Read More

Specify an Editor for Crontab on Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:35:31

2K+ 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; ... Read More

Monitoring Network Usage in Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:33:59

14K+ Views

Linux monitoring refers to the process of tracking and analyzing various aspects of a Linux system's performance, such as CPU usage, memory usage, disk usage, network traffic, and system uptime. The goal of Linux monitoring is to detect and diagnose any issues that may be impacting the performance or stability ... Read More

Delete the History of the Last n Commands on Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:32:40

9K+ Views

In Linux, the command history is a record of previously executed commands. The command history is stored in a file called . bash_history, which is located in the home directory of each user. The history command can be used to view the command history, and the history command can also ... Read More

Run a Java Application as a Service on Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:29:20

6K+ Views

A simple service in Linux is a program that runs in the background and performs a specific function or set of functions. These programs can be started automatically at boot time, and can be controlled using the command line or through a system service manager such as systemd or Upstart. ... Read More

Showing a GUI Notification From a Shell Script in Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:28:07

962 Views

There are several ways to display a GUI notification from a shell script in Linux, but one common method is to use the notify-send command. This command is part of the libnotify library and is typically pre-installed on most Linux distributions. An example of how to use notify-send to ... Read More

How to Calculate Optimal Blocksize to Use With dd in Linux

Satish Kumar

Satish Kumar

Updated on 24-Jan-2023 19:26:05

4K+ Views

The optimal block size to use with the dd command in Linux depends on the specific use case and the hardware that you are working with. However, as a general rule of thumb, it is best to use a block size that is a multiple of the disk's physical block ... Read More

Advertisements