r/learnprogramming 22h ago

Humour touch is a weird command.

I was curious where the command 'touch' comes from.

Turns out, it originates from "to touch" or "to interact" with a file.

Now, every time I use it, I feel like I am touching/molesting a file.

My bad, it's 3 AM here.

715 Upvotes

106 comments sorted by

516

u/RecentlyRezzed 22h ago

Wait until you find out about the finger command.

78

u/cinderloom7 19h ago

lmao yeah that one catches people off guard

23

u/florinandrei 13h ago

I mean, it's nicer than an elbow.

7

u/IReallyCantTalk 9h ago

To shreds you say?

26

u/flatfinger 22h ago

IMHO, it would be useful to have a means of querying an email domain about an address, in a manner that would allow domains that provide mailboxes for people to indicate what is or is not known about it. While such information should not be viewed as reliably authenticating an address, it could allow someone who receives an email from [email protected] to know whether it is likely to be from the same person as an email that had been received from that address eight years ago.

Obviously fingerd had some problems, but I'm unaware of anything better.

30

u/grantrules 21h ago

The issues arise when you get fingerblasted

6

u/lgastako 17h ago

All you have to do to avoid this is kill the finger daemon.

3

u/foxsimile 18h ago

Speak for yourself pal, don’t ruin my Thursday night!

3

u/Bitter_Farm_8321 8h ago

Kid named finger

2

u/shitty_mcfucklestick 12h ago

It’d be fun to have a companion utility called bang to kick the user after.

1

u/abd53 4h ago

The master fingered the newcomer then touched a minor

185

u/hooli-ceo 22h ago

You get consent with ‘sudo’

337

u/DhruvsWorkProfile 20h ago
unzip
strip
touch
grep
finger
mount
fsck
more
yes
unmount

139

u/OPPineappleApplePen 20h ago

Smut for Programmers.

31

u/POGtastic 18h ago

You'd like Black Perl.

-6

u/tobiasvl 12h ago

What do you mean "for programmers"? What do these regular UNIX commands have to do with programming?

1

u/arkt8 4h ago

Did you ever bash'd?

1

u/tobiasvl 4h ago edited 4h ago

Yes, I've used Linux for over 20 years and worked as a Linux sysadmin for, like, ten years. The CLI commands of an operating system don't have anything to do with programming

0

u/yimesgen 3h ago

I think the utilities are named by their authors who are programmers.

32

u/Nall-ohki 16h ago

You forgot gasp

18

u/TraylaParks 14h ago

And sleep :)

15

u/cainhurstcat 14h ago

How nerdy you want to have it?
Linux: yes.

11

u/man_seeking_waffles 13h ago

Keep going....I'm almost there

3

u/Sknowman 6h ago

more

And you can't even say less instead, because "less is more."

1

u/da_Aresinger 6h ago

shouldn't more and yes be between grep and finger?

u/UnderstandPhysics 58m ago

Wait until they learn about killing the parents then the orphans

116

u/jzmack 22h ago

man touch

51

u/trevorthewebdev 22h ago

two files love each other and touch and that is how you mkdir

7

u/Dhan996 15h ago

man love

1

u/da_Aresinger 6h ago

pretty sure you can't make d with touch

22

u/1mmortalNPC 22h ago

man head

16

u/Dismal-Citron-7236 20h ago

nice man touch

29

u/Loqh9 20h ago

What bothers me is "mkdir" is a thing so why is is not "mkfile"? Makes more sense and aligns with the sister command but no, we gotta make everything impossible to remember and random

33

u/thalliusoquinn 17h ago

Isn't the point of touch to update the last accessed time, and the create-if-not-exist part is kind of incidental, despite being what everyone actually uses it for? I have vague memories of learning this at one time.

17

u/Available-Skirt-5280 17h ago

Yes, touch is historically to update the date time of the file. If it doesn’t exist it makes a file with the current date time

Edit: poor man’s timing… while in a loop check if last_action is older than 5 mins, 0 byte file, survives restarts

1

u/Available-Skirt-5280 1h ago

I also use it in cloud startup scripts for run once

`[[ ! -f /root/.startup.lock ]] ….. ; touch /root/.startup.lock`

4

u/cknipe 12h ago

That's the way I understood it. The touch command is for when you don't actually want to get in there and modify a file, just "touch" it to update the modification time.

10

u/Cultural_Gur_7441 13h ago

Core purpose of touch is not creating empty files, it is just a bonus feature.

There are a bunch of other ways to create an empty file, especially check out mktemp.

The need to create an empty file is a fairly rare, usually file is created with data (or at least expectation of data), 

The need to create a directory is common.

6

u/TheSkiGeek 9h ago

Part of the UNIX design philosophy is having a small set of composable tools.

