grimoire

personal wiki
git clone git://git.pyratebeard.net/grimoire.git
Log | Files | Refs

bash.md (824B)


      1 # bash
      2 
      3 use parameter of previous command ([ref 1](#ref#1))
      4 ```
      5 mkdir test
      6 cd $_
      7 ```
      8 or
      9 ```
     10 mkdir test
     11 cd !$
     12 ```
     13 
     14 ## `find` examples
     15 ```
     16 find . -type f -iname "*regex*" -exec rm -f {} \;
     17 ```
     18 
     19 ## when was user created [ref_2](#ref#2)
     20 - if user has never logged in after account creation
     21     ```
     22     ls -l /home/<user>/.bash_logout
     23     ```
     24 
     25 ## run bg job and log out
     26 after 'ctrl-z'
     27 ```
     28 disown -h %1
     29 bg 1
     30 logout
     31 ```
     32 _where 1 is the job number_
     33 
     34 ;  Command 1 ; Command 2  Run command 1 first and then command 2
     35 && Command 1 && Command 2 Run command 2 only if command 1 ends sucessfully
     36 || Command 1 || Command 2 Run command 2 only if command 1 fails
     37 
     38 
     39 ## ref
     40 - :1: https://unix.stackexchange.com/questions/125385/combined-mkdir-and-cd
     41 - :2: https://it.toolbox.com/question/how-to-find-out-when-a-user-is-created-in-linux-030612