Category "unix"

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

What do the identifiers PID, PPID, SID, PGID, UID, EUID mean?

I was assigned to Write a C program that prints the following identifiers PID, PPID, SID, PGID, UID, EUID. The assignment then went on to ask What rep

Test run cron entry

I added a cron job recently, but made a mistake in the path while giving the command and hence, the job never succeeded. Is there some way to test the cron chan

.bash_profile does not display echo information after update

I am setting up environment variables, and after saving in .bash_profile, I gave this command: echo "$SENDGRID_USERNAME" After doing this, bash returned a b

How do you compare the value of an array to a variable in bash script?

I'm practicing bash and honestly, it is pretty fun. However, I'm trying to write a program that compares an array's value to a variable and if they are the same

How do you compare the value of an array to a variable in bash script?

I'm practicing bash and honestly, it is pretty fun. However, I'm trying to write a program that compares an array's value to a variable and if they are the same

Difference between sh and Bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know what's the difference between them. What's main difference

Running shell script in parallel

I have a shell script which shuffles a large text file (6 million rows and 6 columns) sorts the file based the first column outputs 1000 files So the pseu