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

learn more… | top users | synonyms

3
votes
2answers
132 views

How do I store all command outputs and errors?

Hi there! I need to capture all command, stdout and stderr without any addition to the commands. I mean, that I have to save/store the output of these: $ echo 'test' $ ls -l $ cat some_file ...
0
votes
1answer
96 views

Why is OS X creating two bash processes per tab?

So when I have 3 tabs open, ps aux | grep bash reports: $ ps aux | grep bash root 629 0.0 0.0 2486024 4812 s002 Ss 8:01pm 0:00.02 login -pf moon /bin/bash moon 513 0.0 ...
0
votes
4answers
252 views

Changing multiple lines in to single line with spaces in linux

I have following data with multiple lines username: joe empid: 1111 status: resigned username: tom emid: 1234 username: kate empid: 2222 status: resigned What I want is to get the data in to ...
0
votes
1answer
27 views

Replacing values in a file using vi

I have a file which as multiple entries like "allowed_users 100", "allowed_hits 100", "allowed_users 10000". Want to replace the values of "allowed_users 100" to "allowed_users 1000". Best Wishes, ...
0
votes
0answers
53 views

Take back Ctrl-/ from Debian console configuration

My Debian Testing console is stealing my Ctrl-/ and using it as Backspace; Ctrl-/ is the single key-press Undo in bash and emacs. After some research, it looks like the Ctrl-/ -> Backspace mapping ...
15
votes
1answer
3k views

Why do we have login, non-login, interactive, and non-interactive bash shells?

So the bash man pages explain what login and interactive shells are: A login shell is one whose first character of argument zero is a -, or one started with the --login option. An ...
2
votes
1answer
65 views

Shell commands executed from Vim behave differently

I have mapped a key in Vim to run curl-based tests on my API with :map ,t :w\|:!quizzical tests.sh <CR>. The tests run as expected when I press the key; however, the tests which take longer to ...
1
vote
1answer
56 views

Filtering out incomplete log entries

I'm trying to get some garbage collection logs into Splunk. However, when java starts garbage collection, it starts the log entry, then when it's done it puts in the end of the entry. Splunk treats ...
7
votes
3answers
4k views

How to upload multiple files to FTP from linux server?

I have for example database backups in my linux server and I would like to write a script to upload it to remote FTP. I tried put command, but it can only transfer one file at a time. Then tried mput ...
1
vote
0answers
59 views

shell script for finding the unix noun phrase

one entry in the on database is: LPE-1*story#1/1 of pearl#1/2*historia de la perla*storia della perla* histoire de la perle* história da pérola*istoria perlei*TOPIC The fields are separated by ...
0
votes
3answers
269 views

Shell is interpreting IFS=$'\n' as IFS='n'

