Category "unix"

Bash : Find and Remove duplicate files from different folders

I have two folders with some common files, I want to delete duplicate files from xyz folder. folder1: /abc/file1.csv /abc/file2.csv /abc/file3.csv /abc/fil

How to select two columns from awk and print if they do not match

I need to select two MSISDN values from OMO account Migration logs and print the ones that do not match. [2019-03-11 04:15:08 INFO-SUBAPP ESBRestClient:117] ##

How do I correct error in opening cron editor?

I am trying to open cron editor using command crontab -e but I am getting error fclose: There is not enough space in the file system. Any help would be apprecia

How to access Unix Domain Sockets from the command line?

Reading a Unix Domain Socket file using Python is similar to an ordinary TCP socket: >>> import socket >>> import sys >>> >>&g

How to detect and remove indentation of a piped text

I'm looking for a way to remove the indentation of a piped text. Below is a solution using cut -c 9- which assumes the indentation is 8 character wide. I'm loo

macOS Terminal: `ls` sorts results with capitalised names first

How can I fix this default sorting behaviour for ls in the macOS Terminal? I want the results to be case-insensitive and alphabetised. Here is an example to il

Copy file handle so that there are two independent handles to the same file

I have a Python program which does the following: It takes a list of files as input It iterates through the list several times, each time opening the files and

How to Skip 1st line of file - awk

I am beginner to awk. I have created one file which contains employee information. There are employees in different departments. And i wanna count that how many

Print the missing number in a unique sequential list with an arbitrary starting range or starting from 1

This question is similar to How can I find the missing integers in a unique and sequential list (one per line) in a unix terminal?. The difference being is that

replace special character [ and ] including . using sed

I would like to replace the [sample]. with space in all my document.Could someone let me know how can I do this.I tried the below command but it doesn't work.th

How can I set Bash aliases for docker containers in Dockerfile?

I am new to Docker. I found that we can set environment variables using the ENV instruction in the Dockerfile. But how does one set Bash aliases for long comman

How can I check the first character in a string in Bash or Unix shell?

I'm writing a script in Unix where I have to check whether the first character in a string is "/" and if it is, branch. For example, I have a string: /some/dire

How to capture output of df -h --total - Bash

I am writing a script which will be used to gather information on the available and used space on different partitions across servers. I need to be able to capt

password protect prometheus access [closed]

I am using prometheus to graph stats on my server. The problem is that that annybody can access the graphs from http://my.Ip.Adress:port/index

How to remove setgid (linux/unix)?

I just changed my file permissions using $ sudo chmod g+s filename and my file permissions turned from drwxr-xr-x to drwxr-sr-x. How do I remove it?

Commands to control the volume of a connected bluetooth device in Linux? [closed]

Let's say I have paired and connected a Bluetooth headset successfully to my Linux system. I know I can check my Bluetooth device MAC id from

How to change the starting directory of a tmux session?

The directory where you start a tmux session in will be the directory that all new windows will start at. My question is, how can you change this starting dir

How to check if a file is empty in Bash?

I have a file called diff.txt. I Want to check whether it is empty. I wrote a bash script something like below, but I couldn't get it work. if [ -s diff.txt ] t

Is it possible to use "/" in a filename?

I know that this is not something that should ever be done, but is there a way to use the slash character that normally separates directories within a filename

How to 'cut' on null?

Unix 'file' command has a -0 option to output a null character after a filename. This is supposedly good for using with 'cut'. From man file: -0, --print0