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

learn more… | top users | synonyms

0
votes
0answers
7 views

Odd 7z Extracting Behavior

In short, I would like to use command-line 7z to extract an archive and recreate the directory structure of the archive. I know the function letter for this is "x" yet it does not seem to work for ...
0
votes
1answer
19 views

Why grep shows me output that does not contain the search word?

I want to check if the sensu service is installed. I ran this command service --status-all| grep sensu and here is the output vagrant@vagrant-ubuntu-trusty-64:~$ service --status-all| grep sensu [ ? ...
0
votes
0answers
13 views

accessing remote web-pages from local computer

Suppose I can access my remote computer from the console putting (using OSX) ssh my_name@my_ip Suppose now I want to visit web pages of the remote computer, and this from my local only using the ...
0
votes
1answer
14 views

chmod throws missing operand on 764, OK on 664

Having set everything in my project to 777 (rwxrwxrwx) for debugging purposes, I wanted to dial down the openness and set the directories (not the files) in the root folder to 664 (rw-rw-r--). To do ...
1
vote
0answers
13 views

Gnu screen, using the exec command in .screenrc

I have added the following lines to my .screenrc bind -c music u exec amixer sset Master,0 5+ >& /dev/null bind -c music d exec amixer sset Master,0 5- >& /dev/null bind -c music t exec ...
0
votes
0answers
5 views

How do I configure easy_install to use the right Python interpreter?

I am using mac OSX and have installed python 2.7.9 via this article, from /usr/bin if I run the command ls -l /usr/bin/python* in a bash terminal, I get lrwxr-xr-x 1 root wheel 67 Jan 24 02:12 ...
0
votes
0answers
6 views

Netcat server execute program and return result

I am attempting to create a minimal local listen server that takes an input request, pipes the input to a program and then returns the result of the command. What I have at the moment is the program ...
0
votes
1answer
10 views

How to call in one line multiple processes in serie

If I run the following script with 3 lines: process1 process2 process3 then process2 will wait for process1 to start, and the same will happen with process3. How can I do the same in only one line ...
1
vote
1answer
27 views

Environment variables on Linux-like systems

How to set environment variables for a user in most generic way that is independent of shell environment variables (like profile for Bourne-like shells, bahsrc, zshrc, zshenv, ..)? The idea is to set ...
3
votes
1answer
24 views

How do I prepend a string to program output without waiting for the whole line?

I have a script that runs a command on a remote server using SSH. I want to prepend the string Remote: to every line of the output, but I don't want each line to be delayed until the whole line is ...
17
votes
2answers
1k views

Is there a one line command to make chmod interactive?

I am looking for something like: ls | ask_yes_no_for_each_file | chmod +x the_files_approved Or similar syntax. Also could work on other commands that you want individual confirmation for.
1
vote
1answer
23 views

Bash permission denied error on trying to source ~/.bash_profile

I can't work out why I am getting this error -bash: /dev/ttys000: Permission denied when I try to source my ~/.bash_profile? Nothing has changed in my setup (OS X 10.10.1), except a recent ...
0
votes
1answer
9 views

Open terminal with telnet from command

I'd like to open a telnet sessions from a sublime text build process. I've tried using open /bin/bash --args telnet 127.0.0.1 but that fails .. is there anything similar I can do? edit I'm trying ...
3
votes
1answer
35 views

Bash “command” equivalent in PowerShell

Is there a "command" equivalent of Bash in PowerShell? I used to over-ride certain command in Bash like this: function npm(){ command npm --no-color $@ } I'd like to do the same in PowerShell, ...
0
votes
1answer
11 views

Can't type anymore on Git bash after returning from ssh -tt

I wanted to execute a command in a remote shell in its interactive environment, so as to make it load my remote .bash_profile there first before executing the command. This works great: echo ...
1
vote
1answer
29 views

How to grant execute access to a specific set of command to one group, and another set to another group

Say there is a set of shell commands {ls, cat, kill} I want to enable users in group A to be able to execute the commands {ls, cat} And users in group B to be able to execute the commands {cat, kill} ...
26
votes
7answers
2k views

How to quickly change a the first word in a bash command?

I would like to improve a bit my workflow with bash and I realize I often want to execute the same command to a different executable. Some examples: Git: git diff foo/bar.c git checkout ...
0
votes
0answers
11 views

Top -l returning always 0.0 CPU usage when requesting single PID

On Mac OS X 10.9 (Mavericks) & 10.10 Yosemite I’m unable to get the correct CPU usage for a single process using the top -l command for example top -l 1 -ncols 3 -pid <pid> Even though I ...
0
votes
0answers
22 views

Bash function only works when password manually input

At work I have to run the following function everyday. The function works fine when I am prompted for the password. However, I tried to hardcode my password so that I don't have to enter it in each ...
1
vote
1answer
22 views

Echo in file returns No such file or directory

I'm wondering why my simple script doesn't work: #!/usr/bin/env bash user_variable='$1' echo "export USER_VAR=$user_variable" > ~$user_variable/.filename When I launch the script I have this ...
0
votes
3answers
31 views

using awk on only files which START with 'xyz'

I have 3 files in a directory: xyz1.txt, xyz2.txt, rst_xyz.txt and I want to work with ONLY the first two (those which start with xyz). The command ls | awk '/xyz/{print $1}' will return all three of ...
0
votes
0answers
13 views

How to enable path folder in mac terminal

As You see when I put command "pwd" I'm in folder: MacBook-Grzeg% pwd /Users/Grzeg/ticket_managment But my terminal still show only that's: MacBook-Grzeg% Now as you can see I have ...
0
votes
1answer
15 views

CentOS bashrc function to email on login

I've a system setup where an email is sent on a user login (line from .bashrc): printf "user details, ip etc" | mail -s "[LOGIN NOTICE] `hostname` - `whoami`" <admin>@<domain>.co.uk ...
0
votes
0answers
13 views

Is it possible to reuse functions I defined in .bashrc from zsh?

I am using bash on my Mac and I spent a lot of time customising functions in there. One things stops me from adopting zsh fully on Mac: I am not that proficient in zsh so I am pretty sure I can ...
0
votes
0answers
25 views

How to execute a command stored in a variable or just execute the output of a command? [closed]

Feel free to guide me to a totally different solution, in case there's a more efficient way to do this and I'm just going about it entirely wrong. I'm using Linux based command line on iOS, trying to ...
-1
votes
0answers
16 views

OpenVPN Bash Script [on hold]

I want to ask whether such solution is even possible using OpenVPN not about details concerning script. Server side: CentOS 6.5 Client side: Windows 7 Bash or Python script having certain result ...
0
votes
1answer
33 views

iTerm/zsh not reading .bashrc OR .bash_profile

In ~/.bash_profile I have : if [ -f ~/.bashrc ]; then source ~/.bashrc fi In ~/.bashrc I have some aliases When I load a new iTerm window, my aliases do not work. If I source ~/.bashrc they ...
0
votes
4answers
63 views

How do I DELETE a comma and a space from a numeric string using a bash script

Folks, I have asked this question 5 times on here and have received 5 separate bits of code from super users that have all *failed. Problem: I have stock information being brought back into a txt ...
3
votes
3answers
168 views

Execute command in-between a bash pipe row …?

I want to run a series of piped commands which do a lot of audioprocessing. It looks as follows in pseudocode: command1 | command2 | command3 Of command2 and command3, both take the output of the ...
1
vote
2answers
26 views

Removing file and all links - hard and symbolic

How can I remove file and all links related to file to remove? rm -f file.txt removes just the file. Futher more, if there any other hard links of file system the file will not be removed. What is ...
2
votes
1answer
31 views

How to include hidden files in ls pattern match?

I was just trying to list files in the current directory with a certain pattern, but it doesn't work with hidden files. How can I match all the files? I tried ls *foo* and ls -a *foo* Not ...
2
votes
3answers
41 views

Linux mv command for moving multiple files with different extensions

I am wondering if it possible to use bash to mv multiple files with different extensions into one directory, for example mv 1.png 2.jpg dir/ except match many files
0
votes
0answers
15 views

Location of commands executed in past

With HISTTIMEFORMAT="%d/%m/%y %T ", history command shows the exact time of the execution of a command. Is there a way to find from which folder the command was executed?
0
votes
1answer
21 views

Clearing global history in PuTTY

I was wonder how Putty stores history. I have server and multiple account there. Every account has a history when I use "history" it lists the history from that account. Is there something like global ...
0
votes
0answers
7 views

exclude files when uploading via ncftp / ncftpput

i found a well working solution for my server setup thanks to this Question: Syncronizing files over FTP Now I have only NcFTP available on my Webserver http://ncftp.com/ncftp/doc/ncftpput.html and ...
1
vote
1answer
28 views

Reverse output of a command

I'm trying to get the reversed output from git log --branches --graph --oneline (Sadly you can't pass --reverse to it because it says it's incompatible with --graph) Is there a way to reverse the ...
0
votes
0answers
25 views

SSH .bashrc Alias for `Clear` Command Twice

Sometimes it is helpful to call clear twice to add some padding so that scrolling up or down will allow us to look at the output of previous commands easier, e.g. I can segregate compiler output by ...
1
vote
1answer
34 views

How could I overwrite file hosts in OS X?

Well, in my company I have to change file hosts to map the domain to the LAN IP because our servers located here. Then when I arrive to home, I have to change hosts file again to comment out which IP ...
0
votes
0answers
18 views

If screen's C-a A command does not work, what internal state must be wrong?

In the Linux command screen, you can type C-a A to change the name of a window. Right now I am running a screen session with six windows. The first four have custom names - great. The last two I want ...
1
vote
1answer
25 views

Using cURL command-line tool on Mac, What can I do to this script to ask it to fetch stock data which will replace commas with NO SPACES

Example: Google Outstanding Shares are 670,000,000 and this value is collected in a txt file from Yahoo Finance API via the below script. The issue is; that numbers WITH commas or spaces are a bloody ...
0
votes
1answer
35 views

while loop condition - search for string pattern in bash

I am altering a bash script and I need to write a loop and test if file of a specific pattern exists in source directory. Script works if I designate a specific file but not with a wild card ...
0
votes
0answers
19 views

Piped processes in upstart shell script continue running after stopping

I have an upstart script on my CentOS box that runs a shell script. The shell script runs a netcat command whose output is piped through a couple other commands and then ends up in a file. When I ...
27
votes
10answers
3k views

Prevent user typing accidental space between rm and wildcard

Intention: rm -rf string* Problem: rm -rf string * The first case is a legitimate and common use of rm, a small typo can cause a lot of problems in the second case. Is there a simple way to ...
2
votes
1answer
14 views

Use argument of unrun command in Linux

If I wanted to run mv arg1 $(sed arg1 's/regex/replace/') is there a better way to to do it than to reinsert the filename into the sed command?
1
vote
1answer
53 views

Using the with cURL command-line tool on Mac, What can I do to this script to ask it to fetch stock data which comes back WITHOUT commas?

cd documents/quoteUpdate while true do curl -o quotes.txt -s "http://download.finance.yahoo.com/d/quotes.csv?s=goog,aapl&f=sl1c1p2pt1" echo UPDATED: date sleep 10 done
-1
votes
1answer
37 views

Exclude folders with a path pattern using FIND command on Ubuntu console

PROJECTS |___ SITE1 | |____files (to exclude) | |____img | |____js | |___ SITE2 | |____files (to exclude) | |____img | |____js | |___ ...
0
votes
2answers
24 views

How can I determine the IP of a remote host in a shell script?

I have an IP alias that switches between two hosts depending on the host's availability. (This is a very large network and the switch is done externally of local control.) I need to determine when ...
0
votes
1answer
65 views

windows 7 file explorer crashes after mkdir via git bash

My environment: Windows 7 Git v1.9.0 Steps to reproduce my problem: open a folder in windows explorer right click in that folder and select "Git Bash" execute: "mkdir test" in the git bash ...
0
votes
1answer
33 views

console command result as input file for sed or other commands

Some commands take a file as an input, is there a way to treat a result of a command as a file? for example I want to get a string between 2 strings: sed -n "/START-WORD-HERE/,/END-WORD-HERE/p" ...
0
votes
1answer
22 views

Run script under OSX _www user account

I have a small internal for my use only php website which triggers a bash script to do some app signing etc. I need that bash script to run some ruby gems. (Security is not important.) The way I see ...