<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: command difference in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507165#M892136</link>
    <description>John, Patrick,&lt;BR /&gt;&lt;BR /&gt;thanks for clearing that up for me, i never really gave much thought to it before...to think, i've been typing all those extra characters for years now...my poor carpal-tunneled hands. :-)&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 20 Mar 2001 15:49:44 GMT</pubDate>
    <dc:creator>James A. Donovan</dc:creator>
    <dc:date>2001-03-20T15:49:44Z</dc:date>
    <item>
      <title>command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507158#M892129</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Just wondering what is the different to reset a file to zero with the following commands.&lt;BR /&gt;&lt;BR /&gt;1.  cat /dev/null &amp;gt; file&lt;BR /&gt;2.  &amp;gt; file&lt;BR /&gt;3.  touch file&lt;BR /&gt;&lt;BR /&gt;All of the above seems to achieve the same purpose however for some log it is recommended to use &amp;gt; file instead of cat/dev/null what is the reason for this?&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Mar 2001 13:37:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507158#M892129</guid>
      <dc:creator>kholikt</dc:creator>
      <dc:date>2001-03-20T13:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507159#M892130</link>
      <description>&amp;gt; file causes the shell to truncate file&lt;BR /&gt;&lt;BR /&gt;The cat /dev/null does precisely nothing and so can be omittred.&lt;BR /&gt;&lt;BR /&gt;touch file doesn't truncate the file or change the file contents at all. It just (by default) changes the time it was last modified. However it will create an empty file if it didn't already exist.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Mar 2001 13:49:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507159#M892130</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2001-03-20T13:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507160#M892131</link>
      <description>The above answer is correct.  When I want to set a file to zero.  I copy /dev/null to the file.&lt;BR /&gt;&lt;BR /&gt;cp /dev/null file1</description>
      <pubDate>Tue, 20 Mar 2001 14:17:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507160#M892131</guid>
      <dc:creator>Joseph C. Denman</dc:creator>
      <dc:date>2001-03-20T14:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507161#M892132</link>
      <description>errr..if 'cat /dev/null' isn't supposed to work, then why does it work on mine?&lt;BR /&gt;&lt;BR /&gt;# echo "Testing"&amp;gt;test&lt;BR /&gt;# ll test&lt;BR /&gt;-rw-r--r--   1 root       sys              8 Mar 20 06:57 test&lt;BR /&gt;# cat /dev/null &amp;gt;test&lt;BR /&gt;# ll test&lt;BR /&gt;-rw-r--r--   1 root       sys              0 Mar 20 06:57 test</description>
      <pubDate>Tue, 20 Mar 2001 14:59:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507161#M892132</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2001-03-20T14:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507162#M892133</link>
      <description>To truncate/archive a file I use:&lt;BR /&gt;&lt;BR /&gt;mv file file.old&lt;BR /&gt;touch file</description>
      <pubDate>Tue, 20 Mar 2001 15:13:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507162#M892133</guid>
      <dc:creator>Tracey</dc:creator>
      <dc:date>2001-03-20T15:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507163#M892134</link>
      <description>Jim,&lt;BR /&gt;&lt;BR /&gt;It isn't the 'cat /dev/null' that truncates the file. It's the '&amp;gt; file' which is actioned by the shell that does the truncating before the cat process is forked.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Mar 2001 15:14:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507163#M892134</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2001-03-20T15:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507164#M892135</link>
      <description>The '&amp;gt; file' portion of the command line is basic output redirection.  If you recall the &amp;gt; tells the shell to always create a new file before writing any output to it.  &lt;BR /&gt;&lt;BR /&gt;If you did something like 'cat /dev/null &amp;gt;&amp;gt; file' then you wouldn't see any change in the file because &amp;gt;&amp;gt; says to append.  So John is correct when he says the /dev/null doesn't do anything.  If you want, just think of it as a place holder in the command so that you always use the command syntax you are used to (ie. 'cat filename &amp;gt; another_file') which is probably what most of us are used to.</description>
      <pubDate>Tue, 20 Mar 2001 15:25:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507164#M892135</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-03-20T15:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: command difference</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507165#M892136</link>
      <description>John, Patrick,&lt;BR /&gt;&lt;BR /&gt;thanks for clearing that up for me, i never really gave much thought to it before...to think, i've been typing all those extra characters for years now...my poor carpal-tunneled hands. :-)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Mar 2001 15:49:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/command-difference/m-p/2507165#M892136</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2001-03-20T15:49:44Z</dc:date>
    </item>
  </channel>
</rss>

