txt444

Linux terminal help

Mar 4th, 2022 (edited)
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. 27-04-2022 9:05 Linux terminal help
  2. Simple terminal help for easier use of commands.
  3.  
  4.  
  5. 1. exec
  6. # cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd && echo $cmd > ~/help.tmp && . ~/help.tmp
  7. # cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd | tee ~/help.tmp && . ~/help.tmp
  8. # cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd && eval $cmd
  9. cmd=$(< ~/help.txt fzf) && history -s $cmd && echo $cmd && eval $cmd
  10. source : https://porkmail.org/era/unix/award#uucaletter
  11.  
  12. 2. edit
  13. # cmd=$(cat ~/help.txt | fzf) && read -p "read > " -e -i "$cmd" && history -s $REPLY && echo $REPLY > ~/help.tmp && . ~/help.tmp
  14. # read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && echo $REPLY > ~/help.tmp && . ~/help.tmp
  15. # read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && eval $REPLY
  16. read -p "readline > " -ei "$(< ~/help.txt fzf)" && history -s $REPLY && eval $REPLY
  17.  
  18. 1. exec
  19. # Not working if ignoredups active :
  20. # cmd=$(cat ~/help.txt | fzf) && history -s $cmd && history -s $cmd && fc -s && history -d $(history 1)
  21. history -s $(< ~/help.txt fzf) && history -s x && fc -s
  22.  
  23. 2. edit
  24. # cmd=$(cat ~/help.txt | fzf) && read -p "read > " -e -i "$cmd" && history -s $REPLY && history -s $REPLY && fc -s && history -d $(history 1)
  25. # read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && history -s $REPLY && fc -s && history -d $(history 1)
  26. read -p "readline > " -ei "$(< ~/help.txt fzf)" && history -s $REPLY && history -s x && fc -s
  27.  
  28.  
  29. More :
  30. edit:
  31. xdotool type "$(cat ~/help.txt | fzf)"
  32. xdotool type "$(cat ~/help.txt | fzf)" && echo
  33. stty -echo && xdotool type --delay 0 "$(cat ~/help.txt | fzf)" && stty echo
  34. exec:
  35. stty -echo && xdotool type --delay 0 "$(cat ~/help.txt | fzf)$(printf "\n\b")" && stty echo
  36. stty -echo && xdotool type --delay 0 "$(printf "$(cat ~/help.txt | fzf)\r\r")" && stty echo
  37. source:
  38. https://stackoverflow.com/questions/31846572/why-does-xdotool-type-twice-how-can-i-avoid-it
  39.  
  40. Not perfect:
  41. command $(cat ~/help.txt | fzf)
  42. echo | $(cat ~/help.txt | fzf)
  43. echo -ne "\n" | $(cat ~/help.txt | fzf)
  44.  
  45.  
  46. fzf settings : fzf --tac --bind=left-click:accept --no-color --pointer='+' --cycle --exact
  47.  
  48. interactive filters:
  49. https://lobste.rs/s/squpog/interactive_filter_new_standard_tool
  50. + skim:
  51. https://github.com/lotabout/skim
  52.  
  53.  
  54. ############################################################################################################################
  55. ############################################################################################################################
  56.  
  57.  
  58. 04-03-2022 9:05 Linux terminal help
  59.  
  60.  
  61. 1. exec
  62. cmd=$(cat ~/help.txt | fzf) && history -s $cmd && echo $cmd | tee ~/help.tmp && . ~/help.tmp
  63.  
  64. 2. edit
  65. # cmd=$(cat ~/help.txt | fzf) && read -p "read > " -e -i "$cmd" && history -s $REPLY && echo $REPLY > ~/help.tmp && . ~/help.tmp
  66. read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && echo $REPLY > ~/help.tmp && . ~/help.tmp
  67.  
  68. Not working if ignoredups active.
  69. 1. exec
  70. cmd=$(cat ~/help.txt | fzf) && history -s $cmd && history -s $cmd && fc -s && history -d $(history 1)
  71.  
  72. 2. edit
  73. # cmd=$(cat ~/help.txt | fzf) && read -p "read > " -e -i "$cmd" && history -s $REPLY && history -s $REPLY && fc -s && history -d $(history 1)
  74. read -p "read > " -e -i "$(cat ~/help.txt | fzf)" && history -s $REPLY && history -s $REPLY && fc -s && history -d $(history 1)
  75.  
  76.  
  77. More :
  78. edit:
  79. xdotool type "$(cat ~/help.txt | fzf)"
  80. xdotool type "$(cat ~/help.txt | fzf)" && echo
  81. stty -echo && xdotool type --delay 0 "$(cat ~/help.txt | fzf)" && stty echo
  82. exec:
  83. stty -echo && xdotool type --delay 0 "$(cat ~/help.txt | fzf)$(printf "\n\b")" && stty echo
  84. stty -echo && xdotool type --delay 0 "$(printf "$(cat ~/help.txt | fzf)\r\r")" && stty echo
  85.  
  86. Not perfect:
  87. command $(cat ~/help.txt | fzf)
  88. echo | $(cat ~/help.txt | fzf)
  89.  
  90.  
  91. fzf settings : fzf --tac --bind=left-click:accept --no-color --pointer='+' --cycle --exact
Advertisement
Add Comment
Please, Sign In to add comment