Tagged Questions

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

learn more… | top users | synonyms

0
votes
0answers
7 views

Monitoring a log file and send a notification (mail) when string is triggered

I want a nofitication (email) when the user-foobar is triggerd in the apache log like this 10.10.55.171 - userfoobar [21/Nov/2014:12:06:01 +0100] "GET /download/2719/test.jpg HTTP/1.1" 200 ...
1
vote
1answer
15 views

Linux/Bash: Create relative soft links to files in directory tree?

I'd like to make links to all files in a directory tree. Which means, create the same directory structure and make the links in them to the respective subdirectory in the original dir. That could be ...
0
votes
1answer
18 views

Cron won't run my root script

I am on Ubuntu 14.04 (using Digital Ocean) trying run a script as root. It's a script to check if a server is running and restart if it has crashed. The issue isn't the script, but crontab won't run ...
1
vote
1answer
19 views

cpio VS tar - what the best archive solution in order to compress hundred of directories to one file

in my Linux machine under /var/Recording directory. I have hundreds directories and each directory there are also directories and files include hard links and soft link . I want to compress all ...
0
votes
2answers
36 views

Find repeated words in a text

One of most common typos is to repeat the same word twice, as as here. I need an automatic procedure to remove all the repeated words in a text file. This should not be a strange feature for a modern ...
0
votes
1answer
5 views

accessing EC2 instance from cygwin

I should follow these instruction to connect to my EC2 instance with cygwin : $ cd ~ $ cp /cygdrive/c/Users/JohnSmith/Downloads/cs184-john-stanford-edu.pem . $ chgrp Users ...
1
vote
1answer
16 views

How to change linux file owner and run using crontab?

I have a bash script with user ivr. How can I change the user ivr to root? Currently it has: -rwx------ 1 ivr ivr 543 Nov 22 16:46 db-backup.sh I wanted like below: -rwx------ 1 ...
0
votes
2answers
18 views

How to store results of multiple sql queries in shell variables in Bash?

I need to store in array the results retrieved from the database. So far this is basically what I'm trying with no success. Myarray=$(echo "SELECT A, B, C FROM table_a" | mysql database -u $user ...
0
votes
0answers
15 views

Add credits to the end of the video

Is it possible to use ffmpeg to make credit titles at the end of the video ? I have a very long string of authors separated by comma as input. Managed to create 1 frame and append all the string to ...
0
votes
2answers
26 views

How can I scp a file across two servers in one line? [duplicate]

I'm using Mac 10.9.5 and bash shell. In our environment, we have to go through a proxy (a CentOS machine) to SSH properly into a destination machine (another CentOS machine). What I would like to do ...
1
vote
1answer
11 views

ps aux status column meaning?

On a Mac, 64 bit, osx 10.8.5, two of my ps aux output lines, plus the header, are ; $ ps aux | head USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND myuid ...
1
vote
1answer
16 views

Is there an event fired right after a command finishes executing?

