- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- null and/or random devices ?
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
Forums
Discussions
Discussions
Discussions
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
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
12-16-2005 06:06 AM
12-16-2005 06:06 AM
what is null devices ? and its use ? any example plz
what is random devices ? and its use ? any example plz
Regards
Maaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 07:02 AM
12-16-2005 07:02 AM
Solutionls -la > ls.out 2> /dev/null
In this example, you redirect the errors to /dev/null, so it's ignored.
Another use is to test the performance of somethig, like this:
dd if=/dev/hda1 of=/dev/null bs=1024 count=10000
This example will read the data from the disk and write to nothing, so, you can get a more accurate estimation of the read rate.
Random devices are normally used by cryptography, like gnupg, to generate random characters. When you create a certificate (make testcert), or a public key pair (ssh -keygen), you are using a random device, normally /dev/random.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 07:05 AM
12-16-2005 07:05 AM
Re: null and/or random devices ?
Example - cron:
# Run the disckcheck script
30 6 1 * * /usr/local/bin/diskcheck >/dev/null 2>&1
That will re-direct STOUT and errors to /dev/null - else it would go to an email...
Another in a script - checking the return signal of a command:
ps -aef | grep -v grep | grep mbtsk > /dev/null
if [ $? -ne 0 ]
then
# No mbtsk, so no Oasis.
exit 0
fi
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2005 06:18 AM
12-17-2005 06:18 AM
Re: null and/or random devices ?
Ivan Ferreira u wrote:
ls -la > ls.out 2> /dev/null
in the example above the output is redirecting to a file "ls.out" and as well as to /dev/null ... m i right ?
may i ask why u use "2" i.e instead of "...> /dev/null" why u wrote "...2> /dev/null"
and should i have to create /dev/null via mknod command ?
Regards
Maaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2005 08:39 PM
12-17-2005 08:39 PM
Re: null and/or random devices ?
It means:
redirect the output to a file named ls.out
redirect the errors (STDERR) to /dev/null
basically: you don't wish to see errors that might occur during the "operation".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2005 02:09 AM
12-18-2005 02:09 AM
Re: null and/or random devices ?
0 = stdin (standard input)
1 = stdout (standard output)
2 = stderr (standard error)
">" means "stdout" redirection, while "2>" means "stderr" redirection.
">&" writes the output of one stream into another. Taking Geoff's example:
... >/dev/null 2>&1
- redirect "stderr" (2) to "stdout" (1)
- redirect "stdout" to "/dev/null"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2005 05:09 AM
12-18-2005 05:09 AM
Re: null and/or random devices ?
Rgrds
Maaz