I am using a Bash shell on a Ubuntu 12.04 LTS server, and it seems that IFS=$'\n' is being treated as IFS='n'. Script in use: concat=$(echo -n "concat:" && find ...
2
votes
1answer
3k views

How do I run “yum -y update” from Bash Script?

When I try to run "yum -y update" from a Bash script it doesn't work. Here is what the script looks like. #!/usr/bin/ echo "--> Updating CentOS System" yum -y update I run the script with this ...
2
votes
1answer
97 views

Execute bash command if wireless network is deleted?

As part of a plist I'm writing for OS X, I need to execute the "say" command if a wireless network is successfully deleted using: networksetup -removepreferredwirelessnetwork If a network isn't ...
5
votes
3answers
6k views

BASH - merge directories when using mv

I just started using BASH, so I can move all contents of a directory to another. But the issue is, I was expecting it to merge the directories. I am using cron job to run this script. #!/bin/bash ...
1
vote
1answer
152 views

Recursively move files in sub-dirs to new sub-dirs of same name

I have a batch of files all ending with the same string, ie: *_ext.dat located in several sub-dirs along with several other files, in a given main dir. This is the structure: ...
6
votes
4answers
656 views

Why does checking whether a folder exists using -d on an empty string return true?

I was writing some scripts and wrote something like ARTIFACTS="/SOME/PATH" [ -d $ARTIFCATS ] && rm -rf $ARTIFACTS/* What happened is that out of stupidity I executed the second line without ...
2
votes
2answers
3k views

rm command: remove files with file names containing brackets

I am trying to remove all files in a Windows 7 directory with filenames containing brackets; ( and ): Using MinGW: rm *(*)* I get an error: sh: syntax error near unexpected token '(' I assume ...
3
votes
1answer
242 views

Combining multiple MP3 files from a specific day

Everyday I have about 10 different mp3 files created on my server. What I would like to do is setup a cronjob to run at night and combine the current days tracks into one mp3 track. I don't care so ...
0
votes
1answer
94 views

Terminal auto-complete with @ symbol?

I have multiple directories that include the @ symbol within the directory name. When I do the normal tab to auto-complete a directory name it chokes if there is an @ symbol included in the name; ...
2
votes
2answers
28k views

How to ssh with username AND password linux automatically from bash

Im trying to ssh with the Username AND password provided. Restrictions: 1. I DO NOT want to have to set up a public key for each of the servers I am trying to ssh into. 2. I DO NOT want to/have ...
0
votes
1answer
365 views

Debian ssh user TAB behaviour changed - how to revert it?

I have created new user with: useradd u passwd u When logged as u via PuTTy the TAB key behaviour is changed: autofill dir/filenames and commands not working the tab is placed instaed (4 spaces) ...
1
vote
2answers
64 views

How to save linux command?

I am using grep -r [^a-zA-Z0-9]myVariableName[^a-zA-Z0-9] -n JS_files/ as mygrep file grep -r [^a-zA-Z0-9]$1[^a-zA-Z0-9] -n JS_files/ and then sh mygrep myVariableName But then I lose the ...
5
votes
1answer
350 views

How can I delete a just-typed newline character in bash?

I sometimes copy-paste paths into the terminal, and often accidentally copy the newline character. For example, I want to find then read the contents of foobar.txt. $ locate foobar.txt ...
4
votes
2answers
793 views

Get value from .XML file in Linux

Anyone got a nice solution for this: I want the value: /PlayDirList/PlayDir.1378803204 from this XML. <settings> <setting id="ask_set_logo_to_bg" value="false" /> <setting ...
1
vote
1answer
883 views

wget execute script after download

I need every time you complete a transfer program wget this run a script. this is my full command line: wget -i urls-to-downloads.txt My problem is that I want to go subtracting it downloads the ...
4
votes
1answer
2k views

xargs -I replace-str option difference

From my understanding, the following should mean exactly the same: ls -1 | xargs file {} ls -1 | xargs -I{} file {} if -I option is not specified, it is default to -I{}. I want to list all files ...
1
vote
1answer
628 views

Cannot execute commands in Terminal

My Terminal does not show my username when I open a new window. Additionally, I can't execute any commands either. This is what is in my window: ... Last login: Sat Oct 5 22:27:07 on ttys000 ls -1 ...
0
votes
1answer
102 views

trying to install Astromenace on my linux mint 14 cinnamon pc

so i am following this tutorial as it is the only one i can find and any that i can find are the same as this one: http://linuxg.net/games-on-linux-how-to-install-astromenace-on-ubuntu-and-fedora/ ...
0
votes
0answers
5 views

trying to install Astromenace on my linux mint 14 cinnamon pc [duplicate]

so i am following this tutorial as it is the only one i can find and any that i can find are the same as this one: http://linuxg.net/games-on-linux-how-to-install-astromenace-on-ubuntu-and-fedora/ ...
1
vote
1answer
94 views

Problems after installing Microsoft Services for UNIX

I had Cygwin installed and everything worked liked a charm. At some point I installed Microsoft Services for UNIX on my computer and the problems started. When I open up a commnad shell an wanna try ...
1
vote
1answer
117 views

Sorting services in Linux

I have a few Linux servers, all running different services. When I run service --status-all, I get a couple screens of output. I thought I'd be smart and pipe it to sort, and see as a group what ...
3
votes
1answer
417 views

How to subscribe to a youtube feed from linux command line?

I want to subscribe to a youtube channel and automatically download new videos to my linux machine. I know I could do this e.g. with miro, but I will not watch the videos using Miro, want to choose ...
2
votes
3answers
98 views

See all past comand line activity / records

Is there a way that you can see all past activity / records for the command line, like a 'history' feature in a browser? Bit of background I'm using OSX terminal to interact with the command line.
2
votes
1answer
70 views

Determine remote machine`s account name of the user logged in over SSH

At the company where I work we have a certain shared accounts that anyone can use over SSH to perform specific tasks. At this point, we have too many users and each of them has their own usability ...
0
votes
2answers
616 views

Add read permissions to all the directories of a path

I want to add (not modify other file permissions) for all the directories in the path written bellow. Something like chmod -R xx4 /home/mDB/admin/KNUCKLES/dbs/ The path /home/mDB/admin/KNUCKLES/dbs/ ...
0
votes
2answers
96 views

How can I know the total of used processors by user in Linux?

How can I know the total of used processors by user in Linux? For example: User "X" runs 2 (or more) processes that use in total 3 processors. How can I know it? If it impossible, then How ...
4
votes
2answers
2k views

How does Mac OS X set the value of $PATH?

I have a basic understanding on how the $PATH can be set, but is there a documentation that fully describes where Mac OS gets all the paths that get appended to $PATH? I'm aware of things like ...
3
votes
1answer
616 views

linux find: searching for files smaller than 2Kb misses the ones between 1 and 2Kb

I just stumbled in an oddity with the find command on Linux, in a nutshell I had the need to find all files smaller than 2Kb in a certain folder, so I issued the command: find /folder_to_search_into/ ...
2
votes
1answer
95 views

What's the rule on using the word “git” as an alias?

I used to keep my git aliases in a file outside of my .gitconfig file, in the normal format of: alias gb="git branch --verbose" which worked great. But, after looking around at others' dotfiles, I ...
0
votes
1answer
148 views

Copy files from path to path same structure for each user

How to copy single file for example index.html from source /backup/cpbackup/daily/a1/homedir/public_html/index.html /backup/cpbackup/daily/b2/homedir/public_html/index.html ...
-2
votes
1answer
132 views

Bash- how to select a directory based on the number of files it contains

I want to select all the sub-directories in a given folder that have a certain number (in this case, 75) files within them. Then I want to take the name of each of these sub-directories and assign it ...
1
vote
2answers
345 views

Long-running SSH command hanging - better strategy?

I have long-running command being executed over SSH. Every so often, the command seems to hang and stop getting any output. The command is still running on the other machine (in fact, if I Ctrl+C ...
1
vote
3answers
300 views

Finding a file by md5sum

Given the md5sum of a file, I want to know if anywhere else in the directory tree is another file with the same md5sum (but maybe under a different name). How can I do that in bash? P.S.: To ...
1
vote
1answer
104 views

Vim command line argument not being executed

I've been looking for a command line calendar program for Linux for quite some time now. I realized I should just use vim. I want to be able to easily view a week of todo lists. Currently using this ...
3
votes
2answers
1k views

Filter tail command through multiple grep commands to separate files

What I am trying to do is filter the output of one log file into separated log files based on a grep filter. tail -f test.log | tee >(grep "Error" > error.log) >(grep "Warning"" > warning.log) ...
1
vote
1answer
217 views

Upstart and process substitution

So I want to use the following in my script stanza: forever -l >(tee $QW_LOG_DIR/webserver.log | logger -p user.info -t '[QW]') start webserver.js However, that doesn't work for at least two ...
8
votes
4answers
6k views

Are there other commands like scp but for deleting files and folders?

I am using scp to copy stuff to a remote location. But sometimes scp does not work as expected, I have found that sometimes the copy does not complete properly (possibly when I have added new files to ...
5
votes
3answers
3k views

Command executed via ssh does not return proper return code

Why this does not work? $ ssh vm "bullshitcommand; echo $?" bash: bullshitcommand: command not found 0 I expected non-zero return code.
0
votes
2answers
138 views

Instructions embedded in Bash script?

Is there a way to make a bash script require a set of parameters when it's loaded, and if not, it will automatically spit out an echo to the screen giving instructions? Looking at this example of a ...
0
votes
1answer
110 views

bash tab completion is showing commands instead of files and folders

I used chmod to make some scripts executable, and now my bash shell is tab-autocompleting all available commands. How can I make it go back to completing just files / folders in the current folder?