Questions tagged [shell]

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion. Not only does it allows the user to run programs from a text interface, but frequently offers basic programming features such as variables, substitution, output redirection, and wildcards.

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion.

Not only does it allows the user to run programs from a text interface, but frequently offers basic programming features such as variables, substitution, output redirection, and wildcards.

The name was first used by Unix operating system for an interpreter used for command prompt, but currently the term shell refers to BASH(Bourne Again SHell) and other command prompt interpreters too.

1348 questions
25
votes
4 answers

How do I ssh on slow/flaky connections?

I am dealing with a really slow shell connection. It is in the cloud and I am very far from the server. My connection also breaks sometimes as it is over the internet and I may also be using shared Wifi or 3G. Is there a way to see what I type…
Zombies
  • 515
  • 2
  • 6
  • 13
25
votes
9 answers

Running ssh-agent from a shell script

I'm trying to create a shell script that, among other things, starts up ssh-agent and adds a private key to the agent. Example: #!/bin/bash # ... ssh-agent $SHELL ssh-add /path/to/key # ... The problem with this is ssh-agent apparently kicks off…
Dan
  • 657
  • 2
  • 9
  • 13
25
votes
4 answers

How can I retrieve the absolute filename in a shell script on Mac OS X?

I'd like to retrieve the absolute file name of the script file that's currently executed. Links should be resolved, too. On Linux, this seems to be done like this: $(readlink -mn "$0") but readlink seems to work very differently on Mac OS X. I've…
Huxi
  • 361
  • 1
  • 4
  • 6
25
votes
3 answers

What is /usr/bin/[?

I was just poking around in /usr/bin and I found an ELF binary file called [. /usr/bin/[. I have never heard of this file and my first thought was that it was a clever way of hiding a program, possibly a trojan. However it's present on all my CentOS…
Josh
  • 9,190
  • 28
  • 80
  • 128
24
votes
2 answers

nologin in /etc/shells is dangerous.. WHY?

I found this on the internet, while putting up a FTP server in FreeBSD. Putting nologin into /etc/shells potentially creates a back door by which those accounts can be used with FTP. (see:…
Rob Audenaerde
  • 325
  • 1
  • 5
  • 16
24
votes
12 answers

How to determine if I'm logged in via SSH?

I'm currently setting up a fairly complex bash configuration which shall be used on multiple machines. I try to find out if it is possible to determine whether I'm logged in via SSH or on a local machine. This way I could, for instance, set some…
t6d
  • 527
  • 2
  • 5
  • 12
24
votes
7 answers

How to use my aliases in my crontab?

I have some commands in my .profile that I want to invoke from my crontab. For example, if I have, alias notify-me="~/bin/notify.pl -u user1" alias notify-team="~/bin/notify.pl -u user1 user2 user3 user4 ...." I'd like to just invoke the alias 0…
Keith Bentrup
  • 719
  • 3
  • 8
  • 19
23
votes
4 answers

How do I change my default shell on a domain account

I use a samba4 domain account to log in on my laptop. I wanted to try zsh out, but since my user doesn't reside in /etc/passwd I found that chsh can't find my user. Can anyone advise how I can change my login_shell? I couldn't see anything in my…
Rumbles
  • 994
  • 1
  • 12
  • 28
23
votes
2 answers

backslash at the beginning of a command

In Installing RVM manual I see a lot of lines starting with '\': Install RVM with ruby: $ \curl -L https://get.rvm.io | bash -s stable --ruby I'd think it is just mistype but they repeat it many times. So what is the reason?
Putnik
  • 2,217
  • 4
  • 27
  • 43
23
votes
9 answers

Make ls print it all on one line (like in terminal)

ls prints differently depending on whether the output is to a terminal or to something else. e.g.: $ ls . file1 file2 $ ls . | head file1 file2 Is there some way to make ls print out on one line as if it's to a terminal when it's not. There's a -C…
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
22
votes
5 answers

Powershell equivalent of Ctrl+R?

In bash I can do Ctrl+R and start typing a command to have it search my history. How do I do that in powershell? Is there a way to bind a key to something like? function GH($str) {get-history | select-string $str} But I would need to re-read the…
red888
  • 4,183
  • 18
  • 64
  • 111
22
votes
4 answers

How to generate gpg key without user interaction?

I found in https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html#Unattended-GPG-key-generation method to generate gpg keys without user interaction, but it doesn't seem to work. My script is: #!/usr/bin/env bash rm -rf…
eijeze
  • 427
  • 1
  • 5
  • 11
21
votes
4 answers

Count number of bytes piped from one process to another

I'm running a shell script that pipes data from one process to another process_a | process_b Does anyone know a way to find out how many bytes were passed between the two programs? The only solution I can think of at the moment would be to write a…
Simon Hodgson
  • 691
  • 3
  • 8
  • 15
21
votes
4 answers

How to edit command completion for ssh on zsh?

I'd like to set up command completion on zsh to display host names after I type ssh [TAB] taking the names out of my .ssh/config file (and preferably from known_hosts and /etc/hosts and anywhere else that makes sense) and presenting one single…
iconoclast
  • 1,800
  • 2
  • 18
  • 30
20
votes
4 answers

Shell = Check if variable begins with #

i would be thankfull if you could help me how to figure out, how to determine if a variable's content starts with the hash sign: #!bin/sh myvar="#comment asfasfasdf" if [ myvar = #* ] this does not work. Thanks! Jans
jan
  • 675
  • 2
  • 6
  • 8