Skip to content

ChrisKaufmann/totools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A few useful tools and shortcuts I use on machines

to:
will add your public key to a remote user's authorized keys file and ssh to the host
usage: to [user@]<hostname>[:port] [optional command to run remotely]
ex:
totools chriskaufmann$ to southpark "uptime"
 21:45:45 up 245 days, 13:48,  2 users,  load average: 0.00, 0.00, 0.00
totools chriskaufmann$ to bob:8022 "uptime"
 15:53:52 up 31 days, 18:50,  0 users,  load average: 0.01, 0.01, 0.00

tox:
 identical to to, except for going with X support
usage: tox [user@]<hostname>[:port] [optional command to run remotely]
ex:
totools chriskaufmann$ tox futurama VirtualBox
(VirtualBox window pops up)

ami:
as in "am I doing something?"
usage: ami <some command>
ex:
totools chriskaufmann$ ami notify
root        12   0.0  0.0  2444624    416   ??  Ss   Tue04PM   0:05.92 /usr/sbin/notifyd

amp:
as in "Am I doing something on a Port"
usage: amp <port or command name>
ex:
chris$ sudo ./amp mysql
*:3306
chris$ sudo ./amp 3306
mysql    27614  1.6  1.0 705656 22256 ?        Sl   May26  97:40 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

didi:
as in "did I do something?"
usage: didi <some command>
ex:
totools chriskaufmann$ didi ducks
git add ducks
vi ducks
vi ducks
git add ducks

ducks:
Alias for "du -cks * | sort -rn | head -11" as found in "Linux Server Hacks"
usage: ducks [optional dir to duck]
ex:
totools chriskaufmann$ ./ducks /opt
70404   total
70404   /opt/local

killthe:
Kills with prejudice any processes matching input
usage: killthe <processes to kill>
ex:
chriskaufmann$ ami tail
chriskaufmann 15803   0.0  0.0  2434844    336 s015  S+    9:59PM   0:00.00 tail -f /var/log/mail.log
totools chriskaufmann$ killthe tail
Killing 15803
totools chriskaufmann$ ami tail
totools chriskaufmann$

killport:
kills the process listening on a port
usage: killport <port number>
ex:
chriskaufmann$ lsof -i:24800
COMMAND  PID          USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
synergys 296 chriskaufmann    5u  IPv4 0x05d99ee8      0t0  TCP *:24800 (LISTEN)
synergys 296 chriskaufmann   10u  IPv4 0x09190ad8      0t0  TCP monitor.private.connamara.com:24800->192.168.200.253:54604 (ESTABLISHED)
chriskaufmann$ killport 24800
killing 24800
chriskaufmann$ lsof -i:24800
chriskaufmann$


background:
Run something in the background (for remote usage mostly)
usage: background 'command to run'
ex:
chriskaufmann$ background 'rails server'
nohup: appending output to `nohup.out'
chriskaufmann$
chriskaufmann$ ami rails
chriskaufmann 32446  1.1  6.9 724488 276516 ?       Sl   11:32   1:22 rails server
chriskaufmann$

pwgen:
Generates a decent password
usage: pwgen [-n|-d|-h|-c] [len]
ex:monitor:~ chriskaufmann$ pwgen 32
lCrTh6S[6VK.TWBh&9hv(t45N)zsc)H;
monitor:~ chriskaufmann$ pwgen -n 19
3CxEPysoosQNHPY0r1w
monitor:~ chriskaufmann$ pwgen -c 15
HDevroEjZiwtkpj
monitor:~ chriskaufmann$ pwgen -h 16
b9688c94b3a64c1c
monitor:~ chriskaufmann$ pwgen -d 15
168009022286126
monitor:totools chriskaufmann$ pwgen
4oBB1]N1ciB94svA
monitor:~ chriskaufmann$

loop:
constantly re-runs a command
usage: loop [-n <num to run>|-t <time to sleep] 'command to run'
ex:
monitor:~chriskaufmann$ loop date
Wed Jun  5 15:56:44 CDT 2013
Wed Jun  5 15:56:54 CDT 2013
^C
monitor:~ chriskaufmann$ loop -t 1 date
Wed Jun  5 15:57:02 CDT 2013
Wed Jun  5 15:57:03 CDT 2013
^C
monitor:~ chriskaufmann$ loop -n 3 date
Wed Jun  5 15:57:08 CDT 2013
Wed Jun  5 15:57:18 CDT 2013
Wed Jun  5 15:57:28 CDT 2013
monitor:~ chriskaufmann$ loop -t 1 -n 2 date
Wed Jun  5 15:57:40 CDT 2013
Wed Jun  5 15:57:41 CDT 2013
monitor:~ chriskaufmann$

redo (Not useful yet):
Re-does the last command matching input
usage: redo <thing to redo>

radduser:
remotely add user, user's ssh key, and adds to sudoers file
usage: radduser <my user@host> <new username> <new user's pubkey>
ex:
monitor:~/totools$ radduser myuser@host newguy ~/newguykey.pub
monitor:~/totools$

Download:
 bash < <(curl -s https://raw.githubusercontent.com/ChrisKaufmann/totools/master/get-totools.sh)

Or, btsync read-only secret: BJIV7XLKZMTPNRVA6QBHNK3WRBXZDH5YA

About

Handy Linux scripts and tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published