I used the script command immediately after I started the terminal, it started recording my current session but when i used ps command after that it is showing only two processes, one for bash and one for ps itself but it is not showing any process for the script command that is running in the background, why is it so? Speaking in a more general way actually I have never seen the ps command showing more than 2 processes on my terminal, is there something wrong with my shell or terminal settings? I am currently using Ubuntu.


There is nothing wrong with your terminal or your shell. By default, ps shows processes with the same effective user identifier as the user running it, and associated with the same terminal. This typically results in only two processes showing up: the current shell, and ps itself. If there are any background processes associated with the current terminal, they will show up too; you can see this by running

sleep 120 &

To see all processes, run

ps -e

There are a number of other process selection flags, see man ps on your system for details.

When you run script, it allocates a new terminal and starts a new shell; so ps inside script is running on a different terminal (even though it’s in the same terminal window on your system, or on the same virtual console). That’s why you don’t see script. You can see this happen by running tty before and after running script: you’ll see it output two different values.

  • hey man i am not able to understand your answer, can you explain in more easy way ,sorry i am a newbie in LINUX – Noshiii Dec 18 '18 at 17:58
  • the script process is running on the same shell on which i typed ps , still it is not showing this process – Noshiii Dec 18 '18 at 17:59
  • Your script process is running in the same terminal window, but it’s not running the same shell and it’s not running in the same terminal. I’ll revisit my answer in a little while to explain things further, if no one else beats me to it. – Stephen Kitt Dec 18 '18 at 18:01
  • thank you so much i get it , just one last thing can you please explain the difference between terminal ,shell and terminal window i am a bit confused – Noshiii Dec 18 '18 at 18:09
  • That’s explained here — the answers may seem daunting but it’s worth taking the time to read them. – Stephen Kitt Dec 18 '18 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.