1
vote
1answer
24 views

Unix/Linux - service unit file cannot recognize env variable set in /etc/environment

I have an environment variable setup correctly in /etc/environmentI have ensured that it loads correctly via /etc/profile modification. and I can echo it to confirm.but when I created the unit ...
0
votes
1answer
53 views

Extract tar.gz files into a directory with different basename based on their match in the text file

I have hundred of folders, some with with tar.gz files and some with bam files. I just wanted to extract tar.gz files into a different directory. Folders with tar.gz files looks like mentioned below:...
0
votes
1answer
81 views

Standard Unix/Linux utility for testing every input line

I am writing a Bash script which should test if every line in input meet certain condition.Is there a way to take the predicate and reduce all the line to either 0 or 1 so I don't have to code the ...
0
votes
1answer
128 views

Unix, copy file with other user permission

I have file /home/user1/file.txt which I want to copy to /home/user2/file.txt. Neither user has any permission to other users home directory, but both user2 has permission to su user1. I administrate ...
0
votes
1answer
213 views

how to tail into the last file on a remote server via ssh

backgroundI always tail logs (both error and info).. which requires the following manual steps1. ssh into a server2. cd into the logs directory3. identify the last file that is either error or ...
1
vote
1answer
61 views

`line` command on unix/linux bash prompt a permission denied infor

Recently, I am learning how to write script code. I wrote a script:#!/bin/sh# while3b.shwhile f=`line`do.. process f ..done < http://superuser.com/myfileand here is myfilehellohowdygdaybonjour...
2
votes
1answer
811 views

How can the bash shell on Window be completely reset?

I'm new to Unix but interested learn, so started trying to use bash/Ubuntu on Windows. Unfortunately, bash crashed and now bash/Ubuntu seems to be broken as most folders are now missing from the ...
0
votes
1answer
32 views

Backup command changing file types in Linux

Im going through a directory and copying the images with the file extensions shown to a new folder. However some of the images have the same name so i'm using the backup command.The trouble i'm ...
3
votes
3answers
158 views

How to pipe a single item from a command output into another command?

Basic example using grep (note that grep would not be my only use-case for this):$ grep -Irl "foo"path/to/directory/help.jspath/to/directory/config.jspath/to/directory/task.jsNow I want to open ...
21
votes
2answers
2k views

What is the function of the asterisk as a standalone command in Unix?

I was messing around in terminal on Red Hat Linux, and when I typed the asterisk (*) followed by return, and it executed one of the programs in my directory. Why?My best guess is that Unix treated ...
0
votes
1answer
83 views

simple way of describing / tagging files in bash

Is there a quick and simple way to tag files in bash so that a list like this one-rw------- 1 root 88039 Sep 29 16:31 7CCE2EC3-3191-4379-C036-1C48CCCE4C6C-rw------- 1 root 1985554 Sep 27 16:09 ...
0
votes
1answer
56 views

How to check size of a directory given by user as an argument?

I want to get the size of a directory given by user as an argument.Example:read -p "Enter the directory" targetdu -k $targetIf user gives path as ~/Documents/dir, I am getting error msg: du: ...
2
votes
3answers
160 views

What is the difference between cp -R foo/ and cp -R foo/*

I noticed that whenever I use a command cp -R foo/* I copy everything except files like .env or probably .gitignoreThe solution is to use cp -R foo/ as it copes the whole directory, but this does ...
1
vote
2answers
555 views

Variables are not passed from one script calling another with Bash heredoc

I have a shell script kept at my local user called (executeAdM.sh), and when I execute this script I am switching to a sudo user by taking commands from an instruction file. But when I execute this ...
0
votes
2answers
136 views

What is the difference between sed 's/day/night/' < old > new and sed 's/day/night/' old > new

Sed - An Introduction and Tutorial by Bruce Barnett has this in The essential command: s for substitution:A simple example is changing "day" in the "old" file to "night" in the "new" file:sed s/...

153050per page