In Bash, after you type in a command (e.g., ls), it will execute the command, which will write its standard output (if not redirected) to the terminal (in our example, the content of the current ...
2
votes
4answers
114 views

How to match everything from after the last YAML delimiter onwards

I normally use grep to search for a pattern in a string. However in this particular instance I have to identify a YAML header, also, it ends with a triple dash. My test.info file has the following ...
0
votes
1answer
15 views

How to compare those (date) values in bash

I need to compare 2 strings of the following formatting: 2013-12-31T00:00:00 2014-11-19T15:40:30 Its a custom datetime format. I tried different things, none worked: if [ ${val1} < ${val2} ] || ...
0
votes
2answers
15 views

Bash Process output status

I would like to ask about creating new processes in bash script. I have script which will execute external programs tests and then check its output status and print if test was successful or not. ...
0
votes
0answers
20 views

Shell script force stop without waiting for the exit code

I have written a shell script checklick.sh on my CentOS box with the following content: #!/bin/sh # # description: check link through rtmpdump # . /etc/rc.d/init.d/functions ...
0
votes
3answers
25 views

How Can I Batch Change the Metadata of MP3 Files? [duplicate]

I have a fews of songs in a folder which I would like to add the metadata items of artist, title, genre and album to. I would like to take the metadata info for the title and artist from the file name ...
3
votes
1answer
28 views

How can I check if timezone has changed in a bash script?

I have a shell script that runs via crontab, but the commands in it are timezone dependent (they refresh a table in database everyday. If the script runs during the time of a DST change, it will ...
0
votes
1answer
20 views

Damaged preference file in /bin/sh

Today in Drive Genius 3, I ran the “Verify Preferences” function in Repair. It yielded this strange result: /bin/sh: xargs: command not found The only option Drive Genius gives is to remove the ...
1
vote
1answer
28 views

Want to create custom command and be able to pass arguments to it

So I have following command which I using pretty often on server ps aux | grep someword | awk '{print $2}' | xargs kill -9 What I want is make alias to this command and be able to pass arguments to ...
-2
votes
1answer
24 views

Bash executing command

Can anyone please give me the list generated by this : -{ for i in {1..100}; do lynx -dump -nonumbers -listonly [http]://www.dailymotion.com/user/MTDCafe/$i ...
1
vote
1answer
34 views

Dynamic variable substitution in PATH

I want to run different versions of Java on the same machine (Linux Mint 17) with default to Java 7. So I put this into /etc/environment: JAVA_HOME="/tools/java/java7" JAVA7_HOME="/tools/java/java7" ...
-1
votes
0answers
13 views

Project specific command line command management [on hold]

Are there any command line tools that help streamline commonly repeated project specific commands? I have always built a .bashrc with aliases such as cdmyproject cdthatproject. I'm suddenly curious ...
0
votes
0answers
16 views

Alternative ways of passing PS1 env variable into Ubuntu for SSH session

I know that there are twenty thousand answers, none of them worked as expected, I'm more surprised than you are, so please consider reading the story first. I'm trying to achieve what appears to be a ...
0
votes
0answers
19 views

PuttyCyg not starting correctly: “Must be connected to a terminal” error message

My computer is running Windows 7 SP1 64 bits with CygWin 64 bits installed and updated (as for 16-Nov-2014). I need to run the screen program of CygWin in a text console. I am trying PuttyCyg, a ...
1
vote
2answers
27 views

Shortcut to execute output of last command in Linux

Is there any shortcut to execute the output of the previous command, such as executing whatever is found by the locate command? For instance, if I run this locate command and get this output... ...
1
vote
2answers
24 views

Status line in linux shell

I use Windows and Putty in order to remotely connect (ssh) to some linux servers. I have set my hardstatus in my .screenrc file so that I can monitor some useful information. But this works only when ...
0
votes
1answer
25 views

Open file using bash with unix executable

I have an application which loads using a bash script e.g /Applications/My.app/Contents/MyExecutable I can load this using bash like so "/Applications/My.app/Contents/MyExecutable" However, I ...
1
vote
1answer
17 views

How to detect from a shellscript that a file on remote server has changed?

What could be used to detect that remote file is different compared to a local file? Possibly using ssh as a channel for communication. Scripted in bash, having linux servers in mind. This could be ...
0
votes
1answer
10 views

Difference between su and su -c (environment variables?) when running db2?

When I type this: su <user> -c "/home/<user>/sqllib/bin/db2 catalog tcpip node <dbName> remote <ip> server <port>" I get this error message: SQL10007N Message "-1390" ...
0
votes
1answer
27 views

Brew & Ruby no longer functioning properly due to a recursive trap

After updating to OS X 10.10 (Though this might have been irrelevant), I was not able to run any brew commands. Any command gave me this error: /usr/local/bin/brew: /usr/local/Library/brew.rb: ...
0
votes
0answers
9 views

rename using perl eval can mmv do this

Linux Mint 17 64-bit The following works to rename the numbering of files. # rename -n 's/(\d+)(.*)/($1+99).$2/e' *.txt 1-file.txt renamed as 100-file.txt 3-file.txt renamed as 102-file.txt ...
1
vote
1answer
17 views

Search for string and read the next line

I need to write a shell program that installs some packages. The program will run on Linux (obviously some commands will not work, for example, on Arch-based distros). So, I've got this file called ...
0
votes
0answers
14 views

Can I use ProxyCommand to run arbitrary commands on a target server via a jumpbox/middle server?

At work, we have a number of servers that we can only SSH into from our jumpbox server. Every now and then I need to execute a command on these servers. For example, if I want to execute df -H on ...
0
votes
1answer
25 views

Connect to PgSQL, DROP existent DB, recreate it using CREATE and run some queries alone and from files using Bash script

I need some advice creating a script for help me with repetitive task I do all the time on a development environment. I've a PostgreSQL server and since I'm developing a web application I need to ...
1
vote
1answer
25 views

Format terminal output to show apt-get upgrade errors in RED

I have a VERY simple bash script written for my Kali Linux distro so I don't have to run apt-get update, apt-get upgrade, apt-get dist-upgrade, apt-get autoclean, and apt-get autoremove every time I ...
-4
votes
1answer
26 views

Make a bash script sleep for x minutes [duplicate]

I need to make a bash script wait for a while, then resume running. Shebang ./script Wait 10m ./thing
0
votes
2answers
26 views

Bash - Fixing messy output

I'm not sure how/why this is happening. Basically I have a command that is supposed to find and clean out all files in the desktop that contain a certain pattern. I am doing the first part using: ...
1
vote
2answers
22 views

How to redirect stderr of python3 script using tee pipe?

I am a Debian and RedHat user. I would like to redirect stderr (module logging) from a Python3 script. The script outputs a lot of things and the part I want to capture can be fetched using: python3 ...
0
votes
2answers
32 views

Need help on if test condition

Need your help on below script where I am testing if file found at location /log/TestFile* and id there is only one file then it will display "File successfully Found" else "note found". my second ...
0
votes
1answer
21 views

processing sequential and parallel jobs in bash script

I understand that in bash programming, comamnd1;command2;command3 will run them sequentially while command1&&command2&&command3 will run them in parallel. However what happens when I ...
1
vote
0answers
23 views

Enter a Failed Docker Container with a Different Command

I have a fairly complicated docker container I'm attempting to build. As part of the build process I have I install Chef and have Chef install a number of cookbooks using Chef-Solo. I am having the ...
0
votes
0answers
28 views

Not able to open crontab -l

I am running crontab -l to view the crons on a RHEL server(v5.10) and getting the below error: crontab: error while loading shared libraries: libaudit.so.1: cannot open shared object file: No such ...
0
votes
0answers
16 views

Recursively create/update tarballs of old files inside directories

I have an archive directory of ftp files. I want to schedule a job to zip up any files that are older than 6mo into an tarball in each directory. I've started writing the script, but I feel like ...
-3
votes
1answer
20 views

linux software regarding filename

IN Raj's GNU/LINUX system there are a set of files and folders in his home dirctory (located in /home/raj). He wants to locate all pdf files which begin with the character sequence "lib" and contain ...
0
votes
1answer
23 views

Barnyard2 error on start

Been setting up a snort box with barnyard2, run into the error below. Can someone please help? $Starting Snort Output Processor (barnyard2): ./barnyard2: 35: ./barnyard2: barnyard2: not found ...
2
votes
3answers
84 views

How to open one GNU screen tab for each directory in a list

I have the following script - it sort of works. #!/bin/bash ... define plugins, etc for plugin in ${plugins[@]}; do screen -t $plugin done Want I want it to do open gnu-screen and for ...
2
votes
2answers
47 views

fit grep syntax from linux to solaris

The following command grep -w '^[^#]* machine_VIP' /etc/hosts | head -1 | awk '{print $1}' works fine on linux (its capture the machine_VIP alias and return the IP address from /etc/hosts and ...
1
vote
1answer
21 views

ffmpeg time lapse “overwrite” error - may be a globbing/shell issue?

I'm having some trouble with what I think should be a simple FFMPEG script. I'm just trying to take all the jpg files in a given directory and fill them into a time lapse video. I'm comfortable with ...
1
vote
1answer
23 views

Executing PHP file from command line with dynamic parameters

I need to run one script which will take one date as an argument. It is configured using cron to run on a daily basis, but I need to run it for a time range now. The issue is that this will fetch all ...