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 01-24-2021, 05:00 PM   #1
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Rep: Reputation: Disabled
disable wrap in terminator


I need to do some reading of long lines with tabs as such from $ss output.
How to disable wrap in terminator (console) ?
 
Old 01-24-2021, 05:50 PM   #2
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by andrewysk View Post
I need to do some reading of long lines with tabs as such from $ss output.
How to disable wrap in terminator (console) ?
Why would you want to??. Wrapping is on by default and AFAIK there is no way to scroll left to right with the terminal window.. Turning off line wrapping would mean you could never be able to see what extended beyond the edge of the screen.

All you need in reality is to understand that it is one continuous line of text until you see the line break.

One possibility to simplify reading the output would be to send that output to a text file, then open the text file with a word processor such as libre office which would also by default wrap the lines to fit your page format. You could then set it to display the control characters and make it easier to identify the line breaks.

Last edited by computersavvy; 01-24-2021 at 05:56 PM.
 
1 members found this post helpful.
Old 01-25-2021, 11:20 AM   #3
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by computersavvy View Post
Why would you want to??. Wrapping is on by default and AFAIK there is no way to scroll left to right with the terminal window.. Turning off line wrapping would mean you could never be able to see what extended beyond the edge of the screen.
Oh! There is no way to left right scroll in terminal ? I thought there is.
The reason why i can't read the text from terminal is because there is "tab" in the result. when tabs are in it, it all mess up.
Can't output it to a text file, because i want to view it live..

Any other way round ?
 
Old 01-25-2021, 11:27 AM   #4
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
You could use sed to change tabs to a character of your choice.
 
Old 01-25-2021, 11:46 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,885
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
You could change the the font size to something smaller and extend your terminal to have more characters per line.
 
Old 01-25-2021, 11:50 AM   #6
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,686

Rep: Reputation: Disabled
Or tabs to set the width of the tab-stops.

Or Ctrl+- (minus on the main keyboard) to reduce the font size, then Ctrl+0 (zero) to restore it.
 
Old 01-25-2021, 12:24 PM   #7
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,634

Rep: Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558

Or, instead of all these crappy workarounds, you could actually just disable line wrapping, by piping to "less -S" and using cursor keys to navigate.

Example:
Code:
ss -p | less -S
 
2 members found this post helpful.
Old 01-25-2021, 03:42 PM   #8
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
Or, instead of all these crappy workarounds, you could actually just disable line wrapping, by piping to "less -S" and using cursor keys to navigate.

Example:
Code:
ss -p | less -S
WoW!!! Wonderful!!
Now i know less -S has got this feature.. lol!
Thanks. Good stuff that you shared.


I tried to reduce the font size before this, i have to reduce the font till i barely able to read it. lol..that's why i need this |less -S feature.
 
Old 01-25-2021, 03:59 PM   #9
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
One more thing,
when I use
Code:
watch
with
Code:
|less -S
; (so that i can watch it real time) it messed up the whole thing.. I don't see any output anymore.


Code:
$ sudo watch ss -tulpn | less -S
Any way to solve this issue ?
 
Old 01-26-2021, 01:24 AM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
I don't think watch can work with less.
 
Old 01-26-2021, 05:22 AM   #11
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
I don't think watch can work with less.
Is there a way round to it ?

How do you monitor the traffics in and out of your pc when you think it is abnormally busy ? How and what software used ? what method ?
Thx

Last edited by andrewysk; 01-26-2021 at 05:23 AM.
 
Old 01-26-2021, 05:35 AM   #12
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by ondoho View Post
I don't think watch can work with less.
Also, I don't think watch can work with more.
 
Old 01-26-2021, 05:51 AM   #13
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,686

Rep: Reputation: Disabled
watch is a full-screen ncurses application. You cannot combine it with another ncurses application (less, more, whatever).

You can somewhat trim the ss output and make it look slightly more compact.

E.g. with miller:
Code:
sudo watch 'ss -HOtulpn|mlr --n2p --repifs label Id,State,R,S,LA,PA'
Or with tabulate from the Perl module Text::Tabulate
Code:
sudo watch 'ss -HOtulpn|tabulate -t" +"'
Or with the Python script of the same name (slightly less efficient):
Code:
sudo watch 'ss -HOtulpn|tabulate -fplain'
You could even format it with printf as you wish, although this would probably require some testing and adjustment:
Code:
printf '%s %s %d %3d %-17s %9s %.32s\n' $(sudo ss -HOtulpn)

Last edited by shruggy; 01-26-2021 at 09:08 AM.
 
1 members found this post helpful.
Old 01-26-2021, 08:07 AM   #14
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shruggy View Post
watch is a full-screen ncurses application. You cannot combine it with another ncurses application (less, more, whatever).

You can somewhat trim the ss output and make it slightly more compact.

