3

For example, say I want to run the command ll:

My output would look something like this:

josh@zeitgeist ~ ll
total 41148
drwxr-xr-x 42 josh josh     4096 Aug  4 22:52 ./
drwxr-xr-x  4 root root     4096 Jul  9 21:18 ../
-rw-rw-r--  1 josh josh  3523718 Jul 11 00:17 2017-07-11-001710_3840x2160_scrot.png

but I want it to look like this:

josh@zeitgeist ~ ll
   total 41148
   drwxr-xr-x 42 josh josh     4096 Aug  4 22:52 ./
   drwxr-xr-x  4 root root     4096 Jul  9 21:18 ../
   -rw-rw-r--  1 josh josh  3523718 Jul 11 00:17 2017-07-11- 001710_3840x2160_scrot.png

I already know about using PS1='XXX' to change the prompt; is there a way to change every line of the output that gets displayed, for every command, specifically in the terminal(not changing the output and putting it in a file)?

I would like to do this to have an indentation line of characters going down the left side of my terminal. I'm currently wokring on creating a sci-fi inspired desktop, and one of the things I'm doing is creating a unique, irregular border around my titleless, borderless urxvt terminal windows by using a terminal background image. The only issue is I cannot figure out how to prepend spacing to the beginning of all output, because the output hugs the left edge of the window, which covers the paret of the background I want visible. I tried using URxvt internalBorder and externalBorder, but they cover the background image on the bottom and right edges of the terminal.

5

How about this. Starts a new bash process that is piped into awk, where every line piped in gets a couple of spaces printed before $0 (the input line)

$ bash | awk '{print "  " $0}'
$ id
  uid=500(ec2-user) gid=500(ec2-user) groups=500(ec2-user),10(wheel)
$ uname -a
  Linux ip-172-31-37-61 4.9.38-16.33.amzn1.x86_64 #1 SMP Thu Jul 20 01:31:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$
  • (assuming awk is not mawk which processes its input by block) – Stéphane Chazelas Aug 6 '17 at 20:38
  • 1
    Can you elaborate on why bash | awk '{print " " $0}' persistently effects the output? My idea was to create an alias to pipe the output to but this is much better. – flerb Aug 7 '17 at 0:38
  • I can't seem to get this to work? i'm using urxvt for a terminal emulator on Ubuntu 16.04, when I enter bash | awk '{print " " $0}', nothing happens, except some commands have no output anymore, like ls, and vim doesn't work. The goal is to space the text farther in from the edge of the terminal window, because I'm creating a fake border with a terminal background image, and I don't want input covering the left border. – suhmedoh Aug 21 '17 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.