LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2018, 10:44 PM   #1
TheGrey
LQ Newbie
 
Registered: Jul 2018
Posts: 4

Rep: Reputation: Disabled
Redirection issues using ls


Hello everyone,
I am in a Linux class and I will paste the screen of where I am stuck:
OK maybe not.

The instructions read:
By using the commands and utilities you just learned, complete the following tasks:

In the ~/workspace/project-log directory, create a file named changelog.txt with the following content and format:

Changelog
Version: 1.0

Redirect the output of the ls command to a file named file-list.txt in the ~/workspace/project-log directory

The first part I did nice and easy. The redirect is killing me. I tried to see if I could trick Codio by just creating another file, but it said missing ls. Then I got it to create the new file with ls -l but the content was different.

I am not understanding how to use ls to make the new file say the same thing the original file did.

Thank you for any assistance.
 
Old 07-12-2018, 10:54 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
The content was different
Different than what? There’s nothing in those instructions about the content of file-list.txt.

You should probably direct your question to your instructor.
 
Old 07-12-2018, 11:00 PM   #3
TheGrey
LQ Newbie
 
Registered: Jul 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Different than what? There’s nothing in those instructions about the content of file-list.txt.

You should probably direct your question to your instructor.
Redirect the output of the ls command to a file named file-list.txt in the ~/workspace/project-log directory.

That's part 2 of the problem.
If I do ls - l, I get different output than the Changelog Version: 1.0
 
Old 07-12-2018, 11:16 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by TheGrey View Post
Redirect the output of the ls command to a file named file-list.txt in the ~/workspace/project-log directory.

That's part 2 of the problem.
If I do ls - l, I get different output than the Changelog Version: 1.0
Why do you expect the output of the last command to be the same?? There’s nothing in your directions that suggests it should be...
...nor should it be. Talk with your instructor.

Last edited by scasey; 07-12-2018 at 11:17 PM.
 
Old 07-12-2018, 11:21 PM   #5
TheGrey
LQ Newbie
 
Registered: Jul 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
I was assuming that the error message said it was to be the same, I didn't post it originally my apologies.

[Error ] Task 2. Expected: 'ls' ~/workspace/ content to match file named ~/workspace/project-log/file-list.txt content. Try again.

Thats what I get when I tried

ls -l >> ~/workspace/project-log/file-list.txt

Same error when I try
ls -l > ~/workspace/project-log/file-list.txt

Nevermind, I just noticed the -l....solved it.

Last edited by TheGrey; 07-12-2018 at 11:54 PM. Reason: solved it
 
Old 07-13-2018, 02:06 AM   #6
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,794

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Perhaps you stumbled over the fact that "ls" without argument "-l" or "-1" prints multi-column when it goes to the screen.
 
1 members found this post helpful.
Old 11-16-2019, 05:46 PM   #7
secularreasoning
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
I'm stuck on this as well. Trying to get help from the instructor is like pulling teeth.

This is a two part question and here is what I got:

1.
echo -e 'Changelog\nVersion: 1.0' > changelog.txt

2.
ls > file_list.txt


This didn't end up being the right answer but it does what it asked.
 
Old 11-16-2019, 06:54 PM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by secularreasoning View Post
I'm stuck on this as well. Trying to get help from the instructor is like pulling teeth.

This is a two part question and here is what I got:

1.
echo -e 'Changelog\nVersion: 1.0' > changelog.txt

2.
ls > file_list.txt


This didn't end up being the right answer but it does what it asked.

What question(s) did you ask the instructor?

What question did you ask us?
 
Old 11-16-2019, 07:03 PM   #9
secularreasoning
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by Firerat View Post
What question(s) did you ask the instructor?

What question did you ask us?

If you look again carefully you will see I did not ask you a question, I provided an answer to someone else.
 
Old 11-16-2019, 07:19 PM   #10
secularreasoning
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
Solved

This is the answer to this question 1.5 challenge in Codio

echo -e 'Changelog\nVersion: 1.0' > changelog.txt
ls > ~/workspace/project-log/file-list.txt
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB redirection issues on WinXP guest, KVM host (created with virt-manager) gradinaruvasile Linux - Virtualization and Cloud 2 12-07-2015 07:00 AM
DNS issues, Downloading issues, Web issues. UbuntuHelp Linux - Networking 1 08-28-2012 07:34 AM
Shell script: stdin redirection + multiple curl process issues fernandomm Programming 1 07-04-2010 08:10 AM
redirection kkpal Programming 4 11-05-2007 10:24 PM
redirection rblampain Linux - Server 0 09-29-2007 12:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration