Bash is a free shell for Unix-like operating systems from the GNU Project.

learn more… | top users | synonyms

-2
votes
1answer
15 views

Removing a substring between track number and title

I need help with a little bit of bash trickery. In organizing my music collection I've come across a set of tracks which are named in the format %track%. %artist% - %title%.%extension% How can I ...
1
vote
1answer
55 views

How to kill all child processes of a terminal, not a tty session?

At my workplace, we have a high-performance computing-cluster managed by SLURM. Some people's jobs spawn lots of processes with, as a federation, are one job. They also write the top-level controller ...
-1
votes
2answers
83 views

How to batch rename files by removing special character without using rename in linux shell

For example, I have 100 files and their names all have blank space. One of them is "The Monkey King Return (2015).mkv". How to remove all blank in name and replace with dot character, also remove "("...
0
votes
2answers
14 views

Find highest numbered files in directory

Scenario: A backup system creates rar archives and splits them in 100 MB parts. I would like to find the highest numbered files within this directory. For example in- and output: Input: ...
0
votes
0answers
15 views

Git installs to a network drive

I'm using Git at work (on Windows 8), but we have a variable in AD called 'HomeDrive', which is annoyingly set to a network drive. Git has decided to install the git bash and other utilities here, ...
1
vote
3answers
37 views

Display file contents if it has corresponding line number

I have two files in the following format: File A 4 5 8 9 File B 1 text 2 text1 3 text2 4 text3 5 text4 6 text5 7 text6 8 text7 9 text8 What I want to have for my output is just the following (the ...
3
votes
1answer
31 views

Gateway / Router Detection with Bash: Functions and Variables

I'm drafting / still brainstorming / a bash shell script. The aim of which, is to; help the user to: Interface with various CLI tools. Perform various administrative tasks. It might, ...
0
votes
2answers
37 views

bash regex for a file name

I'm really not that good with regex but I thought I'd be able to pull this off since it's not that difficult. I'm using find to see if any file that matches the regex exists in that dir. The string ...
0
votes
1answer
68 views

SSH executes the command differently

After several experiments I got to a surprising behavior by SSH. I usually access to a specific application through an SSH connection. In fact, that app is on a virtual-box on a workstation in a LAB. ...
3
votes
1answer
70 views

chained pipes in bash throws `Operation not permitted`

The symptom is very simple. For instance: ls | grep a | grep b | grep c | grep d throws -bash: child setpgid (8948 to 8943): Operation not permitted -bash: child setpgid (8950 to 8943): Operation ...
0
votes
1answer
45 views

cd won't work when beginning by a “/”

I've got this problem for a long time and it's becoming a hard one. On Mac os x, when i type a directory such as cd /adirectory/another/andelse, I don't find it. I only can type a direct one such as ...
1
vote
1answer
23 views

Working with different implementations of cp across different environments

So I figured GNU's cp is different than OSX's (BSD). While OSX copies the contents of a directory that ends with a slash, or the directory itself without the slash, GNU/Linux just treats somedir and ...
-1
votes
1answer
21 views

Bash: I want to count letters and substitute text

OK so I'm extremely new to bash shell scripting and I've been pretty successful up until this point. I'm using BASH to fix a problem... I want to turn a basic domain name: Buddies.forlife.com into |...
3
votes
1answer
171 views

Windows Linux Subsystem - Accessing Files outside of Ubuntu

Why when i create a file from Within Windows for example, Can i not see it Under the Linux Sub System in Windows 10 (Bash.exe) Screenshot should explain. Folder: OMG was created from within Windows ...
0
votes
0answers
20 views

Change directory for use with CMD

I have the SSH command line utility installed via chocolatey on Windows 8. The only problem is, it has an ssh key path with Linux OS' in mind, this means that the path is /home/roconnor/.ssh. This is ...
1
vote
1answer
24 views

conditional pipe in bash

Is there any built-in way in bash to pipe output further if certain test condition is met? Essentially I want to know if I have to write following function myself or is there some good-practice-...
0
votes
1answer
28 views

How to pass a windows path with spaces to cygwin bash

I am connecting to a windows server (2012R2 64 bit) running cygwin (latest version that i downloaded from cygwin.com yesterday) using putty. I am trying to run cmd.exe and pass the cmd.exe a command ...
0
votes
1answer
10 views

Tidy up output of bash script that sends a series of commands to fdisk

I've got a bash script that sends a series of commands to fdisk: printf 'n\np\n3\n\n\n\n\nt\n3\n8e\nw' | fdisk /dev/sda So, commands sent in order are: n, n, 3, [default], [default], t, 8e, w. This ...
0
votes
1answer
31 views

bash sort from the end of string

I want to sort file by first file, but the last character is the most important. For example form file: "AAAACTTTTT" 1 2 "AAAACAAAAA" 1 2 6 4 To: "...
0
votes
0answers
15 views

Using BASH to create new elements in XML file

So far I have done simple things in bash with sed, awk, while loops, etc. What I need to do next is far more complicated and I'm not sure how to get started. I have an XML file and I need to add ...
1
vote
0answers
15 views

OS X: Trying to run an application in terminal and create an image of it

I am trying to run a program such as tload or slurm which graphs a system metric over time, and make its input into an image that has ANSI color support. The best I can think of is using ...
1
vote
1answer
35 views

xargs with two command - mkdir and sed

I want to create catalogs and in the same line I want to change path and save it in the output file I don't want to repeat code, so I tried: cut -d ';' -f 1 tmp1 | tr '.' '/' | xargs -I % bash -c '...
1
vote
1answer
26 views

Line is not Wrapping in Terminal

I am using Ubuntu G-NOME 16.04. Line wrapping not functioning properly in my terminal. It starts rewrite at the beginning of the same line. eg. If I try to type follwining command user@MY-PC: ~$/home/...
0
votes
0answers
10 views

SLURM: how to run a large job that takes longer than the fair usage policy

I'm not sure if this is the correct stackexchange, so please feel free to point me elsewhere. I am looking for some advice on SLURM. The HPC cluster I use has a fair usage policy of 48 hours per job, ...
4
votes
3answers
56 views

How to create linux user with only and only READ permission not EXECUTE and WRITE permission?

I have created user, e.g. ronly, now I want to give them read only access to few directories on other user home like abc/,xyz/,pqr/ so I put this ronly user in others means not created any group for ...
0
votes
0answers
18 views

How do I center text generated by Toilet?

To center text in general, you can use this #!/bin/bash center(){ tc=$(tput cols) while IFS= read -r line; do sp=$((($tc-${#line})/2+${#line})/2+${#line})) printf "%${sp}s\n" ...
-1
votes
1answer
36 views

Create file - pipe to output

At first I must say that my English is not very well. I have to do my task from studies and I have a problem. I have to make file with version in the proper catalog. Information are in text file for ...
0
votes
0answers
37 views

Can't stop ffmpeg from outputting stats

I am writing a bash script to speed up podcasts. In it, I have: ffmpeg -nostats -hide_banner -loglevel panic -y -i normal/$channel/$filename -filter:a "atempo=1.3" fast/$channel/$filename However, ...
2
votes
2answers
26 views

How can I assign (x,y) coordenates to some values?

So I basically have to assign (x,y) coordenates to some ids that will be coming from a file. Let's say the file items.txt have the following content: if-eth0-in if-eth0-out ping-status cpu-load ...
1
vote
0answers
26 views

rsync error - Unexpected remote arg: root@1.2.3.4:/*

I'm trying to migrate centos server to a new box with rsync and I run this command in the destination server: rsync -auHxv –numeric-ids –exclude=/etc/fstab –exclude=/etc/sysconfig/network-scripts/* ...
1
vote
1answer
25 views

How Does Homebrew Add Things to My Environment?

OS X 10.11.5. I'm new to OS X and Ruby. I used homebrew to install chruby and ruby-install, then used these to install Ruby and Rails. Later I installed RubyMine. I like it, but it does not support ...
0
votes
1answer
32 views

How to use the lastb command from Mac terminal?

In bash on mac, when trying to list recent bad logins, the lastb command is unrecognized, while it works fine on my Linux machine. Does it need to be installed or is it a different command for macs?
1
vote
1answer
21 views

cat files from pipe

I have to join files to one original file, which was split. There is a catalog, in which there are a lot of files,but no every is necessary. I have file with md5sum, which contain md5sum files I have ...
0
votes
1answer
43 views

Limit CPU frequency on Ubuntu Linux

I'm looking for a way to limit CPU frequency when system is running on battery. Solution doesn't have to work exclusively when using battery, it may be in form of bash commands from which I could make ...
1
vote
1answer
25 views

su user executes command as root

Short Background: when running a script that uses notify-send "title" "message", it is expected to show a notification, but sudo ./script does not show notification After reading up and visiting ...
0
votes
1answer
39 views

How to move the commandline cursor on bash using the mouse

When using bash (in Terminal) with very long commands, it is often useful to be able to set the cursor to an arbitrary location using the mouse. In Mac-Os, the alt (Option) key is having this effect (...
1
vote
1answer
26 views

Bash completion: filter out backup (~) files

I would like bash to filter out backup files, with a name ending in ~ (tilde), when auto-completing filenames. I have written a script to set this when using vim (I have very little experience with ...
0
votes
0answers
10 views

copy a pc file to VM env/linux

I have a file on Desktop 'Test1.py'. I want that file to run on saltmaster VM and am trying to copy that file through scp commands. I hit this command scp Test1.py ubuntu@ipaddress:/Users/username/...
-1
votes
1answer
17 views

How to write a script to write root shell in file.log?

I use loger to write in file.log,but I can't execute the script.sh.I do it with bash script.sh and ./script.sh but I receive message bash: ./script.sh: Permission denied
0
votes
1answer
43 views

wget script exit abnormally with error 126

Can't seem to get this script to run, I have user access to the data I'm trying to download but it just won't run. If anyone can help with wget scripts it would be appreciated. for i in $(seq 1 9); ...
0
votes
2answers
14 views

Monitor log live for error. If error = rerun command and restart log monitoring, if not found = keep monitoring forever

A process in a bash script I'm developing often fails quietly (it keeps running with no error code, but it writes the error in its log file). As soon as the error appears in the log file I want the ...
0
votes
0answers
17 views

Not getting any values passed through to RRD graphs

I'm getting a lot of NaN values being drawn on my RRDTool graphs and I can't understand why. My script to populate the RRAs in the RRD: #! /bin/bash LOAD=`cat /proc/loadavg | awk '{print $1}'` ...
0
votes
4answers
49 views

Bash background process still blocking script flow in subshell

I am trying to do something that involves scripts calling other scripts in subshells to capture their output. One of the scripts needs to have a side effect of starting a background process. This all ...
0
votes
1answer
24 views

executing history command as another user

I am confused as to why I'm having problems executing a history command as another user to return all that user's history - I need to loop though all users and get their history cat /etc/passwd | awk ...
0
votes
0answers
29 views

How to use scroll wheel for command output history in a minimal install?

If someone ever booted up a GNOME desktop and accessed the terminal you would be quick to realize that the scroll wheel is able to move back and forth through command history. To me this is an ideal ...
1
vote
1answer
26 views

Launch consecutive commands in screen

I would like to launch cmd1 and cmd2 in the same screen instance. I want cmd2 to be launched only when cmd1 has completed. I have tried this: screen -d -m ./cmd1.bash "$File" && ./cmd2....
1
vote
0answers
19 views

How correct this local mail-sender script?

I have a task, write a shell-script, that: - All e-mails, that received by the user specified by the first parameter, sends to the currently running system users; - If sender is online, ...
1
vote
1answer
31 views

Bash Script, Striping out newline characters in variable

Still getting the hang of bash scripting... I have a function that resizes images and calculates how much to scale it based on the file size. I need to pass this percentage as an argument to the ...
0
votes
0answers
14 views

notify-send not showing popup message

I have a script which executes on certain conditions, whenever I manually execute the script, the popup appears, however if i try to aumotate the script(i.e. run the script right after system is ...
0
votes
2answers
39 views

How to use crontab to launch scripts

I have created a script (which I already tested if it works) and I want to use crontab to launch it everytime my pc reboots. I created these script called test.sh just for fun and it's pretty easy: ...