Sponsored Content
Homework and Emergencies Homework & Coursework Questions Using ls or echo to display a specific output Post 302607995 by dasboot on Friday 16th of March 2012 12:15:23 AM
Old 03-16-2012
Using ls or echo to display a specific output

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
What single command line would you enter to get the following output?

Code:
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:
Code:
ls -il
ls -laFh


3. The attempts at a solution (include all code and scripts):

Code:
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/

4. 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).

Last edited by pludi; 03-16-2012 at 04:32 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Display from a variable using echo.

I have a variable that is outputting a lot of space. here has been 45 lines returned ... how can I remove the spaces between the "been and the 45" CODE: fil_len=`wc -l < coshb.txt` if ; then cat coshb.txt | more echo " " echo "There has been ${fil_len} lines... (4 Replies)
Discussion started by: jagannatha
4 Replies

2. Shell Programming and Scripting

what does echo $$ command display

whats the value stored in $$ (2 Replies)
Discussion started by: suri
2 Replies

3. UNIX for Dummies Questions & Answers

how to display specific lines of a specific file

are there any basic commands that can display lines 99 - 101 of the /etc/passwd file? I'm thinking use of head and tail, but I forget what numbers to use and where to put /etc/passwd in the command. (2 Replies)
Discussion started by: raidkridley
2 Replies

4. Shell Programming and Scripting

Display echo results in three column

Dear Friends, I have my command output which displays on one row and values are now scrollable (vertical) 3 pages. How do i display those output in three column so that i no need to scroll? Example: dcadd$cat components 1.Caluculator 2.Diary ... ... 50.Mobile 51.Battery .. ...... (12 Replies)
Discussion started by: baluchen
12 Replies

5. Shell Programming and Scripting

echo display problem

Hi I am facing a strange problem a=03 echo ${a} the output is 3 But i want to display it is 03 Can you people help me how to display it like 03. Thanks (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

6. Shell Programming and Scripting

Help with ksh script to display output with specific contents

This is Input - starts with Storage Group Name and ends with Shareable and the loop continues all I need is Storage group name and Alu numbers in the below output format requested. Storage Group Name: abcd Storage Group UID: 00:00:000:00:0:0:0 HBA/SP Pairs: HBA UID ... (6 Replies)
Discussion started by: maddysa
6 Replies

7. UNIX and Linux Applications

display which line returns specific output

Hi, I'm trying to figure out a way to find which line in my file.txt with IP addresses: 192.168.0.1 192.178.0.2 etc... returns specific result when I execute command affecting all lines. For example when I run: for line in `cat file.txt`; do snmpget $line done it displays the... (5 Replies)
Discussion started by: svetoslav_sj
5 Replies

8. Shell Programming and Scripting

display echo only once

lets say I am printing something out echo "Please enter a valid username" and its being printed out 5 times, is there any way I can limit to only being displayed ONCE. I tried echo -n but that just makes everything fit on one line. Right now it keeps saying Please enter a valid... (5 Replies)
Discussion started by: subway69
5 Replies

9. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

10. Shell Programming and Scripting

How do we display specific row of an output from bottom given line number?

I pass a number to my script. Passing "1" below. ./getfile.sh 1 echo "User entered: $1" ls -ltr *.conf | sed -n '$p' I wish to use ls -ltr i.e list files in ascending order of time the latest showing at the bottom of the output. Number 1 should get me the last row of ls -ltr output i.e... (9 Replies)
Discussion started by: mohtashims
9 Replies
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy