-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinuxNotes
27 lines (22 loc) · 842 Bytes
/
LinuxNotes
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
#This file contains bash/commandline related notes
#To enable smooth tabbing in vim add the following lines in .vimrc
colorscheme default
hi Statement ctermfg=2
nmap <C-a> :tabp<cr>
nmap <C-d> :tabnext<cr>
nmap <C-w> :tabclose<cr>
#This is to highlight using visual mode and search in vim
vnoremap // y/<C-R>"<CR>
#Watch command in linux
watch -n 0.1 -d "netstat -nape 2> /dev/null | grep <process_name/id>"
#Using pmap to get the actual memory usage for a process
pmap -x <pid>
#Using awk to create a key value pair
awk -F',' 'BEGIN {j=0} {for(i=1;i<= NF;i++) { if (j == 0) {name[i]=$i;} else {print i,name[i],"=",$i;}} j++; }'
#Expect script section
This is to login to other machine using expect script
#!/usr/bin/expect
spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no user@machine
expect "password"
send "$PASSWORD\n"
interact