The Belfry
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
chraebsli@programming.dev to Programmer Humor@programming.dev · 1 year ago

Touch a file in Linux

programming.dev

message-square
14
fedilink
6

Touch a file in Linux

programming.dev

chraebsli@programming.dev to Programmer Humor@programming.dev · 1 year ago
message-square
14
fedilink
  • Björn Tantau@swg-empire.de
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Does anyone actually use touch for its intended purpose? Must be up there with cat.

    • funkajunk@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      TIL it’s actually for changing timestamps.

      https://www.man7.org/linux/man-pages/man1/touch.1.html

    • BestBouclettes@jlai.lu
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      The intended use of touch is to update the timestamp right?

      • Björn Tantau@swg-empire.de
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        Yeah. It could just as well have issued a file not found error when you try to touch a nonexistent file. And we would be none the wiser about what we’re missing in the world.

        • 4am@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          1 year ago

          “Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should touch waste your time?

          • Trailblazing Braille Taser@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            0
            ·
            1 year ago

            Because now touch does two things.

            Without touch, we could “just” use the shell to create files.

            : > foo.txt
            
            • deegeese@sopuli.xyz
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago

              Touch does one thing from a “contract” perspective:

              Ensure the timestamp of <file> is <now>

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 952 users / day
  • 3.3K users / week
  • 8.9K users / month
  • 19.9K users / 6 months
  • 1 local subscriber
  • 24.8K subscribers
  • 1.42K Posts
  • 32.2K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org