[Bulk] Re: The name "grep"

Polytropon freebsd at edvax.de
Tue Jul 8 00:38:57 UTC 2014

On Mon, 07 Jul 2014 19:30:41 +0200, Ralf Mardorf wrote:
> Yes, I agree with "dd [options] -i infile -o outfile" - Polytropon, but
> there's a difference between cp/mv and dd.
> You can not copy or move e.g. a MBR, but you can dd a MBR. A superuser
> could damage the system with mv and cp too, but dd anyway is operating
> on another level.

This is because cp and mv operate on files (on file system level),
in contrast to dd which can _also_ operate on the next lower level
(on device level), which makes it an excellent tool of messing
things up when used with fat fingers. I know this. :-)

An alternative approach would have been to create pseudo-files for
device-level "entities", such as /proc represents processes and
even more. See for example what Plan 9 from Bell Labs did. So
it could be possible to have a file, say /dev/da0.mbr, which
would allow access to the MBR of the first disk:

	% cp /dev/da0.mbr /var/backup/mymbr

The "funny" part starts with

	% rm /dev/da0.mbr
	% mv /dev/da0.parttable /home/bob

because there are much more questions open... :-)

> Sometimes the FreeBSD syntax IMO goes much to far, for example I
> compared ls from FreeBSD and Linux.
> $ uname -a
> FreeBSD freebsd 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
> $ ls -hAl ~/.xsession-errors
> -rw-------  1 rocketmouse  rocketmouse   4.0k Jul  7 19:20 /home/rocketmouse/.xsession-errors
> $ ls .xsession-errors -hAl
> ls: -hAl: No such file or directory
> .xsession-errors
> $

As mentioned before, we see "DOS/JCL positional parameters" here,
as written in "man ls":

	ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [-D format] [file ...]

The file argument has to follow the options.

> [rocketmouse at archlinux ~]$ uname -a
> Linux archlinux 3.15.3-1-ARCH #1 SMP PREEMPT Tue Jul 1 07:32:45 CEST 2014 x86_64 GNU/Linux
> [rocketmouse at archlinux ~]$ ls -hAl ~/.xsession-errors
> -rw------- 1 rocketmouse rocketmouse 1.4K Jul  7 19:26 /home/rocketmouse/.xsession-errors
> [rocketmouse at archlinux ~]$ ls .xsession-errors -hAl
> -rw------- 1 rocketmouse rocketmouse 1.4K Jul  7 19:26 .xsession-errors
> [rocketmouse at archlinux ~]$

If you have manpages on that system, just see if "man ls" mentions
something different - obviously the _implementation_ of how program
arguments are being processed is different.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list