- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ls and pipe
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 12:58 AM
тАО04-12-2007 12:58 AM
I have a stupid question and it troubles me.
Why the stdout format of 'ls' is changed through a piped command?
if i do an 'ls' for example, i view all files in a column view.
'ls |more' view a file by line.
so questions are:
- why ?
- is there a way for bypass it ? (without rewrite the output)
Regards,
Cedrick Gaillard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 01:02 AM
тАО04-12-2007 01:02 AM
Re: ls and pipe
Probably they make the -1 option the default so that when you feed the piped out to a filter, you get one at a time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 01:09 AM
тАО04-12-2007 01:09 AM
Re: ls and pipe
i've just re-read the manpage and i've found the '-C' flag.
this flag allow the multicolum view through a pipe ;)
Regards,
Cedrick Gaillard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 01:13 AM
тАО04-12-2007 01:13 AM
SolutionFor for multicolumn to a pipe use: ls -C
Also check out: ls -m
Please note how the actual multicolumn format depends on the file name length and terminal width. Try stty cols xxx and repeas an ls.
- how wide is a pipe?
- how would a program behind a pipe have to deal with unpredicatable format?
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 01:14 AM
тАО04-12-2007 01:14 AM
Re: ls and pipe
You can force the preservation of the column view by doing:
# ls -x | more
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 01:17 AM
тАО04-12-2007 01:17 AM
Re: ls and pipe
the flag is used with "ls", because "ls" is filling the pipe and "ls" is responsible for the output format, e.g.
# ls -C | more
or
# ls -x | more
this is up to what you want to get.
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 01:26 AM
тАО04-12-2007 01:26 AM
Re: ls and pipe
to summarize the answers above:
it's not the pipe, which modifies the output (look at ls >tmpfile!) but the tty:
Without tty you get unmodified output.
mfG Peter