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

learn more… | top users | synonyms

31
votes
3answers
3k views

Have a file named ~ (tilde) in my home-directory

I just noticed that I have a file called ~ in my ~-directory. $ ls -la ~ ... -rw-r----- 1 x1 x1 733962240 Mar 1 17:55 ~ ... Any idea how I can mv or rm it?
0
votes
2answers
1k views

pipe command's output to dialog and allow to scroll up

I want to run an arbitrary command, for example find / -name "a*" I want to pipe its output to to dialog. --tailbox and --progressbox handle this well, except that if the output becomes too much, ...
2
votes
1answer
119 views

Creating a .bashrc function with encapsulated commands

I'm trying to create a function in .bashrc to shortcut my MAMP commands. I want to do something like this: mamp config Opens up MAMP's httpd.conf file for editing. mamp restart Restarts the ...
3
votes
4answers
587 views

Is it possible to use a shell script in the sendto folder?

I would like to use a bash shell script from the SendTo folder. When I put a shortcut to a batch or exe into theSendTo folder it shows up in the shell Send To context submenu, but when the shortcut ...
2
votes
2answers
3k views

How can I make `find` find files in reverse chronological order?

I want to find files in subdirectories sorted by timestamp (of creation), with most recent first. I have looked at the man page but it seems to only seems to let you filter by timestamp rather than ...
1
vote
2answers
218 views

terminal.app: how to read the terminal window title

I have seen many questions about how to set the tab (or window) name, but how to get it? I have setup terminal to open 8 tabs, each tab having its own name (dev1, dev2, ... dev8) Is there any way for ...
0
votes
3answers
144 views

Possible to use more than one core with sed and bash?

I am looking to use more than one core when replacing values with sed in bash, is this possible?
0
votes
0answers
677 views

Executing tcpdump remotely while storing packet capture locally

I have run into stumbling block while attempting to create a bash script that will write packet capture files from tcpdump onto a remote server, while displaying the output of the tcpdump command so ...
0
votes
0answers
19 views

Executing tcpdump remotely while storing packet capture locally [duplicate]

I have run into stumbling block while attempting to create a bash script that will write packet capture files from tcpdump onto a remote server, while displaying the output of the tcpdump command so ...
0
votes
2answers
79 views

Remember bash directory stack across sessions?

Bash will remember command history across sessions, but not the directory stack created with pushd. Is there any way to remember the directory stack as well?
0
votes
1answer
45 views

One hour too much in date formatting using date(1)

If I execute the following commands in the terminal start=$(date +%s) # wait a few seconds … end=$(date +%s) time=$(dc <<< "$end $start -p") echo "$time" echo "$(date -jr $time +%H:%M:%S)" ...
1
vote
1answer
291 views

Select vimenter autocmd's to run based on args

I'm trying to reduce the number of things I need to do when I open VIM. I have the three following scenarios that I'd like to account for: 1. Open vim with a directory specified vim . For this ...
2
votes
4answers
907 views

execute a command in all subdirectories bash

I have a directory structure composed by: iTunes/Music/${author}/${album}/${song.mp3} I implemented a script to strip my mp3 bitrate to 128 kbps using lame (which works on a single file at time). ...
0
votes
1answer
708 views

Bash script to remove and rename files based on size and naming

I have directories with multiple conflicting files, and am looking for a way to sort, name and delete duplicates based on a distinct pattern based on the file's name and size. Though my knowledge of ...
3
votes
3answers
345 views

Need to sed awk or grep output to extract strings

