Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:29:39+00:00 2026-05-28T03:29:39+00:00

In Ruby or in Rails:- I need to show output from below code formated

  • 0

In Ruby or in Rails:-
I need to show output from below code formated as it shows in command prompt.

require 'net/ssh'

Net::SSH.start( hostname, username, :password => password ) do|ssh|

result = ssh.exec!('ls -ltr')

puts result

end

Let me know how is it possible?

Command (ls -ltr) is dynamic and
currently output is:

total 257140 drwxrwxr-x 8 folderabc folderabc 4096 Set 4 2010 sources drwxrwxr-x 13 folderabc folderabc 4096 Set 4 2010 teste -rwxrwxr-x 1 folderabc folderabc 72 Set 7 2010 clean_memory -rw-rw-r-- 1 folderabc folderabc 263012352 Mar 17 2011 ngforms_production.sql -rw-rw-r-- 1 folderabc folderabc 21 Jun 23 2011 phps.php drwxrwxr-x 15 folderabc folderabc 4096 Jun 30 2011 ngforms -rw-rw-r-- 1 folderabc folderabc 751 Jul 1 2011 ngforms_word.sql -rw-rw-r-- 1 folderabc folderabc 31 Jul 5 2011 test.php drwxrwxr-x 5 folderabc folderabc 4096 Nov 4 10:52 dump drwxrwxrwx 2 folderabc folderabc 4096 Jan 13 00:00 mysqlbackup

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:29:40+00:00Added an answer on May 28, 2026 at 3:29 am

    Try using the <pre> tag. Also make sure that the font you use is one of the monospace fonts like CourierNew.

    <pre><%= result %></pre>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing some Ruby code, not Rails, and I need to handle something
I need to rescue from 'Errno::ENOENT' in a Ruby on Rails 3.0.4 application. I
I am using Ruby on Rails and I need to store a search result
I need to implement fine-grained access control in a Ruby on Rails app. The
it's about Ruby On Rails. I want to use Googleauth and need to add
I'm a 80% ruby on rails developer, but still need to do some Access
I'm building a site with Ruby on Rails 3.1 where I also need to
I am a beginner when it comes to Ruby on Rails, so I need
I'm somewhat informed with TDD and BDD with Ruby/Rails, but I will eventually need
Alright, I need some advice and best practices from some Rails people. I'm fairly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.