Godlike Productions - Discussion Forum
Users Online Now: 1,774 (Who's On?)Visitors Today: 429,600
Pageviews Today: 717,437Threads Today: 233Posts Today: 4,398
08:55 AM


Rate this Thread

Absolute BS Crap Reasonable Nice Amazing
 

Urgent help on Linux

 
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 06:21 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
if i want to go back to one directory
shouldn't i do

..

?
 Quoting: IMAX


NO! .. isn't a command! (hopefully)

cd is a command to change directories!!!
 Quoting: Anonymous Coward 35769388


oh silly me

if i want to display all files within a directory
(and it's sub dir) that are larger than 10k byts

should i use cat sample_dir | -n 10 tail
?
Display all the files within sample_dir
(and it's subdirectories) that are larger than 10k bytes:
 Quoting: IMAX


well first you need to understand the question:

Display all the files within sample_dir (and it's subdirectories) that are larger than 10k bytes

Because they have asked for all the BIG files, cat wouldn't be the correct answer. By "display" they must mean "give us the names of those files". Not "display their contents". You want the "ls" command.

You can read the manpage for "ls" and find the options that relate to file size:

man ls

and because the question mentions subdirectories, you should also see what man ls says about subdirectories.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 06:21 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
less phone_directory

then press "space" until you find Bruce

then make a note of his number

then press "q"
 Quoting: Anonymous Coward 35769388

^^This
 Quoting: IMAX

while using "less", you can use "/" to search for things in a linear fashion. just type "/" followed immediately by your search string, and then hit enter.
 Quoting: Anonymous Coward 33568463


you're absolutely right
but just like the Aussie Ac said...this assignment is asking for 1 answer

even if i asnwer it the way that anyother programmers would have answered it, and be it different than the answer on the assignment, it would say "Please try again"
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 06:25 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
you're absolutely right
but just like the Aussie Ac said...this assignment is asking for 1 answer

even if i asnwer it the way that anyother programmers would have answered it, and be it different than the answer on the assignment, it would say "Please try again"
 Quoting: IMAX

Yes for the answer, you should use "less" and "space" and "q". However, you still need to learn that you can search in a file using "/" because that is extremely useful. For example, if you read "man ls" the man command will use a pager to display one page at a time. That pager will probably be less on a Linux system (but it could be more, or anything else that the $PAGER environment variable is set to).

So if you run "man ls" and want to find info on subdirectories, you would then do "/subd" and see what turns up.
Anonymous Coward
User ID: 33568463
Belgium
03/10/2013 06:28 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
this assignment is asking for 1 answer

even if i asnwer it the way that anyother programmers would have answered it, and be it different than the answer on the assignment, it would say "Please try again"
 Quoting: IMAX

don't let an assignment limit your learning experience. start up a virtual machine with whatever unix you fancy, and start exploring its userland with the commandline. the more you mess up, the more you'll learn.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 06:34 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
if i want to go back to one directory
shouldn't i do

..

?
 Quoting: IMAX


NO! .. isn't a command! (hopefully)

cd is a command to change directories!!!
 Quoting: Anonymous Coward 35769388


oh silly me

if i want to display all files within a directory
(and it's sub dir) that are larger than 10k byts

should i use cat sample_dir | -n 10 tail
?
Display all the files within sample_dir
(and it's subdirectories) that are larger than 10k bytes:
 Quoting: IMAX


well first you need to understand the question:

Display all the files within sample_dir (and it's subdirectories) that are larger than 10k bytes

Because they have asked for all the BIG files, cat wouldn't be the correct answer. By "display" they must mean "give us the names of those files". Not "display their contents". You want the "ls" command.

You can read the manpage for "ls" and find the options that relate to file size:

man ls

and because the question mentions subdirectories, you should also see what man ls says about subdirectories.
 Quoting: Anonymous Coward 35769388


okay i now understand that the command should be ls -a sample_dir

but i want them to show the ones that are larger than 10k ... so i know -c is bytes

therefore


ls -a sample | tail -c 10
"please try again"

or ls -a sample_dir | tail -ck 10

i know i'm close

Last Edited by IMAX on 03/10/2013 06:40 PM
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 06:40 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
okay i now understand that the command should be ls -a sample_dir

but i want them to show the ones that are larger than 10k ... so i know -c is bytes

therefore
ls -a sample_dir | -c 10 tail
?

or ls -a sample_dir | -ck 10 tail
?

cuz both i get "please try again"

i know i'm close
 Quoting: IMAX


who said -c is bytes? please cut and paste that line from the manual.

furthermore, you can't pipe into -c, that is silly. -c isn't a command (hopefully).

* read man ls. find what it says about sorting by file size.

* get ls to give you a list of the files that is sorted by file size.

* figure out what they mean by "10K bytes"

* use head to get only the lines of output from ls where the file size is at least 10K bytes.
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 06:41 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
sorry i should have said "larger than 10K bytes", not "at least 10K bytes"
Anonymous Coward
User ID: 34200404
Australia
03/10/2013 06:58 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
try this OS if you come from Windows :

[link to zorin-os.com]
 Quoting: Anonymous Coward 913721


Shit. Linux is great but until they get.

1) A real alternative for Photoshop. Gimp is nowhere near the league of Photoshop either.

2) A real alternative to MS Outlook. Evolution or Sylpheed etc are shit. Might have exchange compatibility but look, feel, and user familiarity are non existent.

3) Definitely needs a "Native" version of MS office. Open Office is good but the way files created in MS Office is a bit of a lottery especially for complex styled or equated files. I don't like it but most of the world us MS Office and to use OO as viable alternative is risky.

4) All the best audio/video creation software such as pro tools, final cut and reaper etc in the world at best runs slow, flakey (Crippled) or even does not run at all under wine. They need native versions.

5) WINE ..... Hmmmmm I have had some good success getting things to work. I showed a friend who could be classed as an advanced Windows user how to do it and it was all too much for them and I was constantly and I mean constantly supporting them for free. In the end they gave up because they could achieve what they needed in a much shorter time in windoze without bothering someone else or waiting for a forum (although friendly) to reply and deliver the answer. Who has that time spare?

Apart from these issues Linux shits all over Windoze. If you can compromise (or can get away with it) and use "inferior" software to those mentioned above well "more power to you" go for it.

I love linux but accept it is nowhere near "Ready for the big time" and because of the above points is a deal breaker for many users who would otherwise find linux. I hate the domination big software companies mainly MS have over the world but guess what you are going to have to live with it. I would like change but it is not going to happen until all the guys write natively for Linux.

Get over it and realise one line post promoting something like that is BS that gets false hopes up and will not satisfy the bulk of the world's users.

Unless you want to be an elitist nerdy schmuck
Anonymous Coward
User ID: 23554071
United States
03/10/2013 07:02 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
so far so good...i can answer the rest of te questions

this one was confusing not just me , but for many

if i had another question ... ill post one
tomato
 Quoting: IMAX

So exactly does "head -300 ~bto120/phones > phone_directory" do?
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 07:07 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux


The "head" command outputs the first part of a file. The file in this case is ~bto120/phones. This is a file called "phones" in the home directory of user bto120.

The -300 should be -n 300, but due to the wackiness of the assignment software, they put -300. -n is the option to head which tells it how many lines you want from the start of the file. So head -n 300 is the first 300 lines of the "phones" file.

The greater-than sign is a redirect of the output of the previous command. > phone_directory means to redirect the output of the previous command to a file called "phone_directory" in the current directory.

So that command gets the first 300 lines of the "phones" file and puts those 300 lines into a file called "phone_directory".
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 07:14 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
okay i now understand that the command should be ls -a sample_dir

but i want them to show the ones that are larger than 10k ... so i know -c is bytes

therefore
ls -a sample_dir | -c 10 tail
?

or ls -a sample_dir | -ck 10 tail
?

cuz both i get "please try again"

i know i'm close
 Quoting: IMAX


who said -c is bytes? please cut and paste that line from the manual.

furthermore, you can't pipe into -c, that is silly. -c isn't a command (hopefully).

* read man ls. find what it says about sorting by file size.

* get ls to give you a list of the files that is sorted by file size.

* figure out what they mean by "10K bytes"

* use head to get only the lines of output from ls where the file size is at least 10K bytes.
 Quoting: Anonymous Coward 35769388

okay dude

i know I should be using the ls
ls -S
ls -hS
ls -lhS
but to make it show larger than 10K
i can't find the answer
i even try ls -S +10K .. etc

Last Edited by IMAX on 03/10/2013 07:17 PM
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 1339701
United States
03/10/2013 07:20 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
okay i now understand that the command should be ls -a sample_dir

but i want them to show the ones that are larger than 10k ... so i know -c is bytes

therefore
ls -a sample_dir | -c 10 tail
?

or ls -a sample_dir | -ck 10 tail
?

cuz both i get "please try again"

i know i'm close
 Quoting: IMAX


who said -c is bytes? please cut and paste that line from the manual.

furthermore, you can't pipe into -c, that is silly. -c isn't a command (hopefully).

* read man ls. find what it says about sorting by file size.

* get ls to give you a list of the files that is sorted by file size.

* figure out what they mean by "10K bytes"

* use head to get only the lines of output from ls where the file size is at least 10K bytes.
 Quoting: Anonymous Coward 35769388

okay dude

i know I should be using the ls
ls -S
ls -hS
ls -lhS
but to make it show larger than 10K
i can't find the answer
i even try ls -S +10K .. etc
 Quoting: IMAX


Try the find command
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 07:20 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
* read man ls. find what it says about sorting by file size.

* get ls to give you a list of the files that is sorted by file size.

* figure out what they mean by "10K bytes"

* use head to get only the lines of output from ls where the file size is at least 10K bytes.
 Quoting: Anonymous Coward 35769388

okay dude

i know I should be using the ls
ls -S
ls -hS
ls -lhS
but to make it show larger than 10K
i can't find the answer
 Quoting: IMAX


oh wait, you have to find the files in subdirectories over a certain size as well, so ls can't really do that.

you should probably use "find" which can find files over a certain size.

man find
Anonymous Coward
User ID: 1339701
United States
03/10/2013 07:35 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
or simply "cat phone_directory|grep "Bruce Byce"...
 Quoting: Anonymous Coward 33568463


grep "Bruce Byce" phone_directory

will suffice.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 07:37 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
* read man ls. find what it says about sorting by file size.

* get ls to give you a list of the files that is sorted by file size.

* figure out what they mean by "10K bytes"

* use head to get only the lines of output from ls where the file size is at least 10K bytes.
 Quoting: Anonymous Coward 35769388

okay dude

i know I should be using the ls
ls -S
ls -hS
ls -lhS
but to make it show larger than 10K
i can't find the answer
 Quoting: IMAX


oh wait, you have to find the files in subdirectories over a certain size as well, so ls can't really do that.

you should probably use "find" which can find files over a certain size.

man find
 Quoting: Anonymous Coward 35769388

BOOYYAA
and the answer is
find . -size +10k
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 07:39 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
BOOYYAA
and the answer is
find . -size +10k
 Quoting: IMAX


well done! did you figure that out by reading the man page?
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 07:49 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
BOOYYAA
and the answer is
find . -size +10k
 Quoting: IMAX


well done! did you figure that out by reading the man page?
 Quoting: Anonymous Coward 35769388


i did it by going through my lecture notes and man find
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 07:50 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
BOOYYAA
and the answer is
find . -size +10k
 Quoting: IMAX


well done! did you figure that out by reading the man page?
 Quoting: Anonymous Coward 35769388


i did it by going through my lecture notes and man find
 Quoting: IMAX


remember this:

ALWAYS READ THE MAN PAGE!!!

That is how you use a Linux or UNIX system. If somebody tells you that there is no need to read man pages, IGNORE THEM, THEY DON'T KNOW WHAT THEY ARE TALKING ABOUT. READ THE MAN PAGE.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 08:08 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
BOOYYAA
and the answer is
find . -size +10k
 Quoting: IMAX


well done! did you figure that out by reading the man page?
 Quoting: Anonymous Coward 35769388


i did it by going through my lecture notes and man find
 Quoting: IMAX


remember this:

ALWAYS READ THE MAN PAGE!!!

That is how you use a Linux or UNIX system. If somebody tells you that there is no need to read man pages, IGNORE THEM, THEY DON'T KNOW WHAT THEY ARE TALKING ABOUT. READ THE MAN PAGE.
 Quoting: Anonymous Coward 35769388


what does this question mean??

/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Display the absolute path of the executable used when a 'grep' command is
entered on the command line:

i know the answer is 'which grep'
but don't understand it

Last Edited by IMAX on 03/10/2013 08:10 PM
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 1339701
United States
03/10/2013 08:10 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
...


well done! did you figure that out by reading the man page?
 Quoting: Anonymous Coward 35769388


i did it by going through my lecture notes and man find
 Quoting: IMAX


remember this:

ALWAYS READ THE MAN PAGE!!!

That is how you use a Linux or UNIX system. If somebody tells you that there is no need to read man pages, IGNORE THEM, THEY DON'T KNOW WHAT THEY ARE TALKING ABOUT. READ THE MAN PAGE.
 Quoting: Anonymous Coward 35769388


what does this question mean??

/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Display the absolute path of the executable used when a 'grep' command is
entered on the command line:
 Quoting: IMAX


Show the full path to the grep command.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 08:10 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
...


i did it by going through my lecture notes and man find
 Quoting: IMAX


remember this:

ALWAYS READ THE MAN PAGE!!!

That is how you use a Linux or UNIX system. If somebody tells you that there is no need to read man pages, IGNORE THEM, THEY DON'T KNOW WHAT THEY ARE TALKING ABOUT. READ THE MAN PAGE.
 Quoting: Anonymous Coward 35769388


what does this question mean??

/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Display the absolute path of the executable used when a 'grep' command is
entered on the command line:
 Quoting: IMAX


Show the full path to the grep command.
 Quoting: Anonymous Coward 1339701


oh ok
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 08:13 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
Display the absolute path of the executable used when a 'grep' command is
entered on the command line:

i know the answer is 'which grep'
but don't understand it
 Quoting: IMAX


do you know what an absolute path is? do you know what a relative path is?

which grep will give you the absolute path to the grep executable.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 08:30 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Your current directory is sample_dir. Display the 2nd line of the file cars2,
translated to uppercase (hint: start with a 'head' command):

okay so i did head -2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

and

head -n 2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

but it's wrong

what am i doing wrong here?
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 1339701
United States
03/10/2013 08:33 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Your current directory is sample_dir. Display the 2nd line of the file cars2,
translated to uppercase (hint: start with a 'head' command):

okay so i did head -2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

and

head -n 2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

but it's wrong

what am i doing wrong here?
 Quoting: IMAX


You're redirecting the file to the tr command. You want to do the complete head command first and then pipe the output to tr.
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 08:35 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Your current directory is sample_dir. Display the 2nd line of the file cars2,
translated to uppercase (hint: start with a 'head' command):

okay so i did head -2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

and

head -n 2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

but it's wrong

what am i doing wrong here?
 Quoting: IMAX


What you are doing wrong:

1. head needs a file to work on.

2. you are supposed to get the second line, not the first two lines

3. that redirect at the end of the command line is wrong, the file should be given straight to head.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 08:37 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Your current directory is sample_dir. Display the 2nd line of the file cars2,
translated to uppercase (hint: start with a 'head' command):

okay so i did head -2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

and

head -n 2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

but it's wrong

what am i doing wrong here?
 Quoting: IMAX


You're redirecting the file to the tr command. You want to do the complete head command first and then pipe the output to tr.
 Quoting: Anonymous Coward 1339701


you mean something like this
head -2 stenton/gen_ed/cars2 | tr "[a-z]" "[A-Z]"

Last Edited by IMAX on 03/10/2013 08:39 PM
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 1339701
United States
03/10/2013 08:39 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Your current directory is sample_dir. Display the 2nd line of the file cars2,
translated to uppercase (hint: start with a 'head' command):

okay so i did head -2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

and

head -n 2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

but it's wrong

what am i doing wrong here?
 Quoting: IMAX


You're redirecting the file to the tr command. You want to do the complete head command first and then pipe the output to tr.
 Quoting: Anonymous Coward 1339701


you mean something like this
head -2 stenton/gen_ed/cars2 | tr "[a-z]" "[A-Z]"
 Quoting: IMAX



Yes, butt as AC35769388 pointed out, you only want the 2nd line instead of the first two.
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 08:41 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
/home/msabbar/sample_dir2
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
`-- stenton
|-- gen_ed
| |-- Holidays
| `-- cars2
|-- lib_arts
| |-- english.txt
| `-- match.doc
`-- phone_directory

11 directories, 12 files

Your current directory is sample_dir. Display the 2nd line of the file cars2,
translated to uppercase (hint: start with a 'head' command):

okay so i did head -2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

and

head -n 2 | tr "[a-z]" "[A-Z]" < stenton/gen_ed/cars2

but it's wrong

what am i doing wrong here?
 Quoting: IMAX


You're redirecting the file to the tr command. You want to do the complete head command first and then pipe the output to tr.
 Quoting: Anonymous Coward 1339701


you mean something like this
head -2 stenton/gen_ed/cars2 | tr "[a-z]" "[A-Z]"
 Quoting: IMAX



Yes, butt as AC35769388 pointed out, you only want the 2nd line instead of the first two.
 Quoting: Anonymous Coward 1339701


ahhh
head -2 stenton/gen_ed/cars2 | tail -1 | tr "[a-z]" "[A-Z]"
Imagine if there was no country
Stop the Sabre Rattlings and Wars
IMAX  (OP)

User ID: 35675988
Canada
03/10/2013 08:48 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
okay so this question:
Your current directory is sample_dir. Display cars2 sorted numerically by
the 4th field:

what command would be more appropriate ?

i did
ls -l stenton/gen_ed/cars2 | sort -nk 4

cat stenton/gen_ed/cars2 | sort -nk 4

ls stenton/gen_ed/cars2 | sort -nk 4
Imagine if there was no country
Stop the Sabre Rattlings and Wars
Anonymous Coward
User ID: 35769388
Australia
03/10/2013 08:50 PM
Report Abusive Post
Report Copyright Violation
Re: Urgent help on Linux
okay so this question:
Your current directory is sample_dir. Display cars2 sorted numerically by
the 4th field:

what command would be more appropriate ?

i did
ls -l stenton/gen_ed/cars2 | sort -nk 4

cat stenton/gen_ed/cars2 | sort -nk 4

ls stenton/gen_ed/cars2 | sort -nk 4
 Quoting: IMAX


please post a couple of lines of the cars2 file so people can see what is in it.





GLP