ArticleslgStudy

science

Touch (command)

Touch (command) is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Touch (command) rather than just read about it. In short: touch is a shell command that sets the modification timestamp of an existing file to be current – which on a Unix-based file system includes special files such as directories. If the input path does not specify an existing file, then it creates a new, regular file at the path.

Touch (command) — main illustration
Touch (command) — illustration

Key takeaways

  • Touch (command) belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Touch (command) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Touch (command) from memory before moving on to harder problems.

Reference excerpt

touch is a shell command that sets the modification timestamp of an existing file to be current – which on a Unix-based file system includes special files such as directories. If the input path does not specify an existing file, then it creates a new, regular file at the path. The Single UNIX Specification (SUS) specifies that touch changes the access or modification timestamps, or both. The file is identified by file system path supplied as the sole argument. If the path does not specify a file, the command creates a file with access and modification timestamps as specified or by default to the current time. By default (no options specified), touching a file is equivalent to creating it with no content or if it exists, opening and saving it without any content changes to update the modification timestamp to be current. This convenience functionality is useful for a variety of scenarios including build and backup. The tools used in such scenarios typically ignore files that are older than a certain point of time. For example, make ignores a source code file that is older than the object file it is used to create. The command is often used to create a new file, so that can subsequently open it in an editor or to create a file required by an operation that does not require specific content. A touch command first appeared in Version 7 AT&T UNIX. Today, the command is available for many operating systems, including many Unix and Unix-like systems, Windows (via UnxUtils and Touch for Windows.), classic Mac OS, MS-DOS, FreeDOS, DR DOS 6.0, KolibriOS, FLEX, AROS, OS-9, ReactOS, and IBM i. The version bundled in GNU Core Utilities was written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith.

See also System time List of POSIX commands

References

Further reading McElhearn, Kirk (2006). The Mac OS X Command Line: Unix Under the Hood. John Wiley & Sons. ISBN 978-0470113851.

External links

touch – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group touch(1) – Linux User Commands Manual touch(1) – Plan 9 Programmer's Manual, Volume 1 touch(1) – Inferno General commands Manual examples showing how to use touch

Worked examples

Example 1 — a first encounter with Touch (command)

Start with the simplest possible case. Write down what Touch (command) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Touch (command) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Touch (command) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Touch (command)

In research
Touch (command) appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Touch (command) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Touch (command) is common in secondary-school and first-year university syllabi. It links to neighbouring topics IBM i Qshell commands, Inferno (operating system) commands, Plan 9 commands, so understanding it makes those chapters shorter.
In everyday life
Look for Touch (command) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Touch (command)” →

How to study Touch (command) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Touch (command) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Touch (command) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Touch (command) in simple terms?

touch is a shell command that sets the modification timestamp of an existing file to be current – which on a Unix-based file system includes special files such as directories. If the input path does not specify an existing file, then it creates a new, regular file at the path.

Why does Touch (command) matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Touch (command)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Touch (command).

Tags

  • IBM i Qshell commands
  • Inferno (operating system) commands
  • Plan 9 commands
  • ReactOS commands
  • Standard Unix programs
  • Unix SUS2008 utilities

Keep exploring