Found 1383 Articles for Open Source

How to Copy File Permissions and Ownership to Another File in Linux?

Pradeep Elance
Updated on 27-Jul-2023 13:29:22

786 Views

Many times while taking back up of data from one location to another or configuring software, we need to maintain the same level of ownership and permission of the files. Creating those permissions and granting ownership to individual files can be error prone of done by typing commands for each of the files. So we use some arguments with the chown and chmod commands.OwnershipWe use the –-reference swiych in the chown function to specify the ownership cloning from the source file to the target file.Syntaxchown --reference=source_reference_file target_fileIn the below example we have a source file whose ownership gets cloned to ... Read More

How to Clear BASH Command Line History in Linux?

Pradeep Elance
Updated on 26-Jul-2023 15:55:07

475 Views

As we execute various commands they get stored in a file called .bash_history. We can refer to this file later to find all the commands. Sometimes there may be sensitive information in bash commands. To remove the sensitive information, we may remove specific lines from the bass history file or we may remove the entire file itself. In this article we will see both the approaches.Here we see the .bash_history file.$ ls -l .bash_history $ cat .bash_Running the above code gives us the following result −-rw------- 1 ubuntu ubuntu 6495 Dec 31 19:30 .bash_history Clearing Individual commandsTo clear a specific ... Read More

How to use diff Command in Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 15:27:00

6K+ Views

Introduction The Linux operating system is based on a robust set of command line tools that allow users to easily manage and control the system. One of the most powerful and widely used command line utilities is the "diff" command. The "diff" command in Linux is used to compare the contents of two files line by line and show the difference between them. This command-line utility is essential for developers and system administrators to identify changes to code or configuration files. In this article, we'll take a closer look at the diff command and its various options and usage scenarios. ... Read More

Advertisements