Check These Out
Killall5 will kill your session and redirect to login screen.
-Very useful when suffering display problems.
-Can use F1-F6
-Need to login in the particular console if not already
This will keep trying to reconnect your netcat connection
can be used with SSH or Telnet, just substitute nc for ssh or telnet
very useful for troubleshooting VPNs were you want to send continuous packets towards a destination to trace.
Similar to the original, but is much faster since it only needs to write the last byte as zero. A diff on testfile and testfile.seek will return that they are the same.
Use multiple patterns with grep -v. So you can print all lines in a file except those containing the multiple patterns you specify.
I often need to send screenshots to other people to explain settings and whatever.
So I created this oneline which I use to create the screenshot with imagemagik, upload it via scp to my server and then the command opens an firefox tab with the screenshot.
The screenshot can be a region or a window.
You just have to replace the parts beginning with YOUR.
SSH can be controlled trough an ~ escape sequence. Example, to terminate the current ssh connection, type a newline, then the ~ character, and last a . character.
This is useful eg when an ssh connection hangs after you reboot a machine and the connection hangs.
This Anti-TarBomb function makes it easy to unpack a .tar.gz without worrying about the possibility that it will "explode" in your current directory. I've usually always created a temporary folder in which I extracted the tarball first, but I got tired of having to reorganize the files afterwards. Just add this function to your .zshrc / .bashrc and use it like this;
$ atb arch1.tar.gz
and it will create a folder for the extracted files, if they aren't already in a single folder.
This only works for .tar.gz, but it's very easy to edit the function to suit your needs, if you want to extract .tgz, .tar.bz2 or just .tar.
More info about tarbombs at http://www.linfo.org/tarbomb.html
Tested in zsh and bash.
UPDATE: This function works for .tar.gz, .tar.bz2, .tgz, .tbz and .tar in zsh (not working in bash):
$ atb() { l=$(tar tf $1); if [ $(echo "$l" | wc -l) -eq $(echo "$l" | grep $(echo "$l" | head -n1) | wc -l) ]; then tar xf $1; else mkdir ${1%.t(ar.gz||ar.bz2||gz||bz||ar)} && tar xf $1 -C ${1%.t(ar.gz||ar.bz2||gz||bz||ar)}; fi ;}
UPDATE2: From the comments; bepaald came with a variant that works for .tar.gz, .tar.bz2, .tgz, .tbz and .tar in bash:
$ atb() {shopt -s extglob ; l=$(tar tf $1); if [ $(echo "$l" | wc -l) -eq $(echo "$l" | grep $(echo "$l" | head -n1) | wc -l) ]; then tar xf $1; else mkdir ${1%.t@(ar.gz|ar.bz2|gz|bz|ar)} && tar xf $1 -C ${1%.t@(ar.gz|ar.bz2|gz|bz|ar)}; fi ; shopt -u extglob}
This command will find the biggest files recursively under a certain directory, no matter if they are too many. If you try the regular commands ("find -type f -exec ls -laSr {} +" or "find -type f -print0 | xargs -0 ls -laSr") the sorting won't be correct because of command line arguments limit.
This command won't use command line arguments to sort the files and will display the sorted list correctly.