Whenever some command generates long lines as output ( for example, when ls -l
a folder which contains files with long names ), the long lines are wrapped to next line, thus messing up the column structure.
Is there any way of avoiding this ? Something akin to the 'nowrap' vim option ?
update
I noticed an issue with the accepted answer:
if I make an alias like: alias ll="tput rmam; ls -l; tput smam"
and then try to grep it's output: ll | grep foo
it will still print all files, like without the grep.
The solution I found is to put brackets around the whole alias:
alias ll="(tput rmam; ls -l; tput smam)"
{ ... }
instead of parenthesis( ... )
, your command won't be needlessly run in a subshell. Make sure to add a semicolon at the very end, to make it work properly:alias ll="{ tput rmam; ls -l; tput smam; }"