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

learn more… | top users | synonyms

-1
votes
1answer
1k views

find: ‘ls’ terminated by signal 13 error [duplicate]

My Script log=$HOME/Deleted/$(date) find $HOME/OldLogFiles/ -type f -mtime -7 -exec ls -latr {} \; -exec echo was deleted on `date` \; -exec rm -f "{}" \;|paste - - >> $log My goal for the ...
1
vote
1answer
260 views

Clean logging with BASH

I have a script that deletes files 7 days or older and then logs them to a folder. It logs and deletes everything correctly but when I open up the log file for viewing, its very sloppy. ...
1
vote
2answers
744 views

Accidentally copied files over /bin/bash in OS X

I mistakenly copied two files over /bin/bash. This now made my terminal non-responsive. I've followed this tutorial but it didn't help. For reference, the files are runcocoa.sh and runc.sh to be ...
1
vote
3answers
159 views

How to create a series of commands in shell, which will stop execution on error

My usual git workflow for deploying is the following: [while on master branch] git pull git push git checkout production git pull git merge master git push Would it be possible to create a ...
0
votes
1answer
159 views

In Bash, how do I pass the output of the first command to a command line argument of the second?

For example: mycommand.py -a `cat myfile.json` In this example, I need the contents of myfile.json to be passed as the value to the -a argument of mycommand.py. This almost works, but I need the ...
2
votes
3answers
2k views

PuTTY not sending Esc

I SSH with PuTTY from my Win7 x64 laptop to a Unix environment for my office. The problem I'm facing is very similar to this post where I cannot send an Esc character to the terminal. I first noticed ...
2
votes
3answers
137 views

