What's the shell session?

7,760

Solution 1

Shell session is your current state/environment in the shell/terminal. You can have only one session in a shell/terminal.

Job is a process which runs in your shell.

You can list all your jobs by entering the jobs command.

E.g. when executing some process you can press Ctrl+Z and the previously running process will be suspended. You can then execute such commands as fg to bring it back to the foreground, or bg to run it in the background.

Solution 2

To see your current shell along with it's process ID, the process ID of parents and the process ID of current command use:

$ pstree -aps $$
systemd,1 splash fastboot kaslr
  └─lightdm,1050
      └─lightdm,1294 --session-child 12 19
          └─upstart,1883 --user
              └─gnome-terminal-,10481
                  └─bash,3612
                      └─pstree,15684 -aps 3612
  • $$ is the environment variable for the shell's process ID (3612).
Share:
7,760

Related videos on Youtube

lovespring
Author by

lovespring

Updated on September 18, 2022

Comments

  • lovespring
    lovespring over 1 year

    What's the shell session ?
    job seems like a process, is it?
    Can one shell prompt can manage multple shell sessions ?