Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shell]

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

0
votes
0answers
9 views

Fast navigation in Midnight Commander Shell link mode

Is it possible to achieve the same behavior as on the local machine with Ctrl+O allowing navigating directly in shell, when connected to SSH server (Left / Right -> Shell link...)? Or is there any ...
0
votes
1answer
32 views

how unzip many zip files found in many subdirectories, all in a certain different directory

i have a list of zip files, which each zip file in it has also some other zip files, and so on. I need to extract them all, with an ubuntu shell command, and get only the files with the extension *....
0
votes
1answer
23 views

Usage of the percentile operator in shell scripts

In this link: https://superuser.com/a/180252/401901 The following command is used: cat list.txt | xargs -I % echo cp % new_folder What does the % % usage mean? All google search results are about ...
0
votes
0answers
22 views

Need Power shell command to get update list

Need a power shell command by which I can extract all updates list installed for Microsoft application. Note: only updates installed for application, not windows updates list. which can get by hotfix. ...
0
votes
0answers
29 views

Fish shell not clearing history completely when starting

EDIT: I figured out what went wrong! The root cause of it was my .bash_history file; that contained the commands! I've configured my fish shell to clear my fish history (because of personal ...
0
votes
1answer
18 views

The $1.gz exists in the folder, but it said cannot access, no such file or directory

I have a script that says gzip -cN "$1" > "$1.gz" | ls -l "$1.gz" | awk '{print $5}' I run it with an argument of ff, and I get the error message ls: cannot access ff.gz: No such file or ...
0
votes
1answer
21 views

Setup different path for fish shell temporally

User libraries are normally in /usr/local/lib. However I want to build some third party libraries in for example /Users/user/Public/lib. I only want to do it during my testing. Is there a elegant way ...
1
vote
1answer
24 views

Is it possible to use zsh in windows machines?

Is it possible to use zsh shell in windows along with console 2. If possible how can I install and configure it.
-5
votes
2answers
114 views

what does this bat file do?

I found a file with the following content that was on the flash: File What coding does it use? How to decode it?
0
votes
2answers
87 views

Loop and extract files matching a path

I am currently in a directory with many directories. $ ls the bad icons 100 the games icons 100 the beach & camping icons 100 the halloween icons 100 How can I extract ...
1
vote
1answer
91 views

How do I automate borg backup?

Background I would like to use Borg Backup as a backup solution for my Ubuntu server. They offer a very convenient sh script that they say you can just run as a cron job, but it is not working for ...
2
votes
1answer
41 views

Registry: Shell Open Command - Open multiple programs

I'm trying to register a shell open command via the registry and want to open more than one program, so I tried it like this: [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\myFile\Shell\Open\Command] @="cmd /k ...
0
votes
1answer
44 views

How to open a vpn channel (interactively) and keep the vpn session in background

[Archlinux 4.18.9] I have built a straightforward alias to connect to a cluster via vpn: alias clusvpn='sudo /usr/bin/openvpn --config client.ovpn' This include a specific /etc/sudoers entry so no ...
0
votes
1answer
32 views

Pipe stderr to file and screen without redirecting stderr to stdout

In a bash script I'd like to execute a command while piping the stderr to both a file and to the terminal. However, I want stderr to stay on the '2' file descriptor so that I can parse it from an ...
0
votes
0answers
64 views

Can use interactive shell in windows 10 [closed]

I am tryin to use tools that requires the interactive shell like expo, but it fails, for example when i try expo init tests i downloaded git from the webpage, and expo from expo.io npm install expo-...
0
votes
1answer
53 views

Execute a command in new interactive tcsh shell

How can I execute a pre-command in a new tcsh interactive shell? Ex: For mimicking bash -O globstar in tcsh we can do set globstar. However, I need to start a new tcsh shell with 'set globstar' ...
1
vote
2answers
35 views

mv files with multiple `.` in the file name

I have some files I receive with names like (to many to do this manually everyday): AA.B.txt WW.C.txt and I want to rename them to AA_B.txt and WW_C.txt so that existing SQL code still functions as ...
0
votes
0answers
30 views

Remove Wi-Fi known network from command line / net shell (profile not saved)

Is it possible to remove a Wi-Fi known network (see below) from the command line / net shell in Windows? Not a profile Known network from Windows 10: Settings -> Network & Internet -> WiFi -> ...
-1
votes
1answer
56 views

Allegedly good method to change the default shell in Cygwin doesn't work for me. Why?

I'm trying to get Cygwin (CYGWIN_NT-6.1 / 2.11.1(0.329/5/3)) to start with tcsh as default shell on Windows 7. I read this question and answers there but had some issues with the mintty method ...
1
vote
2answers
65 views

Is it POSIX-compliant to use a shell function in a pipeline?

Is it possible to use a shell function in a pipeline? Say I had a function that acted like grep, called mygrep. Is there any way, using only POSIX shell features, to be able to invoke mygrep like ...
3
votes
2answers
48 views

In Linux command manuals, what is the difference between having in the description a “short_option <comma> long_option” and “short_option long_option”

For instance, taking a look at man stat in the description, there's several options like: -L, --dereference and -c --format=FORMAT what is the difference with or without a comma? And how ...
2
votes
1answer
42 views

How do I check whether a CD is currently in use on Linux?

How do I check whether a CD is in use before I remove it from the VM? It's currently mounted on /dev/sr0 on a Ubuntu 14.04 machine and I need to unmount it for datastore migration. I know it's not ...
1
vote
1answer
76 views

How to send sudo password in a shell script

My shell script (don't have EXPECT, and is not possible) runs a shell script impersonating another user. Let's say the following script is named toto1.sh and is run with a user called MYUSERNAME1. #!/...
0
votes
1answer
35 views

How to execute .sh file (raspberrypi) that is present in someother folder

Sh file name: runme.sh Path: /home/pi-bridger/ I wanna run a .sh script that is under /home/pi-bridger/. I am able to run it inside the folder by using the command ./runme.sh. I wanna run the script ...
0
votes
0answers
31 views

How to write bash script that handles 3 different set of “inputs”

I'm trying to make my .sh file, able to accept 3 different ways of obtaining a path to a file plotted by the user. If no filepath / env-variable (how do I set this up properly?) is given as arg in ...
0
votes
0answers
14 views

Is it possible to provide SSH credentials for sourcetree via ssh -A xxx@123.456.7.89?

Is it possible to provide SSH credentials for sourcetree via ssh -A xxx@123.456.7.89 ? Meaning using the ssh client of my MacBook in SourcTree on my working desktop by forwarind the authentication ...
86
votes
10answers
19k views

What is the purpose of 'tee'?

All the usages of tee I ever saw were such: do_something | tee -a logfile Or: do_something_else | tee logfile Is tee invented for those that don't know you can do the same with shell pipe ...
1
vote
1answer
24 views

~/.bash_profile not source from symlinked login shell

If I call bash --login Then ~/.bash_profile is called. This seems as it should. I also have /bin/sh symlinked to bash $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Jun 22 2017 /bin/sh -> bash ...
1
vote
1answer
28 views

How to extract multiple urls from String?

I have a string like below https://website.com/BTAE/2015/BTAE assignment jan 15.pdf²0ÔË'\„QI„"ÙP¾^ŒŸZ‡@Æ*]Ü.^‚vðƒ€Ù¾»Æš©Šñ‘€é• ªÂIR#œÉgÉÛ^gMdÉ%9¬e˜Hžôb¿'0<ô ?lþzk…éÃÄórÈ;EW¦K³1…²ì¶ZFžŠÒô*ÄÖ\...
1
vote
2answers
40 views

How to merge multi-line output to form a single line?

I want to join different line output to a single line like below. $ cat new.txt | grep Full | awk '{print $1}' 09/01/2018 08/25/2018 08/18/2018 08/11/2018 08/04/2018 07/28/2018 07/21/2018 I want ...
0
votes
1answer
26 views

Perform SSH remote cmd exec on multiple local servers from input (sshpass?)

I am currently looking for a solution for executing remote commands on multiple local servers from an input file containing the 'user : password' in the following format: jboss5:manager:192.168.1.101 ...
0
votes
0answers
11 views

Where to find the meaning of each color coming out of `ls --color`?

Different shells have different colors for different things. Where exactly are those colors assigned? For example, when I ls, I get two similar files but with different color and I would like to know ...
1
vote
1answer
103 views

Passing a variable line by line into another command in Bash

I have code that reads a txt file and is supposed to read the lines from it into a command. Then, the output of that command should also be read line by line into another command. My outer loop works (...
0
votes
0answers
25 views

Translating ubuntu shell script into macOS shell script

I have the following shell script #!/bin/sh echo "$dev : $ifconfig_local -> $ifconfig_remote gw: $route_vpn_gateway" ip route add default via $route_vpn_gateway dev $dev table 20 ip rule add ...
0
votes
1answer
37 views

Bash: receive messages from background process

I'm sending data via cansend to vcan0, at the same time I'm listening to messages that has been send to vcan0 using the candump vcan0 command For some reason, i won't receive any messages, when ...
0
votes
0answers
12 views

How do I save style scheme for Windows terminal

I stylized my cmd and Ubuntu-on-Windows shells to look like default Ubuntu shell (colors and fonts). Every once in a while, this gets reset to the Windows default scheme and I have to recreate it ...
0
votes
2answers
101 views

Echo: Multiple commands

Hoi everybody, I am currently struggling with having to execute multiple commands in an echo. The following line is an example of the problem I am having: echo (cd .. && pwd) The idea is, ...
0
votes
2answers
87 views

Sending terminal commands via SSH connection: Nested pipes

Hoi everybody, I am currently having a problem with sending commands over SSH via command line to a server. To have an easy example, I always send the "pwd" command - which should return the current ...
0
votes
3answers
175 views

How to provide password directly to the sudo su -<someuser> in shell scripting

I got a requirement to automate in shell script for sudo su -<someuser> which asks for password. How to provide password directly to the sudo su - in shell scripting for IBM AIX servers. I have ...
0
votes
0answers
45 views

What does ***string*** mean in busybox sh?

I'm trying to put my own Linux distro on a discontinued and completely undocumented Android smart watch. (Not Android Wear, it's its own OS based on Android.) I've got control over a shell script (not ...
1
vote
1answer
71 views

Passing Multiple Password through SSHPASS

I have 3 Linux system. System_A System_B System_C I want to copy a file from "System_B" to "System_C", while being logged in from system System_A. Below code copies the file from "System_A" to "...
0
votes
1answer
41 views

Throttle piped command on OSX?

I want to throttle output from grep to run at most every X seconds. Specifically I want to do something like this: ping 8.8.8.8 | grep "No route to host" | throttle 3s | xargs -I % sh -c 'reset wifi'...
4
votes
0answers
42 views

Configuring Heartbeat to run shell script

I set up a high availability system with Heartbeat, I wish that when there was a drop in the main cluster and the secondary cluster was activated, Heartbeat start in it and execute a shell script. ...
0
votes
1answer
45 views

How to `export PATH` from C [closed]

Wondering how to accomplish one of these things from C, so that it persists like it would from ~/.bashrc or ~/.bash_profile: export PATH=~/bin:$PATH export PS1="$ " Wondering if I should use the ...
0
votes
2answers
67 views

Automatize multi-hop SSH and SCP with passwords

I want to access some host from my personal computer, but I have to access an intermediate server first, because the final destination cannot be seen from public internet. The thing is that I have to ...
1
vote
0answers
30 views

Detach a terminal from a process in D (uninterruptible sleep) state

I have a shell command in stuck in D state (imagine doing ls on a NFS share when the network is down). How do I detach from such a command? I can't kill the process in any way (well, it's called "...
0
votes
1answer
18 views

Bash script for Docker container in Windows returns “Unknown target”

I've downloaded a repository that contains a .sh script to open a Docker container. I'm running Windows 10 with Docker Toolbox (rather than the full version, which has some Hyper-V issues) and its ...
1
vote
1answer
25 views

Shell script: run screen, open several screens and run a command in each

Pretty much what the title says: My shell script should Run command A, wait until done run "screen" run command B1 in initial screen open new window (usually via Cmd-a-c) run command B2 in new ...
0
votes
2answers
31 views

Preview current directory in shell

What often happens when I work in a shell - zsh - is that I have cded somewhere and I want to have a quick look at the directory. Using ls may produce a lot of output and leaves it in the terminal. ...
1
vote
1answer
63 views

What does --) mean in bash's case struture?

I have seen a code snippet containing a case structure. while true; do case "$1" in --prepare) echo "prepare" ENV_PREPARE exit 0 ;; ...