watch

Advanced feature discussion, beta programs and unsupported "Labs" features.
6 posts Page 1 of 1
by nhdesign » Sun Mar 04, 2018 1:59 pm
sh.sonic.net:nhdesign:.../n/nhdesign/local/humor 75 % ls
100_years_ago blow_jobs dogs_are_better harley shotgun
12_tips_for_bosses booty_call dr_phil_test hell snake
12marriages boy_and_his_frog drew_carey high_intensity_training sun_screen
17_holes cheers drop_the_big_one how_cold terrorists.txt
addicted_to_vi choc_is_better electoral_college hung the_ant_and_grass_hopper
adventure christmas_pc email_why_is ignorant toasts
age_1987 clinton engineer_types inner_strength trees
age_check coke engineers_life jargon trivia
anagrams corporate fairy_tale_for_the_90s_woman life unixhier.html
b_s_bingo corporate_lessons fine-wine lincoln_kennedy vegetables
bases cowboy_boots five_kinds_of_sex mans_life whoremonger_01_alpha
beer_date_drug dalai_lama five_stages_of_drinking men_good wife1.0
beer_lore dead_horse five_toughest_questions mens_room witches
beer_os dear_wife fortunes misc woman
beer_styles declaration_of_independence fourth_of_july office_lingo words_women_use
best_lovers dilbert funny_sillycons one_hundred_percent you_know_your_old_when
bill_of_no_rights dilbert_one_liners geek_guys_guide poker_players
bird_feeder dilbertisms guts_and_balls santa

but combined with watch, of course it worked as above on bolt...
Every 2.0s: ls Sun Mar 4 13:58:54 2018

100_years_ago
12_tips_for_bosses
12marriages
17_holes
addicted_to_vi
adventure
age_1987
age_check
anagrams
b_s_bingo
bases
beer_date_drug
beer_lore
beer_os
beer_styles
best_lovers
bill_of_no_rights
bird_feeder
blow_jobs
booty_call
boy_and_his_frog
cheers
choc_is_better
christmas_pc
clinton
coke
corporate
corporate_lessons
cowboy_boots
dalai_lama
dead_horse

the rest runs off screen,
by scott » Sun Mar 04, 2018 2:53 pm
Yeah, if ls detects that it isn't outputting to a terminal, it assumes "ls -1" (that's a one).

One fix is to pipe your watched command to "column" like this:

watch '( ls | column -c 80)'

If you want to list across rather than down:

watch '(ls | column -xc 80)'

Hope that helps. :)

-Scott
by bakul » Mon Mar 05, 2018 3:16 am
scott wrote:
Yeah, if ls detects that it isn't outputting to a terminal, it assumes "ls -1" (that's a one).

One fix is to pipe your watched command to "column" like this:

watch '( ls | column -c 80)'

If you want to list across rather than down:

watch '(ls | column -xc 80)'

Hope that helps. :)

-Scott


watch ls -C will do a multicolumn output the same way as ls to a terminal.
by nhdesign » Mon Mar 05, 2018 4:40 am
I would like to run

ls -lart

but instead of printing all lines to the screen,
it stops at one screen full,
like it is going through more.

the -C works well but I lose the long listing which shows date size...

--
Vic
by scott » Mon Mar 05, 2018 2:16 pm
nhdesign wrote:
I would like to run

ls -lart

but instead of printing all lines to the screen,
it stops at one screen full,
like it is going through more.

the -C works well but I lose the long listing which shows date size...

--
Vic


I didn't know that about the "-C" parameter, thanks for the info. :)

Well, "watch" is designed to just show you the first page of output (kind of like "top" does) -- the idea is that you can watch the output of a command for changes. If you just want to run a command periodically, you'd probably want to do something like:

Code: Select all

while : ; do ls -lart ; sleep 5;  done


Don't forget the sleep. :)

Edit: If you're looking for new files being added to the directory, you could also do something like:

Code: Select all

watch '( ls -lat | head)'


And then look at the top of the screen. Alternately,

Code: Select all

watch '(ls -lart | tail)'


Would put the newest file on the bottom.

-Scott
by nhdesign » Mon Mar 05, 2018 2:46 pm
I switched over to your while command, works great.
You should be relaxing at the dentist's office. Nothing I am working on is hot.
I have made the switch from bolt to sh full time now.
Great job.
Moved my crontab over today, will see what the results are in the morning.
Thanks,
Vic
6 posts Page 1 of 1

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 9 guests