I am running some programs on both Debian and Fedora. When I ls the /tmp directory, I see many directories with extremely long name like


It seems to be related to PrivateTmp, but how can I remove them or move them to a less distracting location? (e.g. from /tmp/systemd-... to /tmp/.systemd-...) I want to try not to change the PrivateTmp option for every service.

  • 4
    I don't think there's a good way to do that... There's reasons for that to be under /tmp or /var/tmp (e.g. preserving the SELinux context)... The names are currently hardcoded in systemd, not sure they're going to change... I guess my advice here is to avoid using /tmp for things you want to find later using ls? Not sure what's your particular use case (or if you can avoid /tmp), anyways, leaving a comment in hopes it might be helpful...
    – filbranden
    Commented Apr 3, 2018 at 22:07
  • As filbranden says, you should probably avoid using /tmp for your files. Check to see if $TMPDIR or $TMP are set (or set them yourself) and use one of them. I generally use $TMPDIR if defined, then $TMP if defined, then fall back to /tmp
    – MERM
    Commented Mar 16, 2023 at 5:15


You must log in to answer this question.

Browse other questions tagged .