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

learn more… | top users | synonyms

0
votes
1answer
24 views

tar complains “No such file or directory”

I'm using bash on Windows (distributed along with msysgit) to zip log files - one archive per date. Problem is, following script does not work and I have no idea why. Cut is here to get part of the ...
1
vote
3answers
34 views

Two very similar lines of sed, can they be combined?

I have the following two lines in a shell script and was wondering if there was any way to condense them into one using sed. I am not sure if there is a wildcard or anything that could replace the ...
1
vote
1answer
32 views

How to update bash on Mac OS X Yosemite

Just trying to learn bash scripting a little. My old bash version: Bash version 3.2.53(1)-release... I've updated my bash on mac os x yosemite with homebrew: brew update brew install bash Then ...
-1
votes
0answers
8 views

How to use bash to locate a string and print entire file to new file? [duplicate]

This is what I need to accomplish: A recursive directory search for a string in a file. If the string is found in a file I need the file to be printed to a new file. Just one new file and ideally a ...
0
votes
1answer
19 views

script to disallow mounting of certain idVendor

I'm trying to write a script to disallow mounting of certain usb thumb drive's brand like silicon-power my thought was to use tail -f /var/log/messages and grep it to idVendor and blocking it upon ...
3
votes
3answers
140 views

how to select nth result on command line without using mouse

I got this alias for searching for a file recursively and case insensitive type fr fr is aliased to `find . | grep -i' and so let's say i'm searching for a file fr nsstring+util ...
2
votes
0answers
26 views

How to delete old $PATH echo in Mac

After i changed my Mac username(using the way supplied by Apple Documents), I found that when echo $PATH, there are some old paths in it. ...
-1
votes
0answers
12 views

who/Which process is creating a .php file in a given folder?

I am trying to find out, which process is creating a specific file in a given folder. For example, I am trying to find out, Which process creates a .php file in a folder called "uploads". I can do ...
2
votes
1answer
15 views

Executable lauches if called directly from terminal, but does not work when called from shell script

I have downloaded some software (called samtools) and it is stored in a folder on my desktop. Then I've added the path to the executable into the PATH environment variable. In other words my ...
-2
votes
0answers
19 views

Macaulay 2: using copy-paste tools [on hold]

question 1: Can one use copy-paste tools in "Macaulay 2" ? (I mean copy from a pdf or... and paste on "Macaulay 2"). question 2: can one export the result in "Macaulay 2" as pdf or other formats? ...
0
votes
2answers
17 views

What's the smartest way to copy-rename (backup) several files in different folders at once in the shell?

I want to copy-backup several files in different folder at once before updating ntpd. Example (one file only): sudo cp /usr/sbin/ntpd /usr/sbin/ntpd.old Files: /usr/bin/sntp /usr/bin/ntp-keygen ...
0
votes
0answers
7 views

Staret managed server using Jenkins

I am trying to start web-logic managed server from Linux system. for that I have one shell script start_wls_managed4_btwnpmd01.sh with following code. ...
1
vote
1answer
13 views

Programmatically starting 6 servers and manipulating Gnome Terminal

I would like to make a script ( bash ) that will programmatically start gnome-termal with 6 tabs each with its own title start a different command in each tab delay starting server 5 until sever 4 ...
1
vote
2answers
32 views

Remove directory that is listed as “No such file or directory”

I have a folder on an external harddrive that has a curious folder in it that shows up as "No such file or directory" when I do a directory listing. See screenshot below. How do I remove this ...
1
vote
1answer
25 views

bash script processing files with bad characters

I received a zip file with a folder structure that include parenthesis. I've worked through two processes at the cli and now merge them into a script The first searches through the file structure for ...
1
vote
1answer
30 views

Is there a limit to how many “../” back-directory references you can make?

I've never noticed this before (and I've been using Linux as a primary OS since 2008). Is there a limit to how many back-directory references you can make with ../? Why? I moved a file only for it ...
1
vote
1answer
78 views

Bash script starts my program two times

I have a custom daemon program in C, which is a daemon. The usage is as follows SampleGame /directory1/ /directory2/ /directoryN/ I've made the same into a bash script. When I start it, the ps ...
1
vote
1answer
27 views

How to get different prompt look for root and regular user

My .bash_profile has different styles of prompt for regular user and root but in order it to work the .bash_profile should be reloaded every time I switch users. How can I achieve this? Can I make ...
1
vote
1answer
35 views

Why is my bash history not sorted by date?

My mac bash history looks like this (I'm copying just the last +100 lines): 2769 23/09/14 17:54:09nano ~/.bash_profile 2770 23/09/14 17:54:21nano ~/.bash_profile 2771 23/09/14 17:54:28source ...
0
votes
2answers
30 views

find /data/oozie-admi/ -type d -ctime +1 | xargs rm -rf [0] command deleted /data/oozie-admi/ folder

/data/oozie-admi/ folder contains multiple directories. This command find /data/oozie-admi/ -type d -ctime +1 | xargs rm -rf [0] deleted /data/oozie-admi/ folder . Need to find out scenarios in ...
-1
votes
0answers
30 views

Python script to create users and upload ssh keys to remote server from a local machine [closed]

This is what I am trying to do. I have a user list csv file containing: user1, SSHkeys/user1.pub user2, SSHKey/user2.pub Store them respectively into $username and $SSHKey Another server list csv ...
1
vote
2answers
44 views

Can `ls` be set to only list the first X files/directories?

I'm trying to make a command which only displays the first 30 files when the ls command is invoked. I found this method... ls | head -30 ... but it ends up spitting out the files in one long list, ...
0
votes
2answers
34 views

Command “find” -exec replacing string

I'm trying to find JPG files in a folder tree to execute the command "" to transform it to PDF. The problem is that the code I am running leaves the file in the same directory and I want to move it ...
0
votes
0answers
18 views

Bash Terminal colors for filetypes [duplicate]

Bash terminal seems to not have colors for certain types of files, such as docx, pdf... Is it possible to add colors for these in the output of ls, or no?
1
vote
2answers
22 views

Nmap runs slower as root than normal user

I am working on a bash script to enable automatic detection and remote control of my company's proprietary data recorders. The recorders run a custom version of linux and are essentially powerful pis ...
0
votes
0answers
19 views

How to close a GUI window from BASH

I can open a GUI window from BASH with the following command: gnome-open /media/UPDATES How do I close it from BASH? (There is no "gnome-close" command.)
0
votes
3answers
38 views

Find files then tar with wildcard

I have a series of files called: 2014111test.log 2014111test.log.stuff 2014111test.log.flibble 2014115test.log 2014115test.log.stuff 2014115test.log.flibble I want to find all the log files over a ...
3
votes
4answers
107 views
+50

How do I find files and total their sizes?

I'd like to find a series of files (based on a wildcard expression) and total their disk usage. Something like this: $ find . -name 'flibble*' -ctime +90 -exec du -sh {} \; 2.1G ...
0
votes
1answer
13 views

Type file content, pipe some actions and put result back

Is there way to do something like thas: cat somefile.txt | sort | uniq > somefile.txt I.e. I want to list entire file, then pipe some actions to its content and finally put result back to source ...
1
vote
1answer
26 views

How to Extract Multiple substrings from Log FIle

I am trying to extract the timestamp and the number string in the URL called in an apache logfile that looks like this: 123.456.78.90 - - [16/Dec/2014:06:27:30 +0100] "GET ...
0
votes
1answer
20 views

Up arrow in gnome terminal to review command line history ignores commands with leading whitespace. Is there a workaround?

When writing python code (using gvim) I often keep complex command line commands for test cases saved in my docstrings. A common time-wasting error I make is copying the entire line from the python ...
2
votes
1answer
39 views

Renaming multiple directories

If have a directory structure that stores records based on their date of recording. Originally there was one directory that contained a subdirectory for every single day like this basedir ...
0
votes
1answer
31 views

conemu multiple bash cygwin ssh

I just want to know how to have multiple tabs logged in to a server via ssh to for example ssh user1@1.1.1.1 for a tab named server1 (to some particular folder location) and ssh user2@2.2.2.2 for a ...
1
vote
1answer
16 views

Get user logged into a given tty

I'm writing a bash script that disconnects idle sessions but writes to the tty a few seconds before terminating it to make sure it really is not being used. The format for write is write user [tty]. ...
0
votes
1answer
31 views

What does `-n` option in sed do?

This is the man page entry for -n: -n suppress automatic printing of pattern space I notice that when not using -n for certain operations, each line is printed to stdout (and the requested ...
1
vote
1answer
23 views

Grep fails to find sequence after assign to variable

I run: awk -F ',' '{print $2}' data.dat | sort | uniq | tr '\n' ',' | grep "*)>nS4XkrlH @XUL" and the sequence is located in results. Then I run b=`awk -F ',' '{print $2}' data.dat | sort | ...
2
votes
2answers
199 views

