Posts Tagged ‘linux’
One fine day I get an email from an engineer. Apparently he removed glibc, no idea what he was doing but I was asked to somehow rebuild the box and preserve data. The problem was, we weren’t able to log into the system. Single user mode didn’t work either so now I’m [...]
To view incoming and outgoing packets on port 80
tcpdump -i eth0 tcp port 80
To view outbound traffic over port 80
tcpdump -i eth1 tcp dst port 80 and src host 192.168.0.10
To suppress verbose output, you just want to view source/destination
tcpdump -q -i eth1 tcp dst port 80 and src host 192.168.0.10
I didn’t feel like setting up a NFS share and ftp access within the organization is just plain stupid if you ask me. scp is cool but also lots of overhead.
netcat is the shit.
client -> serverA
target -> serverB
On my client (where I want to send files from), I connect to serverB via port 11223
tar -cz [...]
The other day I had to modify the resolv.conf file on all my servers. That’s 117 virtual machines, 40 physical servers along with another 20 located off-site. With ten servers I probably could’ve gotten away with copying the modified version onto each server using a for loop from the command line. Tedious [...]
Find CPU culprit.
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
List of your running processes sorted by memory use
ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | less
ps -e -o ruser,pid,vsz=Kbytes –sort user | less
find /path/to/files* -mtime +5 -exec rm {} \;
du –max-depth=1 -k | sort -n | cut -f2 | xargs -d ‘\n’ du -sh
file.txt
46012 DULANEY EVAN MOBILE AL
46013 DURHAM JEFF MOBILE AL
46015 STEEN BILL [...]
Copy and paste the following into ~/.bashrc
export PS1=’\[\033[01;32m\]\u\[\033[01;34m\]::\[\033[01;31m\]\h
\[\033[00;34m\]{\[\033[01;34m\]\w\[\033[00;34m\]}\[\033[01;32m\]-> \[\033[00m\]‘
Output:
