Found 1436 Articles for Linux

Change the Install directory with make install

Satish Kumar
Updated on 03-Jan-2023 10:55:46

3K+ Views

Overview Generally, packages are installed in the default directory. Depending on the system's Linux version, it might be necessary to use a different directory such as /usr or /user/local. We might also want to install a particular software application for a single user rather than for the entire system. We'll take a look at how to change where packages get installed by running make uninstall. Using ./configure Parameters When using autoconf/automake to build software packages, a configure script with several standard parameters and (sometimes) additional custom parameters is provided. Some packages don't use autoconf but they usually offer a compatible ... Read More

Move all files except one on Linux

Satish Kumar
Updated on 03-Jan-2023 10:52:58

3K+ Views

Introduction If you're working with Linux, there might be times when you'll want to copy several files at once and then remove some of them later. We're going to take a closer at several different methods for achieving such results. Renaming The Unwanted File You can rename the unwanted file so that it becomes a “.” (dot) file means hidden files, which means that mv won't be able to see it. After renaming the unwanted file using the asterisks, we’ll then use the regular expression to remove the rest of the files. /source_dir$ mv file5 .file5 /source_dir$ mv * ~/target_dir/ ... Read More

Load Environment Variables in a Cron Job

Satish Kumar
Updated on 03-Jan-2023 10:51:02

5K+ Views

Overview When crontab runs a command, it doesn't read any environment variables from files like ~/.bashrc, ~/.bash_profile, etc. Because cron runs tasks from a non-interactive, non-login shell, it doesn't need an interactive user Some applications require environmental variables to function correctly. We’ll discuss different methods for loading environmental variables from a crontab. Setting the BASH_ENV Variable We can set environment variables for our shell scripts by using the BASH_ENV variable. We set it up so that when we run our jobs, they're executed by a shell script. We can set up our shell so that when we open a new ... Read More

How to use tmux on Linux?

Satish Kumar
Updated on 03-Jan-2023 10:48:43

338 Views

Overview Tmux is a terminal multiplexing utility for Unix systems. It provides an interface between several programs running simultaneously on one computer. Tmux allows us to detach from any terminal sessions without killing them. We can then reattached to any of the terminal sessions later on. We’ll learn the tmux terminal emulator in Linux. Specifically, we’ll examine some of its features and commands. Installation You can install tmui on Debian-based Linux systems using the apt-get package manager. $ sudo apt-get update -qq $ sudo apt-get install -y tmux We can also use the yum command line tool to download ... Read More

Exclude directories while using grep command?

Satish Kumar
Updated on 26-Dec-2022 12:07:25

3K+ Views

Overview We often run a grep command to look for specific strings of text within files. The grep command provides some additional functionality that makes the search even better. A feature that allows you to exclude certain directories from recurrence. This is useful when searching through large amounts of data. Grep can be used with the −r option which will allow you to specify multiple patterns and then use the −v option to show only those files that match your pattern. We’ll discuss the different ways to achieve this. Exclude Single Directory The simplest way to do this would be ... Read More

Redirect output of process to a file and streams?

Satish Kumar
Updated on 26-Dec-2022 12:05:35

824 Views

Overview We'll look at some ways to redirect the output of processes to files and standard streams such as STDOut and STDERR simultaneously. The tee Command Tee is one of the most common Linux command line tools that we can use to redirect a process' output. It's also known as "teeing" or "piping". The tee command takes two arguments− the file name where you want the redirected output saved, and another file name which will be used for writing the original input. Redirect stdout Here we go! We're going to look at a simple example of redirect the output of ... Read More

Remove symbolic links file in Linux?

Satish Kumar
Updated on 26-Dec-2022 12:00:46

14K+ Views

Overview Symbolic links allow us to access files more easily, even if they're located in a different location. In this tutorial we'll learn how to remove symbolic links from our system and replace them with the original file. The Problem If we have an aDir folder and an aFile.text file under our current working dir, let's say. We've also created two symbolic link files pointing to the folder and the subfolder − $ ls -l total 0 drwxr-xr-x 2 kent kent 40 Apr 26 23:48 aDir/ -rw-r--r-- 1 kent kent 0 Apr 26 23:46 aFile.txt lrwxrwxrwx 1 kent kent 4 ... Read More

The “Argument list too long” Error in Linux Commands

Satish Kumar
Updated on 26-Dec-2022 11:51:19

2K+ Views

Overview In this article, we will discuss the error message that is displayed when you try to execute a command on your Linux system and it says “argument list too long”. This error can be caused by many reasons. In this post, I am going to explain what causes this error and how to resolve it. What Is The Argument List Too Long Error? This error occurs because of an invalid argument passed to a program or shell script. It means that there are more arguments than allowed by the program. For example, if you run the following command − ... Read More

Compare two directories in Linux?

Satish Kumar
Updated on 26-Dec-2022 11:48:09

2K+ Views

Introduction It's quite common for people to compare two directories. Many different factors make us want to find out whether there really is a difference between two things. For example, we normally want to figure out what's different from a previous situation when something goes wrong. We’ll learn how we can use the command line to perform directory comparisons. There are different methods we can use to compare directory listings. We'll also see some of the most commonly used commands and their options. Setup We'll create some sample directories inside the /temp directory for this tutorial. Dir1       ... Read More

Display specific columns of a file in Linux?

Satish Kumar
Updated on 26-Dec-2022 11:42:26

5K+ Views

Overview We often perform various file operations on our Linux systems. One of the most common operations is to display certain columns from a text document. Here, we’ll cover the different methods for achieving this. Display Single Column Let's create a new folder for our example. The input.txt files contain the output of the ls -l command in the long listing (long) format. $ cat input.txt -rw-r--r-- 1 jarvis jarvis 200M Nov 27 22:04 file1.dat -rw-r--r-- 1 jarvis jarvis 400M Nov 27 22:04 file2.dat -rw-r--r-- 1 jarvis jarvis 500M Nov 27 22:04 file3.dat -rw-r--r-- 1 jarvis jarvis 600M Nov 27 ... Read More

Advertisements