I used mv ./*/* to flatten a directory on a ntfs filesystem, without add . to the end of the command, now all of my files are gone

How can I recover these files? I used: mv ./*/* when it was supposed to be mv ./*/* . Now all of my files are gone.
1
vote
0answers
71 views

Bash Shell doesn't recognize the letter “t”

I have Cygwin running on a Windows 7 Box. In what is a relatively new (and strange) development, the bash shell stopped recognizing the lowercase "t". For example: I type echo cat, output is ...
5
votes
2answers
15k views

Cygwin Dos2Unix Command not found

I am having some problems using cygwin. I am trying to use the dos2unix utility and cygwin is throwing -bash: dos2unix: command not found When I go back into the installer and look through the ...
0
votes
5answers
4k views

Moving a file using PuTTY

I am newbie struggling to move a file on a Linux VPS using PuTTY. I can log in with a user in PuTTY at this point I can navigate to see the file I wish to move ...
1
vote
1answer
388 views

Rundeck get verbose output of command executing on node

I have Rundeck executing a remote script, which is in python is using print statements to return output normally such as: $ python mytest.py PASS: Condition 1 passed PASS: Condition 2 passed PASS: ...
0
votes
1answer
6k views

How to start a service at boot time in ubuntu 12.04, run as a different user?

I have a server ClueReleaseManager which I have installed on a Ubuntu 12.04 system from a separate user (named pypi), and I want to be able to start this server at startup. I already have tried to ...
-1
votes
1answer
138 views

Can't load a .bash_profile on windows powershell

I'm looking to load a .bash_profile with some aliases and functions on launch but, I haven't been able to find a way to load the .bash_profile. I'm not even sure if it is possible.
2
votes
2answers
3k views

Print full path of files and sizes with find in Linux

Here are the specs: Find all files in / modified after the modification time of /tmp/test, exclude /proc and /sys from the search, and print the full path of the file along with human readable size. ...
2
votes
2answers
5k views

bash or bash_profile JAVA_HOME permanent export

I tried to export JAVA, used this JAVA_HOME=/etc/jdk1.7.0_07/ export JAVA_HOME export PATH=$PATH:$JAVA_HOME/bin It seems like it works just for while, after I close my console have to do this ...
1
vote
1answer
365 views

Is there a way to limit maxdepth for ls -Rhal?

Is there a way to limit maxdepth in a ls -Rhal command? I am aware of find . -maxdepth, but I want to be able to get the file information that comes with ls -Rhal.
4
votes
2answers
376 views

Bash command substitution not working as expected

I'd like to view the last few lines of a file, but I want the columns aligned. Basically, I want to disable wordwrap. This is straightforward with: tail $FILE | cut -c -80 But I'm trying to ...
1
vote
1answer
42 views

Viewing the ASCII codes of piped-in characters

Is there a command that would let me see ASCII values of characters outputted from a program? Say I pipe in a NUL character and a p, could I get a 0 and a 112 out?
1
vote
0answers
109 views

Getting bash history-complete-backwards/fowards and vi-mode to work with tmux

I'm using bash on Ubuntu 12.04 my inputrc contains: "\e[A": history-search-backward "\e[B": history-search-forward set show-all-if-ambiguous on set completion-ignore-case on"" for my history ...
1
vote
2answers
508 views

Why does echo * | rm -f not work?

Why does echo * | rm -f not work? as per my understanding, echo * should list all the files in the directory and pipe should send this list as an argument to the rm -f command, which should delete the ...
1
vote
1answer
80 views

Show cat output on less exit

After viewing a file in less, with the convenience of scrolling to the side and searching, I want to be able to view/copy the contents of that file normally in my terminal window without having to run ...
0
votes
1answer
29 views

How to know the PBS batch job submit time inside the script being excuted?

I'm using the PBS qsub to run a script on a cluster that must output a report file named with the batch job submit time. The batch job submit time is the time it joins the PBS batch job que. I ...
2
votes
3answers
1k views

Deploying .war file on java application server only when file has finished being uploaded on a linux box

This problem happen quite frequently while uploading a .war or .ear, that are just little more than .zip file, to a remote server, and have it deployed by the application server. Usually, at ...
1
vote
1answer
98 views

Installing java on red hat enterpirse linux 3

I am trying to run eclipse IDE which results in an error which says no java virtual machine was found. The result of running "/usr/sbin/alternatives --config java" command is that it displays - one ...
0
votes
2answers
67 views

Bash - remove all lines beginning with 'P'

I have a text file that's about 300KB in size. I want to remove all lines from this file that begin with the letter "P". This is what I've been using: > cat file.txt | egrep -v P* That isn't ...
0
votes
1answer
462 views

Grep get everything except matching

Lets say I have a text file that says: Hello my name is agz. I am asking a question that is important. If i type: grep -v "is" /path/to/file, I should get no output because both lines have "is". ...
3
votes
2answers
3k views

Efficient way to search string within file find and grep

I am searching all files containing a specific string on a filer (on an old HP-UX workstation). I do not know where the files are located in the file system (there are many directories, with hudge ...
0
votes
1answer
32 views

Find a directory only contained within a certain folder

I have a directory structure like: foo |__bar |__bin | |__tmp | |__bez |__tmp I need to find the tmp directory in bin/tmp, but not the one in bez/tmp. It seems to me ...
19
votes
2answers
538 views

Accidentally sourced .bash_history

In a moment of brilliance, I executed the command source ~/.bash_history. Fortunately, most of the commands are using vim to edit some file, but there are some scary commands in my history - moving ...
4
votes
1answer
99 views

Using su with commands

Ubuntu Server 12.04 On a remote server that I ssh into I have set up a special user with: sudo adduser --system --disabled-login --disabled-password --group suser to run some maintenance functions. ...
0
votes
2answers
65 views

Is there a way to let the user create a cron entry without opening nano

Is there a way to create a cron entry with bash where the user only have to enter the command to execute and the script does the rest. Create cron file if it isn't already created Set the execution ...
4
votes
0answers
199 views

How to disable alternate buffer in GNU screen itself but not for vim, less inside it?

What I would like to accomplish is mouse wheel scrolling behavior that I'm used to in a regular ssh session. In bash prompt mouse wheel should scroll my terminal output, and inside less/vim - the ...
31
votes
3answers
2k 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
936 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
118 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
550 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
201 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
141 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
652 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
75 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
275 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
879 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
688 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
336 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 ...
14
votes
4answers
28k 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
496 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?