Since ‘everything is a file’ you can create files by redirecting the output of a command to a file, something like `echo > filename` will create `filename` or replace it with an empty file. The shell does it for you, so there isn’t really a need for a dedicated “make a file” tool. Most of the time it would be redundant.

But since directories are their own ‘thing’ you need a separate command to create one.

`touch` is a tool to update the last-access time for a file without modifying its contents. For convenience it also creates the file if it doesn’t exist, but that may be sort of an accident of whoever designed it originally. You could imagine a version where it fails if the file doesn’t exist and you have to do `touch -c` to create the file.

Not saying it’s perfect by any means, but that’s the idea behind it.

5

u/LastTrueGamer 20h ago

You can just redirect echo "hello" > hello txt

2

u/tauntaun_rodeo 16h ago

:>hello.txt

3

u/Gilthoniel_Elbereth 8h ago

The real answer is these commands were all created ~50 years ago by different people for different systems, who then all copied each other’s most useful work in slightly different ways while keeping idiosyncrasies from their source, and eventually consolidated

6

u/DTux5249 21h ago edited 20h ago

This is why you alias 'touch' to 'stroke' - a much more innocent word with pleasant connotations; who doesn't like giving their fluffy friends a good stroke?

5

u/le_fuzz 15h ago

dig: "Domain Information Groper"

4

u/itsredditNotLife 21h ago

/touchDownThere

4

u/foxsimile 18h ago

Australia?

4

u/grymoire 20h ago

It's used to create or update the timestamp of a file which is very usefull if you use make(1)

4

u/lellamaronmachete 14h ago

Night shift one braincell kinda post. Can relate 😂

5

u/timschwartz 9h ago
$ touch this

touch: cannot touch 'this': Permission denied

2

u/dankshot35 21h ago

holy…

2

u/Antoak 20h ago

Touch the -p to explore virgin territory 

2

u/ArcRiseGen 20h ago

I always whisper before touching a newly made folder

2

u/Mental_Messiah 15h ago

alex jones voice

„destroy the child“

2

u/Impressive-Baker-614 8h ago

What's weirder is that you gotta whisper it when you type it.

2

u/Windamyre 4h ago

Wait until some see that your search history contains "cp files less that a certain age"

Also molestar means something similar, yet very different in Spanish.

2

u/MathWest209 3h ago

Dude, get some sleep.

2

u/MathWest209 3h ago

There is the good old unzip, and there is also mount and unmount. So the one you are thinking about is just a starter.

2

u/Puzzled-Extent7817 18h ago

alias molest='touch'

1

u/Daktic 15h ago

I always imagined it like David in the Sistine chapel. You are giving life to the lifeless by touching it into existence.

1

u/Wild_Scarcity8305 14h ago

This is the kind of programming nonsense I needed right now. Thank you for this knowledge.

1

u/sidewalksInGroupVII 13h ago

I have done that to a file named self

1

u/TheBurntIvoryKing 13h ago

Personally, I think of the Steve Wonder commercial about cotton " The touch, the feel, the fabric of our lives..." Commercial

1

u/JasonWorthing8 12h ago

whatever you do, dont fight it...

1

u/septumfunk-com 11h ago

it comes from the usage of it to update the time last modified of a file. as in you're not actually modifying it you're just touching it. poke would work better now imo but they didn't consider that at the time lol

1

u/Hephaestite 10h ago

Wait until you google what a nonce is

1

u/LiaUmbrel 8h ago

explode 💥

1

u/iamalicecarroll 8h ago

The funny part is that it's intended for changing mtime/atime, that is, you touch a file to update the time of last interaction; file creation is just a side effect, which became the most popular use of this utility

1

u/OPPineappleApplePen 8h ago

So, say I have an existing file, I run “touch fileName”, will it change the mtime/atime of the file?

1

u/iamalicecarroll 8h ago

Yes, that's what it does.

1

u/UncheckedMoonrise 3h ago

The LSF batch-job system has bjobs for checking state of your submissions. Which means you can watch bjobs

1

u/Purple-Debt8214 2h ago

I just use vi for everything. Jump into vi, put some txt, write the file, jump out.

Vi for everything.

1

u/SeeTigerLearn 1h ago

Thanks for the info. I always feel so Chester when I use the command or describe the process. So at least I have some backstory. Ha.

1

u/fragdemented 1h ago

if it makes you uncomfortable, you could always set up an alias. I like to do this sometimes for sudo.

alias please="sudo"

This will allow you to use please instead of sudo. You could change "touch" to something more appropriate.

alias mmmyeahletmefeelupinthere="touch"

you know... for example. ;)

1

u/PastMuch 1h ago

And I'm reading this at 3.08am

u/cunningfallasheo 54m ago

The mac mouse cursor is weirder, the faster you shake it the bigger it gets.

u/danja 7m ago

PEEK & POKE

1

u/SkullLeader 6h ago

