Linked Questions

79
votes
2answers
50k views

What is the difference between interactive shells, login shells, non-login shell and their use cases? [duplicate]

Possible Duplicate: Difference between Login Shell and Non-Login Shell? I have been looking at /etc/profile. bash.bashrc to see how they are run, and notice that some are executed by non-login ...
21
votes
1answer
18k views

login/non-login and interactive/non-interactive shells [duplicate]

Are the concepts of login/non-login shells the same as the concepts of non-interactive/interactive shells (respectively)? Or are the concepts orthogonal yielding four different combinations? I am ...
3
votes
1answer
2k views

difference between bash, -bash and /bin/bash in ps output [duplicate]

Someone had spawned a while true loop in bash (logged in as root) on a server. It kept spawning processes, which fortunately exited but I needed to kill the parent. I came to know it was spawned ...
1
vote
1answer
934 views

Different representation of bash in 'ps -f' command [duplicate]

I have two bash running; one is Terminal application that runs bash, the other one is xterm application that runs bash. With ps -f, I have -bash one, and bash at the other. What makes this ...
0
votes
1answer
389 views

How to make the command in /etc/profile be found? [duplicate]

Os: debian9. touch /home/test/test.log There is a simple function write-date in /etc/profile. write-date(){ date >> /home/test/test.log } Create a service running at reboot or ...
0
votes
0answers
73 views

Why script name ($0) is different when logged in over ssh? [duplicate]

When I open a terminal on my own computer and run echo $0, I get /bin/bash - which is the name of the executable being run. However, when I run echo $0 in an ssh session, I get -bash. Why? What does ...
-2
votes
1answer
38 views

The Shell initially Invoked After I Power On My Computer is Login or Non-login Shell? [duplicate]

I read multiple articles refering the login shell and non-login shell, still, I am very confused. Difference between Login Shell and Non-Login Shell? - Unix & Linux Stack Exchange The UNIX School: ...
32
votes
5answers
28k views

How is sudo set to not change $HOME in Ubuntu and how to disable this behavior?

On Ubuntu 12.04, when I sudo -s the $HOME variable is not changed, so if my regular user is regularuser, the situation goes like this: $ cd $ pwd /home/regularuser $ sudo -s # cd # pwd /home/...
37
votes
3answers
37k views

How to SSH into a specific directory?

I frequently login to a server, then cd into a specific directory. Is it possible to simplify these two commands into one? ssh bob@foo cd /home/guest I'd like to avoid changing anything on 'foo' ...
31
votes
5answers
67k views

Why doesn't my ~/.bash_profile work?

I'm using Linux Mint. My login shell (cat /etc/passwd | grep myUserName) is bash. After I start my graphical desktop environment and run a terminal emulator from it, I can see that .bash_profile is ...
30
votes
3answers
5k views

What's the best distro/shell-agnostic way to set environment variables?

The question says it all. I currently use Arch Linux and the zsh, but I'd like a solution that (at minimum) works both on VTs and in xterms and also (hopefully, preferably) will continue to work if I ...
13
votes
3answers
12k views

Why 'echo $0' gives different result for two different terminals?

I opened a terminal on Ubuntu using Ctrl+Alt+T and a different terminal by going to a directory and then right clicking and choosing "Open in Terminal". I did an echo $0 in both cases. In the ...
20
votes
2answers
53k views

Global bash_profile

I realize there are /etc/profile and /etc/bashrc files for setting global environment variables and maybe I'm just misunderstanding their purposes, but... Is there a global bash_profile file? I'm ...
8
votes
3answers
7k views

Insert empty line between command line prompts

When using the command line, often it gets very cluttered. Making it inconvenient to examine past commands and their outputs for example. I would like to have a newline added each time before the ...
10
votes
4answers
22k views

Complete view of where the PATH variable is set in bash

I've read in a couple of places that the PATH is set in /etc/profile or the .profile file that's in the home dir. Are these the only places that the path is set in? I want a better understanding of ...

15 30 50 per page