Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    newbie script question

    how do i create a srcipt that will produce a text file with currently listing of diretory

    i know that

    "ls -a" is listing all directory, but how to make it produce a view in text file?

  2. #2
    I think you're asking how to redirect the output of "ls -a" to a file. That is done as follows:
    ls -a > directory_listing.txt

  3. #3
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    That's the standard redirect and works for all occasions, best suited for a one off command in a script I find.

    Using >> will append to an existing file or create it if it doesn't or if you want to see the output on screen as well as redirecting it you can use tee
    ls -a |tee foo.txt

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts