dreamshark: (Default)
[personal profile] dreamshark
 Yep, still dinking around with Windows 10, which I am liking better and better the more I get to know it.

I am still unreasonably tickled to have access to Linux and bash, and am starting to remember some of the things I used to do with it. Really, Linux is all about files. Linux essentially sees the world as a bunch of files, including all forms of I/O. And who can't use some low level tools for file management? 

I was chatting with someone at the Minnstf meeting who maintained that LInux over Windows did not have direct access to Windows files. Maybe it didn't with Cygwin, but Ubuntu over Win10 definitely does. Your C Drive is at /mnt/c.  Can't get much simpler than that, right?

I found a trove of my old work scripts and aliases and used them to customize my bash login. I was crazy for aliases, starting with quick ways of positioning and viewing the file system. I'm still relearning the syntax and can't quite remember why some of these are so complicated, but I'm sure there is a reason. Anyway, here are a few of my favorites, revised to reflect my local filesystem.

### Positioning                                                                                     
alias cdh="cd $HOME; pwd; ls"                                                                      
alias cdw="cd /mnt/c; pwd; ls"                                                                     
alias cds="cd /mnt/c/Users/sharon; pwd; ls"                                                        
alias cdf="cd /mnt/c/Users/sharon/OneDrive/Documents/FILES; pwd; ls"                               
alias cdsw="cd /mnt/c/Users/sharon/OneDrive/Documents/FILES/1SharonWork; pwd; ls"                                                                                                                     
 
## Self-referential                                                                                
alias va="vim $HOME/.alias"                                                                        
alias sa="source $HOME/.alias"                                                                                                                                                                        
 
##  Network Names                                                                                  
##  External DNS server addresses found on router                                                  
RTR="10.1.1.1"                                                                                    
DNS1="206.55.176.53"     
DNS2="216.17.8.138"  
 
### COMMANDS                                                                                                                                                                                 
alias p3="ping -c 3 "   
                                                                                                                                                                              
## MY OLD ALIASES                                                                                  
alias dus="du | sort -n"                                                                           
alias lsd="pwd; echo '========================'; ls -lc | egrep '^d|^l'"                           
alias lsdot="pwd; echo '========================'; ls -ld .*"                                      
alias lsf="pwd; echo '========================'; ls -lrt | grep '\-r'"                             
alias lsa="pwd; echo '========================'; ls -alrt | more"                                  
alias lss="pwd; echo '========================'; ls -lrt | sort +3 -n -r"                          
alias lslink="pwd; echo '========================'; ls -lc | grep '\^l'"                                                                                                                                                                  
How about you (you few Linux heads that are reading this). What are your favorite aliases?
 

Date: 2019-11-13 09:33 pm (UTC)
mdlbear: blue fractal bear with text "since 2002" (Default)
From: [personal profile] mdlbear
Here are the generic ones:
  alias a="audacity --sync"
  alias h=history
  alias j=jobs
  alias p=pushd
  alias P=popd
  alias gf=grep-find
  alias gfs='grep-find -s'
  alias gg='git grep -n'
  alias ll='ls -alF --color=auto'
  alias lr='ls -aRF --color=auto'
  alias l='ls -aCF --color=auto'
  alias lp2s='lp -o sides=two-sided-long-edge'
  alias chrome="google-chrome >& /dev/null"
  alias gnus="emacs -f gnus -name gnus"
  alias pidgin="pidgin -f"

(grep-find is a bash version of emacs' M-Xgrep-find)

There's another batch that cd to various locations in my git working trees; these are the ones I use for posting and to-do data mining:
alias dog="cd. $Private/Journals/Dog"
alias hh="git -C $Private/Journals/Dog grep '[0-9][0-9])[ADT]'"
alias music="cd. $Private/Journals/Music"
alias pj="cd. $Private/Journals/PJ"
alias river="cd. $Private/Journals/River"

Date: 2019-11-13 11:24 pm (UTC)
mdlbear: blue fractal bear with text "since 2002" (Default)
From: [personal profile] mdlbear
Not exactly -- emacs has a straight grep command. grep-find runs find to find all the files under the current directory, and runs grep on each of them. The guts of the grep-find script is:

find . -type f -exec grep -nH "$@" {} +

Where "$@" expands to whatever you passed on the command line, with each argument quoted separately. So you can use, e.g.

grep-find -i "some phrase"

for a case-insensitive search. The advantage of doing it in emacs is that it has a command to go to the next match. The disadvantage is that sometimes you don't need to do that, and want to pipe the result into something else. Like wc.

I should have mentioned that all of the generic ones are on github, in
Honu/_bashrc at master ยท ssavitzky/Honu

Have I blogged about that yet? I think so... *rummage* Oh yes,
https://mdlbear.dreamwidth.org/1688029.html
A bit sketchy, though.

Profile

dreamshark: (Default)
dreamshark
February 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2026

Page Summary

Style Credit