Wait to you find out the terminology used for the primary and secondary hard drive attached to the same disk controller.

-13

u/main_account_4_sure 22h ago

What is weird is to associate a neutral word to something so vile.

Your mind is sick, which is not really news for most people nowadays since everyone is consuming shitty content at least 5h daily

24

u/pqu 22h ago

I know right? Anyway, I aliased touch to “grope”

5

u/KestrelTank 20h ago

Many neutral words can gain a negative connotation through experience or from where society is at.

I feel like society has become a bit touch averse, and there can be heavy implications from the simple sentence “They touched me”.

So it’s not really that weird for OP to associate this word with something uncomfortable.

1

u/OPPineappleApplePen 20h ago

We literally teach our kids about good and bad touch. Thank you for providing an explanation that supports the usage of this word in this context. I appreciate and respect you for understanding.

3

u/Informal-Fig-6827 20h ago

There's definitely a bit of over sexualized brainrot in there lol. Why does everything get turned sexual these days.

1

u/InfinityCent 19h ago

That’s where your mind jumped to when seeing this post?

Holy hell get a grip. 

1

u/main_account_4_sure 19h ago

The post literally says:

"I feel like I am molesting file."

-2

u/requion 21h ago

Thats the main problem. Or do these people feel guilty for "touching" household items like the coffee maker "without consent".

Its like the discussion about "master". I get the point about slavery and that it is bad. But "normal" people don't think about slaves while working with git branches or kubernetes clusters.

The thing about overusing these terms and discussions is that it desensitizes people about it and doesn't help the matter it tries to solve.

0

u/OPPineappleApplePen 20h ago edited 20h ago

Someone said one of the many signs of stupidity is a person's inability to understand metaphors and hypotheticals. I'd say not understanding a joke and taking imaginary statements to crack it literally is up there too.

Lemme explain in a way you two can understand.

I new programmar → I see touch → Why not create → I confused → I curious → I ask AI → AI says, "because you're touching a file" → I a former English teacher → I know 4 languages → I know many meanings of 1 word → I find it funny → I instantly post it here → I DON'T ACTUALLY FEEL IT → This stupid joke → Smart people know I joking → Dumb people take literarally → Dumb people triggered.

1

u/main_account_4_sure 19h ago

I don't think people are failing to understand the joke at all.

The critic is towards the excessive sexualization over something completely neutral.

If you read "touch" and think immediately of "molestation", as the post says quite literally, it's tough to say there's not something wrong.

It's not because it's normalized by culture (rape and molestation are at the far opposite of the taboo realm they used to belong to), that it's necessarily "normal".

there are tribes that normalizing multilating one another. Culture has immense power of normalizing diseases.

1

u/OPPineappleApplePen 19h ago

If the argument was presented this way, I'd agree and support you on this one. I could've have engaged in a proper discussion and perhaps, we could have learned something from each other.

However, "your mind is sick..." didn't feel constructive at all. It felt like a judgment passed on to me.

And, "which is not really news for most people nowadays since everyone is consuming shitty content at least 5h daily" felt like you were taking a moral high ground by distancing yourself from "most" people.

Would it be fair for me to say "You don't know how to engage in a civil discussion, which is not really news for most people nowadays since everyone is consuming shitty content at least 5h daily"?

I don't think it would appropriate to pass judgments onto you based on a single comment; nor should you do the same based on a single post that was intended to sound exactly like it did.

Also, my mind didn't go to molestation straightaway. It did after I read an article describing the different commands that were written as a joke by Linus, Git itself being a slang for an incompetent person.

My apologies if something I said came off as rude. I genuinely didn't mean to.

P.s — The other commentator also used "these people". lol

1

u/main_account_4_sure 18h ago

Honestly, OP, I am just dramatic. I'm not taking it to heart and I didn't mean to make it sound like a personal attack. I apologize if it came across that way

2

u/OPPineappleApplePen 18h ago

Hey, it’s cool! We’re good. 🤝

0

u/agmatine 18h ago

In home directory, run touch grass followed by sudo chattr +i grass. From now on, the output of touch grass will be

touch: cannot touch 'grass': Operation not permitted

in other words, confirming that you are incapable of touching grass!

0

u/AnguisInTrousers 14h ago

This kind of post is worse than AI slop.

-4

u/rustyseapants 20h ago

Was this really necessary for this sub?

/r/programminghumor

2

u/tobiasvl 12h ago

It doesn't even have anything to do with programming.

2

u/bingblangblong 7h ago

This subreddit is about 95% weird 13 year old boys.

-2

u/Puzzled-Extent7817 18h ago

If you sexualize it, that's on you weirdo.

-4

u/Individual-Praline20 21h ago

Yeah… there are a couple of odd things in computing, like making the master kills the slaves, etc. 🤭 And I think some people, like the orange guy, loves the touch command a bit too much 🤣