4

I've noticed that when running screen the process identified with it actually shows up in capitals.

Linux Debian Wheezy.

Here an example with me ssh'in into a machine, running screen -S test and then running top there.

me@host:~$ ps x
  PID TTY      STAT   TIME COMMAND
 4177 ?        S      0:00 sshd: me@pts/0
 4178 pts/0    Ss     0:00 -bash
 4260 ?        Ss     0:00 SCREEN -S test
 4261 pts/1    Ss     0:00 /bin/bash
 4813 pts/1    S+     0:00 top
 5891 pts/0    R+     0:00 ps x
me@host:~$

Is there any reason for this capitalisation? I don't think I've seen any other programs in capitals like this.

Screen lives on the filesystem as a lower case binary:

me@host:~$ which screen
/usr/bin/screen
me@host:~$ l /usr/bin/screen
-rwxr-sr-x 1 root utmp 402K Sep  4 05:07 /usr/bin/screen
me@host:~$ file /usr/bin/screen
/usr/bin/screen: setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0x035fa489e79088829da70a87252e4da70fc4a6bf, stripped
me@host:~$

If this is accepted behaviour or perhaps a new trend I'm not aware of?

  • this question (and a related one) is answered very neatly here. i found that answer by copy/pasting your question title into google. the link i followed was the second in the results list, but it probably would have been first if your question wasn't. – mikeserv Nov 23 '15 at 4:41
  • @mikeserv thanks for your quick reply, but the posts you mentioned do not really answer why caps is used. Why not something like 'screend' instead of a totally non-standard naming of using CAPS? – captcha Nov 23 '15 at 5:17
  • argv[0] is capitalised because that's what the developers chose to do. This question is little different from why is screen called "screen" and not "foobleblitz"? There is no reason, it's an arbitrary choice. – cas Nov 23 '15 at 5:36
  • @cas - come on. why not foobleblitz? – mikeserv Nov 23 '15 at 6:08
  • @mikeserv don't blame me, i didn't choose 'screen`. – cas Nov 23 '15 at 6:52
3

The developers chose to do this to simplify killing stray screen processes. Refer to the source repository: the change was made between versions 2.3 (February 25, 1991) and 3.1 (September 9, 1991), which includes these comments from CHANGES:

when the socket has been removed, send a SIGCHLD to the poor SCREEN 
process and it will try to recover. then try a 'screen -r' again.
all the socket stuff lives now in an extra file.

and from README:

screen -list
screen -ls
  Show all available sockets. If there are (DEAD???) sockets, you may consider 
  removing them. If there are sockets missing, you may send a SIGCHLD to its
  process 'SCREEN' and the process will re-establish the socket. (think of 
  someone cleaning /tmp thoroughly).

If they had not changed the name so thoroughly, there was the risk of users signalling the wrong process.

  • Nice research. Any idea whether the idea of capitalisation of a 'parent' process was more common at the time? I can't recall ever seeing this with other processes for a similar purpose. – captcha Nov 23 '15 at 10:05
  • I only recall noticing it for screen (I used process renaming a couple of years before, on a $dayjob application). – Thomas Dickey Nov 23 '15 at 10:14
0

According to the cron manpage and this message in Debian mail list,

When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists). The children copies of cron running these processes have their name coerced to uppercase, as will be seen in the syslog and ps output.

  • So does that mean that Linux filenames are not case-sensitive anymore then? That's bizarre.. – captcha Nov 23 '15 at 5:21

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.