I have output which looks like this: "vancouver/news/vancouver-voices": { "status": 0, "time": 0, "timestamp": 1371298701 }, "vancouver/news/vancouvers-march-second-annual-success": { ...
1
vote
1answer
42 views

does this scriptline need escaping

Very simple question, I need to know if the "query" parameter from Alfred still works My guess is, it wil not. If so, how do you properly escape? mysql -u [root] -p[foo] -e "create database ...
15
votes
4answers
31k views

How can I use a bash like shell on windows

I use Linux and a Mac. I'll be teaching some command line stuff soon. What can I install on Windows to give me a terminal window most similar to a basic mac/linux bash shell. Would like to be able to ...
0
votes
1answer
556 views

Substitute for zip command or way to zip files

I want to zip files using the zip command, but my terminal says -bash: zip: command not found Is there a way to get the zip command, or maybe use another command instead?
1
vote
3answers
1k views

Raw multiline string in bash?

Is there a way to get an uninterpreted string in bash - it could include single and ouble quotes and Bang ! etc. ? I want to do something like #!/bin/bash echo -e "Line One\nLine Two\nLine three" | ...
1
vote
2answers
6k views

`jobs` command doesn't show any background processes

When I was in the office using my desktop, I started a script run.sh in background 4 times. run.sh parameter1 & run.sh parameter2 & run.sh parameter3 & run.sh parameter4 & Then I ...
4
votes
3answers
1k views

Exclude subfolders with specific files in recursive rm -rf /folder/*

I wonder if it is possible to specify some elegant condition (parameter maybe?) in rm -rf /folder/* not to delete its subfolders, which contain files with name "dontshoot.txt". I wasn't able to ...
0
votes
2answers
336 views

Start java process with different names?

I have 2 eclipse and 2 servers running If i make a ps -C java i see something like: 2460 pts/1 00:03:08 java 2908 pts/3 00:00:05 java 3045 pts/4 00:00:17 java 3284 pts/3 00:01:40 java ...
2
votes
1answer
658 views

Bash OAuth 2.0 JWT script for Server to google Server Applications

I am trying to make a jwt script that gives me tokens based on https://developers.google.com/accounts/docs/OAuth2ServiceAccount This is what I have so far, but the token server replies that the ...
1
vote
1answer
116 views

rsync in a bash script appears to work, but the files aren't updated on destination server

I've got a server where I do my web development and testing, and I have a bunch of frontend servers that sit behind a load balancer. I wrote a simple bash script to rsync a directory on my dev server ...
0
votes
1answer
107 views

How to source a file only for a defined sudo user in Linux?

I want to source a file in .bashrc only for my user id when I sudo to the functional id. it should not be sourced when other user sudo in.
1
vote
3answers
742 views

sed quotes and backslashes on cygwin

I am trying to extract a substring from a string with sed on cygwin. #!/bin/bash var1="foo\ bar" var2="baz" var3="$var1 $var2" # extract "foo\ bar" from "foo\ bar baz" var4=`echo $var3 | sed ...
0
votes
1answer
37 views

Error in Terminal when I open it

Last login: Wed Jun 12 15:15:00 on ttys000 -bash: Downloading: command not found -bash: Upgrading: command not found -bash: RVM: command not found -bash: RVM: command not found -bash: Upgrade: command ...
1
vote
4answers
2k views

Cannot cat file which has space in name in linux

I believe there's a simple fix but cannot debug it out. I have file called "file name with space" How do I cat this file from Linux bash ?
0
votes
3answers
3k views

How do I parse a line thorugh a file in bash

I am very new to shell scripting I had a small query regarding the file parsing. So, here's what I am trying to do: I run an svn merge command, and genaratea conflict file my conflict file is ...
3
votes
1answer
304 views

How to benchmark bashrc / zshrc and prompt rendering time?

As im currently experimenting with new stuff in my prompt i need a way to tell what the performance impact is. How can i monitor how long it takes to render my prompt and the time it takes to source ...
0
votes
1answer
666 views

Ways of recovering a missing .bash_history due to a 100% full disk?

Two Putty sessions were opened to a Debian 6 Linux. Log-files led to a full disk. The bash history of the entire shell sessions is missing, and even beyond that (This may be due to a blocked ...
1
vote
4answers
3k views

How to disable trackpad/mouse via the Mac OS X command line?

Is there a terminal command in Mac OS X to disable/enable the trackpad/mouse? I know that I can disable the trackpad of my MacBook Pro when an external mouse is connected. But is this also possible ...
0
votes
1answer
1k views

Adding Git repo and branch to Tmux status line

I have found a Tmux configuration file that shows how to add the Git branch to the Tmux status line, however It just shows [[ branch ]] no matter if I am in a Git repo or not. I am not sure if this ...
3
votes
2answers
693 views

Bash readline deleting till the previous slash

In bash emacs mode, is there anyway to delete till the previous slash character? For example if i entered the command cp /usr/local/bin/reallylongincorrectfolder ...
0
votes
1answer
126 views

Pipe bash commands

I'm trying to download a tar.gz package with wget, decompress it and rename the decompressed directory all in one (piped) command. My attemps were: wget -O- $URL | tar fvxz - -C $DEST wget -O- $URL ...
0
votes
1answer
471 views

arch linux update - Binaries move to /usr/bin requiring update intervention

I just botched the latest update for arch linux. Here's what I did: pacman -Syu --ignore filesystem,bash reboot So I logged out before running: pacman -S bash pacman -Su Now I see this: sh: ...
0
votes
1answer
122 views

Bash terminal lacking functionality when running as non-root

I'm running a command-line Debian system, accessed via SSH through PuTTY, and am experiencing differing terminal functionality between root and other users. When logging in as root, the terminal ...
4
votes
3answers
459 views

Spawning multiple parallel wgets and storing results in a bash array to be pretty printed when all wgets are done

I have a long list of urls on my own website listed in a carriage return seperated text file. So for instance: http:/www.mysite.com/url1.html http:/www.mysite.com/url2.html ...
1
vote
1answer
269 views

Bash and Ubuntu Commands

I have a problem with bash currently. I have Ubuntu 10.04 installed on a server I ssh into to do Rails development and something happened and now I am unable to use RVM as it is installed. The error I ...
2
votes
1answer
3k views

Using Mac OS X terminal to copy a selection of folders to a new location, with merge behavior

I have a folder 'foo' that contains a lot of sub folders, e.g. foo |---20101 |---20102 |---20103 |---20111 |---20112 |---20113 There are way more than this, but hopefully it explains the ...
1
vote
2answers
302 views

How to merge ls commands colors with the output of find or du?

I have a simple alias to list the size of files&folders in cwd. ( including dotfiles in this case , ignoring zero sizes ) du -sh .[!.]* * | sort -hr | grep -v '^0' which can be achieved ...
2
votes
1answer
1k views

Open multiple tabs in iTerm2 with a specific directories

I would like to know if this is possible. I want to set up some script or command that will open 5 tabs and each tab that will open will have their own directory specified All in the same window ...
-1
votes
1answer
302 views

Set the title for bash Terminal on mac OS X to current working directory [closed]

I know they have been asking a lot of this question and I got it worked perfectly, but one thing I don't understand is why this is different. #This will show the full path (/usr/bin) ...
2
votes
1answer
119 views

Script acting strange in bash_profile (but just under X)

I have made a simple .sh script which checks every minute whether a particular file is empty or not, and if it is not empty, makes a led on my laptop blink at 0.5Hz. I call this script from my ...
5
votes
2answers
995 views

How to use GNU parallel with gunzip

I have a directory full of .gz, I want to expand each archive in parallel with GNU parallel. However I did not achieve anything. I tried parallel 'gunzip {}' ::: `ls *.gz` parallel gunzip `ls *.gz` ...
0
votes
1answer
1k views

Send mail with an zip attached from Mutt without prompt options?

I'm stucked when I'm trying send an email, using Mutt, but evry times that I run the script it prompt an menu with an verification. There is any way to bypass that verification or to inupt the option ...
1
vote
1answer
2k views

tcpdump output to file not working

I'm trying to write the results of tcpdump to a text file. I am not interested in saving a pcap file to use later, I just need exactly what tcpdump returns in plain text (the ips and timestamps of ...
6
votes
5answers
20k views

Monitor TCP Traffic on specific port

I've searched quite extensively for this, but cannot seem to come up with a working example. My objective is to monitor TCP traffic on a specific port to see incoming connections and write them to a ...
0
votes
2answers
623 views

Run a bash script on boot of ubuntu server which does a constant loop

I am in the middle of create a local FTP server and I need this script to run when the machine boots up: #!/bin/bash while [ 1 ]; do chmod 2777 /home/ftp/folder; chmod -R 777 /home/ftp/folder; sleep ...
3
votes
2answers
490 views

How to execute a function in bash or zsh on every letter being typed into prompt?

I know about preexec() hooks for zsh and the way this can be achieved in bash. ( link ) But can i get the current input while still typing? The idea behind this question is the following: in order ...