REQUEST: jq is great for json - but is there a "jq for xml"? Some webservices are still only available in xml (e.g. uv levels). I currently use XMLStarlet for xml in the terminal. There are extra annoyances in xml that you can't avoid (like namespaces), but it could be a lot closer to jq.
Ask HN: What are your favorite terminal programs?
171–180 of 203 posts
Re: Ask HN: What are your favorite terminal programs?
#172> What else I'm missing out on
echo 'Currently there are ' $(ver=(/bin /sbin /usr/bin /usr/sbin) && ls ${ver[*]} | wc -l) 'commands installed and available in the system'
This prints the man page of 3 random commands. One by one. Is a way to discover a few new commands each day. To go to the next command and exit press q. I hope you enjoy it.
commandoftheday=(/bin /sbin /usr/bin /usr/sbin) && ls ${commandoftheday} |sort -R |head -3 |xargs man '{}'
Re: Ask HN: What are your favorite terminal programs?
#173First of all, you might want to check out the subreddit: /r/commandline https://www.reddit.com/r/commandline/ general commands - awk/grep/sed/wc - text file processing - convert (image magick) - image processing tool - cpulimit - limit the cpu usage of a process - fdupes - check for duplicate files and optionally remove them - pdftk - concatenate pdf files and more - https://www.pdflabs.com/tools/pdftk-the-pdf-toolki…
Pdftk is a must. I use pdflatex also a lot of course. And R and psql.
Re: Ask HN: What are your favorite terminal programs?
#174Earlier quoted context omitted.
The benefit of tmuxp is pretty clear from its README[1]. It gives this example: session_name: 4-pane-split windows: - window_name: dev window layout: tiled shell_command_before: - cd ~/ # run as a first command in all panes panes: - shell_command: # pane no. 1 - cd /var/log # run multiple commands in this pane - ls -al | grep \.log - echo second pane # pane no. 2 - echo third pane # pane no. 3 - echo forth pane # pan…
I use a shell script for such config. eg tmux split-window -h ; tmux send-keys "ls -la" C-m; ...
# How to use this file:
# tmuxp load /path/to/this/file/main.yaml
# - Specifying the .yaml extension is optional
# - Specifying the path is optional if file is in ~/.tmuxp
#
# tmuxp --help for full help.
session_name: main
suppress_history: false
start_directory: '~'
shell_command_before:
- unsetenv SHELL_CONFIG_LOADED
- source ~/.alias
windows:
- window_name: '*scratch*'
layout: tiled
focus: true
panes:
- cd ~/downloads/git # Top-left
- cd ~/downloads/git/emacs # Top-right
- focus: true # Bottom-left
shell_command:
- bob
- sleep 2
- tclr # Clear tmux status indicators
- shell_command: # Bottom-right
- cd ~/.emacs.d/elisp/org-mode
- module load gcc/6.1.0 # Needed for ob-fortran tests to pass when doing make test for Org
- window_name: foo-1
layout: even-horizontal
shell_command_before:
- bob
- cduh
panes:
- null
- null
- null
- window_name: foo-2
layout: tiled
shell_command_before:
- bob
- cduh
panes:
- null
- null
- null
- null
- window_name: uvm_lib
layout: tiled
panes:
- cd ~/gitlab/bar_uvm_lib
- window_name: sandbox
layout: even-horizontal
panes:
- null
- null
- null
- window_name: hugo
layout: tiled
panes:
- shell_command:
- cd '~/downloads/git'
- shell_command:
- cd '~/e/elisp/ox-hugo/example-site'
- ./srv
- shell_command:
- cd '~/hugo'
- focus: true
shell_command:
- cd '~/e/elisp/ox-hugo'
- window_name: nim
layout: even-horizontal
panes:
- cd ~/sandbox/nim
- cd ~/sandbox/nim
- focus: true
shell_command:
- cd ~/sandbox/nim/chat
- window_name: tok
layout: even-horizontal
shell_command_before:
- tok
- cduh
panes:
- null
- null
- null
- window_name: zoo
layout: even-horizontal
shell_command_before:
- bob
- cduh
panes:
- null
- null
- nullRe: Ask HN: What are your favorite terminal programs?
#175Earlier quoted context omitted.
Thanks for your inputs. A few comments: I first created that script called m years ago on some Unix boxes that I was using. Could have been HP-UX or other version. And I've used it over the years on many Unix and Linux versions that I worked on. It could be that in some cases, the script is needed due to a tty or TERM or other configuration issue. But I'm pretty sure that I've had the need for it (to remove those con…
Yeah I'm familiar with groff et al. I used to get this issue on old UNIX boxes but not seen it in any of the Linux distros I use daily (not Freebase). The other thing worth trying is seeing whether your locals are set correctly and/or set the GROFF_TYPESETTER environment variable. Though this might only by GNU specific. Or just redirect the output (as suggested by the other reply) which is how I used to get around th…
Thanks again.
Re: Ask HN: What are your favorite terminal programs?
#176Earlier quoted context omitted.
Also see the man page for the col command, which is used in my m script: http://man7.org/linux/man-pages/man1/col.1.html
I don't make a habit of commenting on shell scripts what I haven't first read. But thank you all the same. I used to use 'col' alot to resolve the tabs Vs spaces problem with different actors imposing different preferences in their source code. It's a handy tool but often overlooked.
Sorry, I should have added "if you haven't already read it", in my earlier comment.
>I used to use 'col' alot to resolve the tabs Vs spaces problem with different actors imposing different preferences in their source code. It's a handy tool but often overlooked.
Interesting, I may not have noticed or known about the tabs option of col. Cool. Seems it is like the entab program in an edition of the K&R C book.
https://www.google.co.in/search?q=kernighan+and+ritchie+c+pr...
Re: Ask HN: What are your favorite terminal programs?
#177Earlier quoted context omitted.
> Also, for saving (and then viewing) man pages (about commands or other topics), without the formatting characters (such as ^H), on some Linux distros, I find this useful: ^H is one of the two backspace characters (the other being ^?) depending on which VT standard you're configured to use. So you shouldn't really need a dedicate script to do that as it's just a problem between your pseudo-TTY (Linux console) and yo…
> you shouldn't really need a dedicate script to do that It isn't because the terminal is mis-configured and/or mis-interpreting those characters, it's because these characters have historically been used in a special way by troff's ascii output driver, as used by the man command. Bold characters are "emulated" by outputting the character itself, followed by ^H, then by repeating the character, and underline is emula…
I didn't know about the ANSI behavior, interesting.
>FWIW, if you need a fool-proof way to convert a man page to plain old ASCII with no escapes at all, it's easiest just to redirect the output of "man" to a file:
> man ls > ls.txt
IIRC, even with that way, the control chars still appeared in the file (at least on some Unix version), which is why I wrote the script in the first place.
Re: Ask HN: What are your favorite terminal programs?
#178Earlier quoted context omitted.
> Also, for saving (and then viewing) man pages (about commands or other topics), without the formatting characters (such as ^H), on some Linux distros, I find this useful: ^H is one of the two backspace characters (the other being ^?) depending on which VT standard you're configured to use. So you shouldn't really need a dedicate script to do that as it's just a problem between your pseudo-TTY (Linux console) and yo…
> you shouldn't really need a dedicate script to do that It isn't because the terminal is mis-configured and/or mis-interpreting those characters, it's because these characters have historically been used in a special way by troff's ascii output driver, as used by the man command. Bold characters are "emulated" by outputting the character itself, followed by ^H, then by repeating the character, and underline is emula…
Right
>and if you "cat" the file your terminal would probably ignore them
I think the terminal does not ignore them. My guess is that it interprets the characters, but it has no noticeable visual effect on the screen. E.g. if the letter "c" in "cat" is output as "c^hc" (to make in bold in print), the terminal will just print "c", a backspace, then "c" again, which to the user will look the same as a single "c".
Re: Ask HN: What are your favorite terminal programs?
#179history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10 1 167 16.7% git 2 130 13% ll 3 94 9.4% clear 4 90 9% make 5 80 8% cd 6 57 5.7% e 7 52 5.2% cat 8 45 4.5% man 9 38 3.8% valgrind 10 37 3.7% rm Where ´e´ is an alias for ´vim´.
Re: Ask HN: What are your favorite terminal programs?
#180* dcraw - RAW photo processing tool
* imagemagick - image processing library
* pandoc - convert one file into another
* diceware - random word generator (useful for creating passwords)
* csvtomd - convert csv files to markdown tables
* newsbeuter - RSS reader
* zathura - pdf viewer
* weechat - irc client
* ncdu - interactive disk usage
* ranger - file manager
* mpd - music player daemon
* vimpc - vim inspired client for mpd