- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cat /dev/null
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2002 02:31 PM
тАО06-07-2002 02:31 PM
blowing up, I just trying to zero out a file.
remsh hostsystem "cat /dev/null > /directory/file"
I've tried "\>" but it still blows up?
I've tried '>' but it still blows up?
Help
Thanks
Randy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2002 02:51 PM
тАО06-07-2002 02:51 PM
Re: cat /dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2002 03:05 PM
тАО06-07-2002 03:05 PM
Re: cat /dev/null
command to the screen. It isn't working in
a script either using the same syntax :(
Randy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2002 03:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2002 03:49 PM
тАО06-07-2002 03:49 PM
Re: cat /dev/null
The problem is the > character which has special meaning to the shell. The apostrophe (single quotes) turns off the special meaning of all characters in the string. Although you wanted the > redirection to take place on the remote system, the shell steps in first to evaluate any special characters. Another way to escape the > character is:
remsh hostsystem "cat /dev/null \> /directory/file"
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2002 06:02 PM
тАО06-09-2002 06:02 PM
Re: cat /dev/null
Try cat /dev/zero instead. It produces a constant stream of zeros, and works on nearly all unixes.
Also, try using single quotes instead of double quotes. ie: remsh remotesys 'cat /dev/zero > /tmp/fred'
The single-quoted string will not be interpreted by the shell at all, where double-quoted strings will ($VAR's are expanded, among other things).
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2002 07:10 PM
тАО06-09-2002 07:10 PM
Re: cat /dev/null
Actually a better syntax for zeroing out a file is:
# > /dir/filename
It will accomplish the same thing as 'cat /dev/null > /dir/filename'
While /dev/zero is useful for some things, I don't know how usefule it would be for zeroing out a file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2002 07:15 PM
тАО06-09-2002 07:15 PM
Re: cat /dev/null
Do NOT use cat /dev/zero to a file because this will cause a "blank" zero'ed-out file to be created to the maximum size your filesystem can contain. In otherwises, the "zero'ing" won't stop until your filesystem is full. This applies to the cp (copy) as well.
/dev/zero should not be used to create an empty file (which is often used as a lock file) because it doesn't. /dev/zero's purpose is for wiping out disks and media using the dd command (for security reasons) i.e.
# dd if=/dev/zero of=/dev/rdsk/c3t4d0
If you want to create a zero-size file, then you can use one of the following methods (not exhaustive):
# cp /dev/null /tmp/empty_file
# cat /dev/null > /tmp/empty_file
# touch /tmp/empty_file
# > /tmp/empty_file
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 12:04 AM
тАО06-10-2002 12:04 AM
Re: cat /dev/null
this works: remsh hostsystem '> /directory/file'
Note the single quotes, they do the trick.
Also there is no need to use cat /dev/null. As cat reads exactly nothing (/dev/null) the result of the cat command is also exactly nothing. So nothing is redirected and not null like expected.
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:09 AM
тАО06-10-2002 06:09 AM
Re: cat /dev/null
I agree with the others here that '> filename' is the best way to zero a file.
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 09:14 AM
тАО06-10-2002 09:14 AM
Re: cat /dev/null
Lots of good stuff. And I've learned about
/dev/zero also. Points to be assigned!
Thanks and have a great day.
Randy