=Start=
#urldecode/urlencode alias urldecode='python -c "import sys, urllib as ul; \ print ul.unquote_plus(sys.argv[1])"' alias urlencode='python -c "import sys, urllib as ul; \ print ul.quote_plus(sys.argv[1])"' #rot13 encode alias rot13="tr 'a-zA-Z' 'n-za-mN-ZA-M'"
#Bash history export HISTFILESIZE=999999 export HISTSIZE=999999 shopt -s histappend HISTTIMEFORMAT="@%F_%T " export HISTTIMEFORMAT #MySQL export MYSQL_PS1="\u@\h [\d]> "
mcd() { mkdir -p "$1"; cd "$1"; } mtoday() { mkdir -p "$HOME/$(date +%Y_%B)/$(date +%Y-%-m-%-d)"; cd "$HOME/$(date +%Y_%B)/$(date +%Y-%-m-%-d)"; } backup() { cp "$1"{,.bak}; } md5check() { md5sum "$1" | grep "$2"; } sha1check() { sha1sum "$1" | grep "$2"; } md5dir() { if [ -d "$1" ]; then path=$(readlink -f "$1") save_name=$(date +%Y%m%d)$(echo "$path" | tr '/' '_') find "$path" -type f -print0 | xargs -0 md5sum > "$save_name".md5 else echo "'$1' is not a directory !!!" fi } extract() { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xjf $1 ;; *.tar.gz) tar xzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar e $1 ;; *.gz) gunzip $1 ;; *.tar) tar xf $1 ;; *.tbz2) tar xjf $1 ;; *.tgz) tar xzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted via extract()" ;; esac else echo "'$1' is not a valid file" fi }
alias genpasswd="strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo" alias genpasswd2="uuidgen" alias listen='netstat -lntp' alias listen2='sudo lsof -P -i -n' alias wuliao='man $(ls /bin | shuf | head -1)' alias dirtree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
=EOF=
《 “我的一些.bashrc技巧” 》 有 8 条评论
如何解压「*.tar.xz」格式的压缩文件?
`
$ wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.25.tar.xz
$ xz -d coreutils-8.25.tar.xz
$ tar -xf coreutils-8.25.tar
或
$ xz -d –stdout coreutils-8.25.tar.xz| tar xf –
`
Shell中如何快速计算两个日期之间的天数?
`
datediff() {
d1=$(date -d “$1” +%s)
d2=$(date -d “$2” +%s)
echo $(( (d1 – d2) / 86400 )) days
}`
将上面的内容加入~/.bashrc或~/.zshrc,即可方便的使用。
ssh相关操作
http://kb.drops.wiki/doku.php?id=pentest:ssh%E7%9B%B8%E5%85%B3%E6%93%8D%E4%BD%9C
`
unset HISTFILE;export HISTFILE=;export HISTFILE=/dev/null;export HISTSIZE=0;export HISTFILESIZE=0;export HISTIGNORE=*;export HISTCONTROL=ignorespace
`
各种语言一句话反弹shell
http://kb.drops.wiki/doku.php?id=pentest:%E5%90%84%E7%A7%8D%E8%AF%AD%E8%A8%80%E4%B8%80%E5%8F%A5%E8%AF%9D%E5%8F%8D%E5%BC%B9shell
Linux跳板实用命令记录
http://3389.in/33.htm
使用 utmpdump 监控 CentOS 用户登录历史
https://linux.cn/article-4213-1.html
http://xmodulo.com/monitor-user-login-history-centos-utmpdump.html
http://unix.stackexchange.com/questions/126166/how-to-interpret-all-fields-of-utmpdump-var-log-utmp
fwtmp 命令(AIX)
https://www.ibm.com/support/knowledgecenter/zh/ssw_aix_72/com.ibm.aix.cmds2/fwtmp.htm
http://www.unix.com/shell-programming-and-scripting/177966-understanding-output-fwtmp.html
查看系统中现有的alias和function列表
`
$ alias
$ functions
$ type alias
alias is a shell builtin
$ type functions
functions is a shell builtin
$ type function
function is a reserved word
`
https://www.digitalocean.com/community/tutorials/an-introduction-to-useful-bash-aliases-and-functions
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x246.html
(awesome-ninja-admins)一些极好的 列表、手册、博客、技巧、一句话命令、工具 帮你做一个更好的管理员
https://github.com/trimstray/awesome-ninja-admins
【Linux】md5sum 生产所有文件的md5值,并对照目标文件是否相同
https://blog.csdn.net/imliuqun123/article/details/88838785
`
现在加入有很多很多文件需要测试md5,想看下是否都传输成功了,如何批量生成文件的md5并且逐条对照呢?
下面来简单介绍下:
md5sum这个命令有一个选项“-c”
这个选项的意思是check,检查对照目标文件的md5值是否和源文件生成的md5是否相同
`
Linux下批量校验文件md5值(find+diff)
http://www.361way.com/linux-md5check/5209.html
listing md5sum for all files
https://stackoverflow.com/questions/39604202/listing-md5sum-for-all-files
Decoding URL encoding (percent encoding)
https://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding
`
# Python2
# Python3
# sed
# Bash function
# Bash function + xxd
# PHP
# Perl
# awk
`