A shell is software that lets users interact with the operating system, usually by typing at a command-line.

learn more… | top users | synonyms

0
votes
3answers
25 views

Why doesn't my IF ELSE work?

It's a simple script I wrote, nothing fancy at all @echo off echo 1 = stream1 source echo 2 = stream1 high echo 3 = stream1 medium echo 4 = stream1 low echo 5 = stream2 source echo 6 = stream2 high ...
0
votes
0answers
11 views

How to get stdout of a “lost” session

I don't well what's the name of the situation, I think yesterday I closed a session with a background ipython process, but I am still able to connect to it (the process is running a web server and I ...
0
votes
1answer
17 views

Delete first line from a file and Update

Here is the file i work on "list": g-8.xx.yyy.zzzz g-9.xx.yyy.zzzz g-10.xx.yyy.zzzz g-11.xx.yyy.zzzz g-12.xx.yyy.zzzz Here is the script i try to complete ( i'd like to get the first line and ...
16
votes
6answers
21k views

Find and delete all the directories named “test” in linux

I have many directories named "test" and I would like to remove them. I know how to find them and print them using: find . -name test -print Now, how to do I remove the directories? Please note ...
1
vote
2answers
32 views

What's the fatest way to calculate in command line?

Is there a faster way to calculate in command line the following: echo "4 * 5" | bc
1
vote
1answer
25 views

xrandr | grep “ connected ” give me more than one line but IFS=$'\n' read can't break it

I have something like this: declare -a DISPLAYS AUXILIAR="$(xrandr | grep " connected ")" IFS=$'\n' read -ra DISPLAYS <<< "$AUXILIAR" Why it isn't detecting line breaks if echo ...
3
votes
2answers
618 views

Fastest way to delete a non empty directory in Linux

I use the command rm -rf directory but i came across the following article : Article That suggests that rsynch to an empty folder is the fastest way? rsync -a –delete empty/ a Why is this the case ? ...
90
votes
13answers
57k views

How to reliably keep an SSH tunnel open?

I use an SSH tunnel from work to go around various idotic firewalls (it's ok with my boss :)). The problem is, after a while the ssh connection usually hangs, and the tunnel is broken. If I could at ...
1
vote
2answers
28 views

how to gzip and scp at the same time

I have a file in which i wanted to zip up and at the same time transfer over to another host using scp. I tried to do the following command but failed. I do not mind zipping up and scp over later, ...
0
votes
1answer
348 views

Can not bring a background running vim to foreground?

If I have a vim running in the background, it seems that I can not bring it back to foreground. Do you have any idea, why?
0
votes
0answers
9 views

Are there any commands I can issue on DD-WRT to force full duplex (no vlan tab present)

Need to force full-duplex on my dd-wrt router, the vlan tab is missing and the direct link to it doesn't work either.
2
votes
1answer
18 views

Delete empty directories Synology NAS Shell

I try to delete my empty directories on my Synology NAS (DS415+). I tried: find . -type d | xargs rmdir But the problem is that I have directroies with spaces in the names like "hello (2012)". ...
2
votes
3answers
835 views

Redirecting shell command outputs to another konsole shell

I am writing a shell script and I would like to write commands in the script but redirect the output to other konsole sessions. (using kde)
0
votes
1answer
42 views

Multiple Conditions in shell script

Im stuck in giving two conditions in my script. I can read two things - What is the NEAREST SERVER If it is MacBook or Anything Else and then use defaults write command to modify the plist file. ...
0
votes
2answers
12 views

Rename multiple folders using shell script without matching a pattern

How to rename multiple folder/files by user defined. Say for Ex. I have multiple folders like krish, moorthy, ravi, robert, etc.. I want to rename all these directories as script_1 , script_2, ...
0
votes
0answers
27 views

Modify right click context menu with copy filename or copy full file path

I'm wanting to modify the right click context menu for windows explorer. I need to select a number of files and right click on them and copy the file path. Ideally I would also like the option of ...
0
votes
1answer
19 views

How to use echo in shell command from Makefile?

I have a GNU makefile. It runs fine on Linux, Solaris and OS X. However, under Cygwin-32, Cygwin-64 and MinGW, it produces: /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: ...
3
votes
2answers
740 views

Windows 7 & Git Bash: Doesn't Recognize pear/phpunit

I can run pear/phpunit from "cmd" just fine. I checked %PATH% and everything that is there is also in $PATH. To be clear, this is not msysgit -- It is this: http://git-scm.com/downloads Anyone know ...
2
votes
1answer
41 views

What's the difference between dd and cat for writing image files?

When writing image files to disk or to a USB stick, the instructions usually use dd, like this: dd if=myimage.img of=/dev/sdb How is this different from, say: cat myimage.img > /dev/sdb I ...
0
votes
1answer
15 views

scp files between hosts using ssh local port forwarding

I have a problem about transferring files between hosts. Lab environment is like: My host <-> Host A <-> Host B I only have access to Host A and I want to transfer files to Host B. Host A has ...
9
votes
3answers
934 views

What is the equivalent of bash's !$ and !! in the fish shell?

I've been using bash for a decade or so and have gotten used to being able to type !$ to repeat the last argument, e.g.: $ mkdir foo $ cd !$ cd foo (That last line is printed by the shell to tell ...
0
votes
1answer
28 views

bash error when starting shell from tmux

When I open a new shell in tmux I get an error message. This error message does not show up when I start a new shell in GNOME terminal. What might tmux be running at startup that I need to check? ...
0
votes
2answers
20 views

Command host with awk

Please, why "echo" instruction: iphost="$(ssh root@$machine -x "host $machine | awk '/has address/ { print $4 }'")" echo $iphost display: g-3.xx.yyy.zz has address 172.16.65.35 instead of: ...
0
votes
2answers
44 views

How can i get the hostname of the machine i work on?

Please, how can i get the hostname (fully qualified domain name) of the machine i work on ? Here is my script: #! /bin/sh hostname=$(host $ipaddr | awk '{print substr($NF,1,length($NF)-1)}') ...
10
votes
3answers
1k views

How to run a command in background with no output unless there's an error

How to suppress a command's output but show it if the command exit codes an error?
1
vote
0answers
9 views

RVM is not a function message when using fish shell

I'm trying to use rvm from within the fish shell rvm gemset use rails3 I'm getting the following error message from fish RVM is not a function, selecting rubies with 'rvm use ...' will not work. ...
0
votes
1answer
17 views

Script Shell Storing ip address in a table

Here is my file: test.txt 172.16.65.29 172.16.65.30 Please, how can i modify this script to store all ip address in test.txt in a table. for ip in ${iparr[@]} do echo $ip done Thank you so much ...
0
votes
1answer
3k views

ksh Auto-Completion PuTTY Configuration

I'm having a bit of a problem configuring my PuTTY client to work with the auto-completion feature in the ksh shell. I do a listing on the root with the directories /home and /homeroot and it returns ...
-3
votes
1answer
24 views

How to get started with shell scripting? [closed]

My job profile requires a certain level of shell scripting and I have no idea on how would i get started with it Please suggest me with the easy ways to getting started with shell scripting. Thank ...
0
votes
0answers
6 views

Axel usage with script on UBUNTU

I write a shell-script to download files via axel but always I get a 403 FORBIDDDEN error. At the same time I copied the axel command which generated by my script to terminal manually and it works ...
0
votes
2answers
44 views

How to tell what are my startup files for sh or bash?

From this question I understand that depending on the operating system sh and bash behave differently. Doing env and alias I can tell that: Every time I open a OSX Terminal or run bash the variable ...
1
vote
1answer
564 views

The application “SomeApp.app” can’t be opened

Problem: after downloading an application in OS X Yosemite (10.10.x) trying to open the application (either from the command-line or by double-clicking the application) produces an "The application ...
1
vote
0answers
35 views

Shell Commands not working : REDHAT

I added some service to the startup script and then after reboot , i got this message- 24 package(s) needed for security, out of 52 available Run "sudo yum update" to apply all updates. -bash: id: ...
2
votes
1answer
45 views

Execute command after broken SSH connection

Is there a way to execute a command after an SSH connection is broken (blackout etc.)? When I normally log off I can just use .bash_logout but I don't know what to do when my connection breaks.
1
vote
1answer
63 views

Can't find the good Cygwin shell executable

I am working on Windows 7 and I need Cygwin for my project. I am trying to launch the Cygwin terminal from a Java programm and then write command lines but my problem is that I can't find the right ...
1
vote
1answer
16 views

bash: history -a not writing unless HISTFILE already has text

Problem statement I've been following numerous examples for doing creative things with bash history along the lines of: # simplified example PROMPT_COMMAND='history -a; history -c; history -r' ... ...
0
votes
1answer
21 views

Double SSH and execute interactive shell

I need a bash script to ssh into server a then server b then execute an interactive shell. This is what I have: ssh -t -t server-a.com exec "ssh -t -t server-b.com <<<EOF cd ...
2
votes
1answer
57 views

How to save user made zsh shell functions and aliases

Shell beginner here! I'd like to create aliases and functions in zsh shell to speed up my workflow. For example: tw() { open -a //Applications/Textwrangler.app "$*"; } The function itself works, ...
3
votes
1answer
44 views

How to sort the output of find? [duplicate]

I'm using the find command to list files with their name containing a string: find ~/ -type f -name "*inductive*" I would like to use a pipe to sort the resulting list of files. I would like to be ...
0
votes
0answers
7 views

Let ctrl-c end entire fish function instead of one command in the function?

When executing a multi-line fish function, is there a way to let ctrl-c terminate the entire fish function instead of terminating just the currently running command in the function and letting the ...
0
votes
1answer
30 views

How to upload all the files from local to host using Curl?

i have written a shell script to upload all files with different names in the specific path from local to host, but i have facing some issue and the files are not getting uploaded #!/bin/sh for file ...
1
vote
3answers
32 views

Extract a word from a string in shell script

I have a string as $sea = xyz-ajay-no-siddhart-ubidone-fdh-DMJK.UK.1.0-32133-Z-1.tgz and i want to extract only DMJK.UK.1.0-32133-Z-1 and search string will be DMJK I tried like echo $sea ...
69
votes
8answers
38k views

Reload a Linux user's group assignments without logging out

When assigning a user's secondary group list using: # usermod -G <grouplist> <user> is it possible to force this group assignment to take effect without logging out all running ...
1
vote
2answers
4k views

Mac Terminal showing bash instead of my username

This makes it hard to know what directory I am in. I installed a version of python for school and now it says -bash-3.2$ instead of MyMacbook: ~$. I'm sure this is really simple, but I know nothing ...
4
votes
3answers
16k views

What does ~ mean in a Linux shell?

I'm new to Linux and have been seeing this often. Could someone explain the concept here? ~/.somefilename What does the ~ (tilde) signify?
0
votes
0answers
26 views

Running 'su - user sh -c “~/.profile”' returns “No such file” error

I have a shell script running as root with the following command: ssh remotehost 'su - user sh -c "source /home/user/.profile; <command>"' I get the following output: bash: su - user sh -c ...
0
votes
1answer
11 views

Call MATLAB installed on network drive from Cygwin shell script

MATLAB is installed on a network drive, and I want to call it from a shell script. The installed location is \\apps\matlab2014b$\bin\win64\MATLAB.exe in P:\. I am using Cygwin to run the shell ...
2
votes
2answers
50 views

How to change the default shell in Cygwin?

I am trying to change my default shell from bash to zsh in cygwin. The normal unix command chsh isn't available on cygwin The etc/passwd file it seems isn't used anymore in existing versions of ...
0
votes
0answers
6 views

How to stop control/focus leaving the terminal when I start a GUI application

I have a Ruby script that launches Image viewer (eog) based on certain keyevents from the user. However Focus leaves the terminal(cursor stops blinking) when the first input is given. Until I click ...
0
votes
0answers
10 views

Why is OfflineIMAP working in reverse on my inbox?

Noticing some weird log messages coming out of offlineimap when I make my periodic sync, after I spent all night syncing all my messages down from Gmail. Here's an example of one of them: Folder ...