Why does the 'vi' command open 'vim' editor?

I am using Ubuntu 12.04. Not that I am complaining as I like my vim and prefer its many features. However, I’m curious as to why it does it. It is not aliased in .bashrc or .bash_profile. I am not ...
0
votes
0answers
41 views

RVM wants me to edit PATH in .bash_profile - I fear it is a mess

I am trying to get an Omega sub-theme running on my local machine (OSX 10.10) with Acquia Desktop Dev. Trying to run isolated ruby in sub-theme directory. When I use rvm list I get: Warning! PATH is ...
0
votes
3answers
55 views

Bash: executing concatenated variables

I have a Linux bash script, to the effect of: COMMAND_TO_EXECUTE="foo "$1" --option1 --option2 "$2 exec $COMMAND_TO_EXECUTE Problem: the script fails Debugging clue, If I echo ...
1
vote
1answer
29 views

shell script file (.sh) - dynamic command

I'm trying to build a dynamic command to execute in an .sh file, however, when I do it, it seems that somehow it adds \r characters so command is not correctly executed. Notice that I'm running this ...
1
vote
1answer
24 views

Linux bash, command replace

How can I erase the - from clipboard? I have a script: #!/bin/bash xclip -o | replace - "" | xclip Bat this doesn't work So replace \- "" take no effect ]$ uname -a Linux localhost.localdomain ...
0
votes
1answer
17 views

Launch a bash sub-shell and expect a command

From a shell script, how can I launch a bash sub-shell for the user & wait for the user to type exit at the bash sub-shell prompt? I tried bash -c expect -c 'expect "exit" {send "Exiting\n"}'; ...
0
votes
0answers
28 views

Shell command shortcut using input filename as output filename

Hi could someone help me with a little command shortcut please? Im trying to run an ffmpeg command and was wondering if there was a shorter way to type it, Ive been reading up on parameter expansion ...
0
votes
0answers
11 views

Defining git commands on windows

I have a script that I use to add some functionality to git. For this particular case I cannot do it with an alias. The name of the script is git-cim. In linux if I place this script in my path and ...
0
votes
1answer
22 views

Is it possible to check for blips in internet using SSH tunnels?

So basically at work we're losing internet connectivity for just a few seconds at a time, which is enough to kill our SSH tunnels, kill our VoIP calls, etc. I have a cronjob set up with my own script ...
1
vote
2answers
17 views

Is there a way to pass arguments via pipe on bash?

Is there any way to pass arguments via pipe on bash? something like: echo value1 value2 | mkdir -p ./$1/$2 The line above would create the directories ./value1/value2 If this is not possible I ...
1
vote
2answers
12 views

Add directory only once to any variable

I started this question by looking at Add directory to $PATH if it's not already there. In my case, I wanted to do the same to LD_LIBRARY_PATH also. How to do that without writing a script for ...
0
votes
0answers
21 views

Is it possible to modify .bash_logout?

I am trying to modify .bash_logout to append the shell history to a txt file. I am also trying to figure to make some restrictions on that file. I have tried a bunch of commands while searching about ...
1
vote
3answers
37 views

Bash script to find all folders containing a specific file and copy a new file to those folders

I'm trying to write a script that will loop through all subfolders of a directory to search for a specific file and then copy a new file to those folders that contain that file. This is what I have ...
0
votes
0answers
12 views

ddclient updating to public IP instead of private IP

This is the antithesis to question 389125 I have private services (apache, ssh, synergys for example) accessible on a desktop on the local network. This is not with centralised login (ldap/AD for ...