For example, in this command:
ls /etc/rc0.d/ -print
ls /etc/rc0.d/ -printf
The outputs are quite different, why?
For example, in this command:
ls /etc/rc0.d/ -print
ls /etc/rc0.d/ -printf
The outputs are quite different, why?
Because you supplied different arguments :p.
print
is probably misleading in this case - those are individual parameters 'p', 'r', etc. You should check the man page for ls to find out what each parameter actually does.
Sorry, I didn't get what you mean?
What CarloM means, is that they are not a single "-print" or "-printf" options, but rather 5 of 6 individual option flags, equivalent to:
ls -p -r -i -n -t /etc/rc0.d/
ls -p -r -i -n -t -f /etc/rc0.d/
Ok, I see, actually I think the difference should happen for the �f'. But what I got is as follows, a lot of difference:
Henry@^_^> ls /etc/rc0.d/ -printf
263966 S30urandom 263974 S90halt 263969 S40umountfs
270822 README 263964 S10unattended-upgrades 263965 S20sendsigs
263967 S31umountnfs.sh 262250 ./ 263962 K74bluetooth
262145 ../ 263961 K20speech-dispatcher
263968 S35networking 263972 S60umountroot
Henry@^_^> ls /etc/rc0.d/ -print
total 4
263965 lrwxrwxrwx 1 0 0 18 2011-09-22 00:33 S20sendsigs -> ../init.d/sendsigs
263964 lrwxrwxrwx 1 0 0 29 2011-09-22 00:33 S10unattended-upgrades -> ../init.d/unattended-upgrades
263962 lrwxrwxrwx 1 0 0 19 2011-09-22 00:33 K74bluetooth -> ../init.d/bluetooth
263961 lrwxrwxrwx 1 0 0 27 2011-09-22 00:33 K20speech-dispatcher -> ../init.d/speech-dispatcher
263974 lrwxrwxrwx 1 0 0 14 2011-09-22 00:33 S90halt -> ../init.d/halt
263972 lrwxrwxrwx 1 0 0 20 2011-09-22 00:33 S60umountroot -> ../init.d/umountroot
263969 lrwxrwxrwx 1 0 0 18 2011-09-22 00:33 S40umountfs -> ../init.d/umountfs
263967 lrwxrwxrwx 1 0 0 22 2011-09-22 00:33 S31umountnfs.sh -> ../init.d/umountnfs.sh
263966 lrwxrwxrwx 1 0 0 17 2011-09-22 00:33 S30urandom -> ../init.d/urandom
263968 lrwxrwxrwx 1 0 0 20 2011-10-16 09:47 S35networking -> ../init.d/networking
270822 -rw-r--r-- 1 0 0 353 2011-12-15 14:40 README
From one example of man ls
, a man
page which you may wish to read on your system.
-f Interpret each argument as a directory and list the name
found in each slot. This option disables -l (ell), -r, -s,
and -t, and enables -a; the order is the order in which
entries appear in the directory.
Your correct command should probably be just:
ls -la /etc/rc0.d
Oh, I should really read the man page carefully...
Thanks a lot!
On your system the /etc/rc0.d
(and similar /etc/rc?.d
directories) are special in that they contain soft links to scripts in /etc/init.d
. By convention each script expects a parameter (e.g. start
or stop
or another system-defined value).
See man rc
.