E.g. with miller:
Code:
sudo watch 'ss -HOtulpn|mlr --n2p --repifs label Id,State,R,S,LA,PA'
Or with tabulate from the Perl module Text::Tabulate
Code:
sudo watch 'ss -HOtulpn|tabulate -t" +"'
Or with the Python script of the same name (slightly less efficient):
Code:
sudo watch 'ss -HOtulpn|tabulate -fplain'
You could even format it with printf as you wish, although this would probably require some testing and adjustment:
Code:
printf '%s %s %d %3d %-17s %9s %.32s\n' $(sudo ss -HOtulpn)
Wow!
You are so knowledgable in these kind of stuff... lol
I am still reading the first row of miller $mlr .. it is tabular tool for csv.. just like sed awk..
the rest have not read yet, no idea what they are, just know they are related to data manipulation..
I have never use it before.
 
1 members found this post helpful.
Old 01-26-2021, 01:36 PM   #15
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shruggy View Post
watch is a full-screen ncurses application. You cannot combine it with another ncurses application (less, more, whatever).

You can somewhat trim the ss output and make it look slightly more compact.

E.g. with miller:
Code:
sudo watch 'ss -HOtulpn|mlr --n2p --repifs label Id,State,R,S,LA,PA'
Or with tabulate from the Perl module Text::Tabulate
Code:
sudo watch 'ss -HOtulpn|tabulate -t" +"'
Or with the Python script of the same name (slightly less efficient):
Code:
sudo watch 'ss -HOtulpn|tabulate -fplain'
You could even format it with printf as you wish, although this would probably require some testing and adjustment:
Code:
printf '%s %s %d %3d %-17s %9s %.32s\n' $(sudo ss -HOtulpn)


I have give all of your method a try, but all not working.
(method1
I also installed the only tabulate in repo
Code:
 $ sudo pacman -S python-tabulate
Code:
$ sudo watch 'ss -pn | tabulate -fplain'
Click image for larger version

Name:	sRarnUo.png
Views:	35
Size:	125.2 KB
ID:	35385
The result is not different than
Code:
$ sudo watch ss -pn
Click image for larger version

Name:	vcnMWs1.png
Views:	25
Size:	86.6 KB
ID:	35386





(method2
As for the command with miller $mlr, error installing miller (both via pamac-manager and yay):
Code:
:: Proceed with installation? [Y/n] 
:: Retrieving packages...
error: failed retrieving file 'ctags-1:r20200106+ga3c87ab5-1-x86_64.pkg.tar.zst' from mirror.23media.com : The requested URL returned error: 404
error: failed retrieving file 'ctags-1:r20200106+ga3c87ab5-1-x86_64.pkg.tar.zst' from arch.jensgutermuth.de : The requested URL returned error: 404
Hence miller method is not working.









(method3
Method tabulate:
Code:
sudo watch 'ss -HOtulpn|tabulate -t" +"'
not working. no idea where's the problem.
Click image for larger version

Name:	sp2qv8K.png
Views:	22
Size:	70.7 KB
ID:	35387







(method4)
method printf:
Code:
printf '%s %s %d %3d %-17s %9s %.32s\n' $(sudo ss -pn)
this is not in realtime and does nothing to make the result more presentable.
Code:
$ printf '%s %s %d %3d %-17s %9s %.32s\n' $(sudo ss -p)
bash: printf: Recv-Q: invalid number
bash: printf: Send-Q: invalid number
Netid State 0   0 Local             Address:Port Peer
bash: printf: u_seq: invalid number
bash: printf: ESTAB: invalid number
Address:Port Process 0   0 0                         0 @00004
bash: printf: mtp: invalid number
bash: printf: usbtest3s: invalid number
768262 6T_HDD 0   0 768263            users:(("BluejeansHelper",pid=234432,fd=10),("sh",pid=234430,fd=10),("bluejeans-v2",pid=234331,fd=10)) u_seq
bash: printf: @00002: invalid number
ESTAB 4 0   0 462842               6T_HDD mtp
bash: printf: users:(("clipgrab",pid=139863,fd=23)): invalid number
bash: printf: u_seq: invalid number
usbtest3s 462843 0   0 ESTAB                     0 0
bash: printf: 6T_HDD: invalid number
bash: printf: mtp: invalid number
@00003 462844 6   0 usbtest3s            462845 users:(("clipgrab",pid=139863,fd
u_seq ESTAB 0   0 6T_HDD                  mtp usbtest3s
bash: printf: mtp: invalid number
bash: printf: usbtest3s: invalid number
No idea what went wrong. It just does not work on my computer

Last edited by andrewysk; 01-26-2021 at 01:38 PM.
 
  


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
[SOLVED] Terminal on Linux Mint 17.1 version behaving like actual terminator animal in Terminator movie chanikya Linux - Newbie 1 03-16-2016 03:09 PM
Disable titlebar in terminator iwtbf Linux - Software 0 02-22-2015 03:45 PM
Terminator on-start title bar, how to disable. jangers Linux - Software 3 08-19-2013 08:44 PM
How to change or disable line wrap in Evolution Skaperen Linux - Software 7 02-11-2011 03:15 AM
"enscript --word-wrap" does not wrap line of text file powah Linux - General 3 05-16-2006 09:12 PM

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

All times are GMT -5. The time now is 10:22 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