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

learn more… | top users | synonyms

0
votes
0answers
30 views

Open pwd protected http stream in vlc from Linux CLI

Can anyone please advise me on how to open a pwd protected http stream from CLI in vlc? I checked out the --help and man pages, but they seem to offer only syntax for opening ftp, rmt and smb pwd ...
6
votes
3answers
1k views

ffmpeg/avconv force scaled output to be divisible by 2

I record my desktop with avconv (aka ffmpeg) and then scale it to 720p. I recently added to my script so they can select a window with xwininfo and it will record that one specifically. However, if ...
1
vote
2answers
209 views

How can I “grep” recursively filtering the name of the files I want with wildcards?

When I want to perform a recursive grep search in the current directory, I usually do: grep -ir "string" . But that command searches inside all kinds of files, including binary files (pictures, ...
1
vote
4answers
48 views

Check which string occurs first in a growing file

I'm running a remote executable which produces a logfile. I want to write a script to check whether the executable is run successfully or encounters an error. The way I can do this is by looking at ...
1
vote
2answers
41 views

bash commands that don't fit on one page - make output scrollable

Probably been answered somewhere, but its difficult to frame the search phrase. I am running a bash terminal window and some commands are too big to fit on the page (e.g. ps -A) I vaguely recall a ...
3
votes
2answers
461 views

Empty bash command line

I am looking for a way to delete the currently entered command line without wasting seconds on the Backspace key. For example I scrolled the bash history and have a long command line that would ...
2
votes
2answers
68 views

How can I execute a command and immediately quit the terminal?

It should be pretty clear what I'm trying to do: original script.sh: select blah in foo bar oof rab do cmd $blah break done Pretty basic stuff. The problem arises when I try the following: ...
1
vote
3answers
2k views

Term Enviroment Variable not set, when executing a Bash File via SSH

i am trying to run a bash script on a remote machine. If I open a ssh connection in a terminal, i can easily run the script. But when i run it like that: ssh user@ip < /etc/script I get an ...
13
votes
4answers
4k views

Cygwin bash prompt is wrapping lines on the same line

I'm using Cygwin bash prompt, and for long commands the text will wrap around on the same line as opposed to going to the next line despite setting my PS1 to simply ' $'. Here's a screenshot,
1
vote
1answer
29 views

How to assigne a variable in windows shell?

In the Windows7 shell I have the following working code to print out the current IP adress: @echo off :: get ipv4 ipconfig | findstr IPv4 | findstr 172 > ipadd.txt :: For statement to find the ...
0
votes
1answer
31 views

Skip keychain without skipping the rest of .profile

I am using the keychain ssh-agent wrapper from funtoo.org. I have it loaded automatically by adding an eval line in my .profile. E.g.: eval `keychain --eval id_rsa github bitbucket` Sometimes, I ...
-4
votes
1answer
56 views

Can someone help to make this script [closed]

Can please someone help me to make script for multi screen command at startup here is what it is cd /home/bhop1/serverfiles screen ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map ...
0
votes
1answer
23 views

.bashrc used in gnome not just terminal

I've recently started using the Anaconda Python distribution for software development and I want it to be the default Python distribution when I run something in the terminal. In order to do this, ...
1
vote
1answer
19 views

/dev/dsp missing in debian and cannot hear festival utterance

Tried to make an utterance in festival and it seems /dev/dsp/ is missing in the debian. How to add this? festival> (SayText "Hello") Linux: can't open /dev/dsp #<Utterance 0xb669c708>
0
votes
1answer
25 views

How to apply “set number” to vi on root?

I'm using vi on centos 6.5 and added "set number" script to /etc/bashrc in order to look line numbers whenever boot. It works well to show it on user login but not root. How to apply "set number" of ...
9
votes
8answers
19k views

Filesystem full: how to find the biggest directories or biggest file?

Under Linux, I'm looking for a command to list the biggest file and/or the biggest directories under a directory.
1
vote
4answers
5k views

How to run a command after an already running, existing one finishes?

If I start a script that is going to take a long time, I inevitably realize it after I've started the script, and wish I had a way of doing some kind of alert once it finishes. So, for example, if I ...
2
votes
2answers
53 views

sed error when launching terminal on OS X

I get these error messages when launching bash or zsh in standard Terminal.app or iTerm2 sed: 1: "\#^system_type=# { s#^s ...": extra characters at the end of p command sed: 1: "\#^system_type=# { ...
0
votes
1answer
23 views

Calling a list of functions provided on a stream

I'm writing a bash script to configure a server in which the end user will have to choose the actions to perform and the script will execute them. Each action will be implemented as a function. I've ...
1
vote
2answers
26 views

How to exclude a file from a command with ZSH?

Given this directory content : one.file two.file three.file in bash, when I enter rm *.file !(two) only one.file and three.file are deleted. How can I do this in ZSH?
0
votes
2answers
18 views

Bash prompt coloring not appearing correctly

I had a functioning Bash prompt colored how I wanted it, but after reinstalling the background is gray rather than black like this setting should make it. My PS1 is \[\e[33;40m\]\T ...
0
votes
0answers
25 views

running programs from MSYS with quotes

I'm trying to execute non-MSYS program from within MSYS. But MSYS (bash) doesn't work as expected. I'm running commands and see what procmon has to say about command line passed: >cmd /c ""cmd" /c ...
1
vote
2answers
31 views

Relative bash colors that work with all schemes?

How can I have a "relative" color in bash, rather than hardcoded one? If I specify to use yellow "\033[93m" then it looks bad for those people that use white background. Is there a way to specify not ...
2
votes
2answers
29 views

Discard content of logfile, keeping tail

I'm looking for a way how to discard content of the logfile, leaving only defined tail. In two steps it's quite easy: tail -n1000 alert_migtst.log > alert_migtst.tail mv -f alert_migtst.tail ...
-1
votes
1answer
23 views

how to escape '$' in an awk statement in shell alias

I'm trying to write an alias that will kill all running php processes.. this is the command i got in my ~/.bash_profile alias killphp="ps aux | g [p]hp | awk '{print $3}' | xargs kill -9" this ...
2
votes
5answers
482 views

How do I refresh directory in BASH?

I have a directory, containing files generated by compiler. During each rebuild this directory gets cleaned and, after build process ls gives me empty output. After I cd out of directory and then back ...
10
votes
6answers
10k views

Force bash script to use tee without piping from the command line

I have a bash script with lots of output and I would like to change that script (not create a new one) to copy all the output to a file, just like it would happen if I were piping it through tee. I ...
0
votes
1answer
33 views

How can I do a recursive find and replace from the command shell?

Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of '/path/to/folder' with '/other/dir' in all files in this directory ...
2
votes
1answer
2k views

Two parts: linux startup script to connect to bluetooth and cron to keep it connected

I have a mini bluetooth keyboard and a Raspberry Pi running a Debian-based distro. I know the MAC address of the keyboard but for this question, let's just use AA:BB:CC:DD:EE:FF. Right now I have to ...
0
votes
1answer
29 views

end child process on network timeout

I have a .NET program (Edit: using MONO), call it myfoo that resides on my remote ubuntu server. To access it, I ssh into my box (using wifi, not ethernet). My bash shell starts up as normal, I cd ...
1
vote
2answers
42 views

grep to display all IPs in a text file (linux)

I'm writing a script to look for a ping from a certian foreign IP, but I am having some trouble understanding how to format my "grep" command.. Inside my text file is the output from "netstat anp" ...
4
votes
2answers
127 views

Create directory of files each with a certain file size

I would like to create 100 files each with a file size of 10Mb. Is there a simple unix command that can create a directory with these 100 files?
0
votes
2answers
84 views

Getting errors trying to run shell script (Linux)

I'm trying to run the following script. I have run it before without issue, but now I encounter an error. #!/bin/bash # init function pause(){ read -p "$*" } echo & echo "(Website):" ...
19
votes
5answers
5k views

Is there a shortcut to mkdir foo and immediately cd into it?

This is something I do frequently $ mkdir foo $ cd foo This works as a single command, but it's more keystrokes and saves no time. $ mkdir foo && cd foo Is there a shortcut for this? ...
0
votes
1answer
110 views

How do I run multiple scripts within a script, even if one script fails

I have a simple bash script that executes a number of other scripts … #/bin/bash … ./update_artifact1.sh $ARTIFACT_VERSION ./update_artifact2.sh $ARTIFACT_VERSION ./update_artifact3.sh ...
0
votes
1answer
24 views

Trace web redirection in bash script

I want to make a script to download the image at best resolution (not the preview image) from a deviantART link, as if I clicked the "Download" button. However, it seems that deviantART redirect the ...
1
vote
2answers
37 views

SSH TERM detection

My ssh config file has accept env set as: AcceptEnv LANG LC_* I am a bit confused how when I ssh through some clients my TERM variable is set as xterm256-color, and other clients TERM is set as ...
1
vote
1answer
37 views

How to find out process that uses file but is not using at the moment?

Background I, as well as many other people according to Apple's support forums, am having some trouble with the audio settings on my Mac. Whenever the computer sleeps or powers off, the audio resets ...
1
vote
1answer
34 views

Bash: Read file that contains a star (*)

I'm to read the contents of a file in a variable. Doing the following is great: content1=$(<content-1.html) However, if that file contains a star (*), instead of reading it properly, it replaces ...
1
vote
2answers
29 views

Bash determine whether parameter variables ($1, $2, $3, etc.) have been set

Many of the posts I just read have many answers that cover this, but I don't understand what I'm doing really; it's been hit & miss. The .sh script I'm working with: #!/bin/bash # init ...
1
vote
1answer
23 views

redirect one bash line to stdout/terminal vs log

I have a bash script where I'm redirecting output into a file for logging. if test -t 1; then # stdout is a terminal exec > $OUTPUT_FILE 2>&1 else # stdout is not a terminal, no ...
0
votes
2answers
42 views

How to retrieve a name from another file with a Bash script?

I would like to grab a name out of another predefined file and use it within my shell script. The file being read would be in ./docs/description.org and the format (a table in .org format) is: ...
0
votes
1answer
34 views

Samba net command to shutdown Windows 8 machine [duplicate]

I have a Raspberry Pi for home automation, and I want to be able to shutdown my Windows 8.1 workstation using a command from a bash shell. Of course I've Googled before asking here. And I found; ...
1
vote
3answers
2k views

How to auto commit to my git repository using cron?

I look into a lot of answers about this subject, but something is wrong here, let me explain. I create this script, to make my cron cleaner :) #!/bin/bash cd ...
1
vote
1answer
34 views

Script bash delete older files on directories with special chracters

I use a script for delete older files on Trash or directories type Junk, or similar. It works fine except when it has special characters or spaces in the names ...
0
votes
1answer
870 views

GNU Dialog and UTF-8 characters

I'm using GNU dialog in one of my lengthy shell scripts. One of the areas I've got problems with is when I'm asking for an inputBox where the user can type a book's title, mostly in French. In this ...
0
votes
1answer
28 views

How can I set the terminal encoding when running a crontab job?

I have a crontab job which executes a Ruby script on Arch Linux. It works basically, but when I call "googlecl" to post to my blog, it always shows a "safeDecodeError" exception (eg.: ...
1
vote
1answer
94 views

Bash error while running script

I have a CentOS 6.5 64-bit dedicated server. The only thing I done on it is yum install java7, so I have not installed any other stuff. So in the directory /root I made this file (test.sh) ...
2
votes
2answers
96 views

java app running in screen starts a process and this child is NOT in screen

I'm running a spigot server in screen, it is a java app. When it crashes and goes down gracefully it calls a restart script as a last action. This script simply contains a java -jar spigot.jar. The ...
2
votes
3answers
6k views

Remove files from remote host using SSH

I need to delete all files inside a remote directory using SSH, The directory itself must not be deleted, so @Wes' answer is not what I need. If it was a local directory, I would run rm -rf dir/*.