Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
The problem statement, all variables and given/known data:
What single command line would you enter to get the following output?
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/./
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/text/../
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/word/../
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/paper/../
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/test/../
(The tricky part.. the code must include the "/../" in the output. In other words, special parameters are required.
2. Relevant commands, code, scripts, algorithms:
ls -il
ls -laFh
The attempts at a solution (include all code and scripts):
cmcmille@dmazzola.com[188]: ls -laFhil /../
total 1069
3 drwxr-xr-x 25 root root 26 Jan 7 08:33 ./
3 drwxr-xr-x 25 root root 26 Jan 7 08:33 ../
1368 lrwxrwxrwx 1 root root 9 Jan 20 2009 bin -> ./usr/bin/
2484 drwxr-xr-x 3 root sys 3 Jan 20 2009 boot/
5609 drwxr-xr-x 2 root nobody 2 Jan 26 2009 cdrom/
1369 drwxr-xr-x 17 root sys 280 Jan 23 19:44 dev/
2818 drwxr-xr-x 9 root sys 10 Jan 7 08:22 devices/
45 drwxr-xr-x 87 root sys 248 Feb 6 14:52 etc/
6 drwxr-xr-x 2 root root 2 Jan 20 2009 export/
5565 drwxr-xr-x 39 root root 39 Jan 21 12:49 home/
2564 drwxr-xr-x 15 root sys 15 Jan 20 2009 kernel/
1478 drwxr-xr-x 8 root bin 247 Jan 7 04:26 lib/
1486 drwxr-xr-x 2 root sys 2 Jan 20 2009 mnt/
154794 dr-xr-xr-x 1 root root 1 Jan 7 08:22 net/
1487 drwxr-xr-x 7 root sys 7 Jan 24 2009 opt/
2429 drwxr-xr-x 25 root sys 43 Jan 7 02:30 platform/
1488 dr-xr-xr-x 54 root root 469K Mar 15 21:11 proc/
151749 drwx------ 4 root root 9 Feb 6 10:46 root/
4 drwxr-xr-x 4 root root 4 Jan 24 2009 rpool/
1489 drwxr-xr-x 2 root sys 52 Jan 7 04:26 sbin/
5598 drwxr-xr-x 3 root root 3 May 11 2011 space/
1494 drwxr-xr-x 4 root root 4 Jan 20 2009 system/
1497 drwxrwxrwt 7 root sys 2.6K Mar 15 16:23 tmp/
7 drwxr-xr-x 43 root sys 57 Jan 7 00:48 usr/
5 drwxr-xr-x 44 root sys 44 Jan 20 2009 var/
155630 dr-xr-xr-x 6 root root 512 Jan 7 08:23 vol/
Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Arizona State University, Tempe, ASU, Mazzola, CIS 494
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Reference the sample directory listing in post #1 section 1.
Interestingly all the directories have the same inode number (the first field) but you would only find the first directory with a find /filesystem -xdev -inum 8140 command because "find" ignores the ".." directory.
The links count is 9 when you would expect it to be 6, therefore there are 3 more directories with this inum somewhere.
We can forget using the inode number.
The sample directory listing is not in alphabetic order. There is no single "ls" command which could produce this output ... unless perhaps there is a hidden timestamp and the "-t" parameter was used or you have a version of "ls" where you can turn off the sort.
The sample includes the path name in the file field. You can only get this from "ls" if you specified the path on the "ls" command line.
Therefore I think that the sample came from 6 individual "ls" commands.
For example:
ls -liadp sample/text/\.\.
8140 drwxr-xr-x 9 root bin 18 Jan 20 2009 sample/text/../
Note: I don't have the same version of "ls" as you. If you haven't got "-p", then "-F" is just as good. I haven't got "-h" (human readable) at all.
I was wondering more: to what point do you call something you type at the prompt "single command line"...
For I dont get how it is possible to display the 2 first lines with the following...
Unless you have find with fancy options we dont know...
Here are variants on ONE line:
lo4:/export/home/vbe $ ls -lrhid sample"/./";ls -lidhFR sample/*/.*| grep 2711
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/./
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/paper/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/test/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/text/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/work/../
lo4:/export/home/vbe $ ls -liRdF sample/.* |grep 2711
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/./
lo4:/export/home/vbe $ for i in sample sample"/." sample/*/.* ; do ls -lidRF $i|grep 2711;done
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/./
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/paper/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/test/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/text/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/work/../
lo4:/export/home/vbe $ for i in sample sample"/." sample/*/.. ; do ls -lidF $i;done
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/./
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/paper/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/test/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/text/../
2711 drwxr-xr-x 6 vbe sysdso 6 Mar 16 16:02 sample/work/../
Are you sure you understood with what we are to solve (just ls or find?...)?
Thrcky bit is not much /../ but to get / , /./ and /../ together in one pass... It has to do with th inode itself but its friday I am a bit tired... and lack of imagination at the time...
@vbe
Certainly agree with joining the commands with semi-colon to keep them on the same line, but I think that every directory has to be mentioned separately to achive the exact (unsorted) order of the sample in post #1 item 1.
... unless someone has another idea.
@methyl,
I missed that (did not notice the obscure unsorted... )You are right, specially when all points to the same directory... (so one timestamp ?)
Are we getting old and forgotten some obvious facts in relation with inodes???
What puts me off is that the layout is one of ls command... so it must be a construct finding what to ls...
I can't match it without using 6 separate "ls" commands. Unless there is some hidden order (like a timestamp) which was visible before the files got old.