In the example above I am adding that separately, but there is nothing stopping us from doing just cat /proc/$$/comm All we need is to provide shell's PID, which is what $$ does. The name of the process and command-line parameters are displayed in /proc//comm. Here we take advantage of /proc/ filesystem. We will need to approach this from another perspective - the perspective of a process, which is something I've covered in Am I using bash or sh? $ echo $$ The variable $SHELL won't change, because that's not its purpose - it shows default not current value. We were originally in bash, but started interactive session of /bin/dash, Ubuntu's POSIX or system shell. Assuming you are using default configuration and haven't called another shell explicitly as a command, it is sufficient to do: echo $SHELLīut of course this only shows default value. Getting the shell informationĮach user has a default shell assigned to them in /etc/passwd for their username. I recommend reading Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal? for more info on the specifics. Ctrl+ Alt+ F2 (or any of the 6 function keys) will open virtual console, aka tty. What you see when you press Ctrl+ Alt+ t or click on the terminal icon in GUI, that starts a terminal emulator, a window which mimics behavior of hardware, and within that window you can see the shell running. Originally terminal referred to actual hardware, but nowadays they're mostly software. Shells can also be non-interactive, for example a script starts non-interactive shell, or bash -c 'echo hello world' also starts non-interactive shell.īy contrast, terminal is the interface to shell ( though it could be another application as well). Shell is the command-line interpreter, specifically interactive shell is the prompt plus text field where you enter commands. Often these two terms are used interchangeably, but they are different things altogether. What do you mean by which? Click Help -> About is that it? – JoKeRįirst thing we need to have clarified is what exactly is being asked - find out the running shell or running terminal. Technically, for terminal emulator you don't even need a command, as stated in the comments: The value of pid later can be passed to ps -p -o args command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |