來源:https://mp.weixin.qq.com/s/DmfpDfWpWRV3EDItDdYgXQ
#配置vim
#http://www.cnblogs.com/ma6174/archive/2011/12/10/2283393.html
#查看當前系統版本
rpm -qi centos-release
lsb_release -a
#查看系統磁盤
df
lsblk
#快速跳轉命令 --- z
#z 的源代碼: https://github.com/rupa/z/blob/master/z.sh
# maintains a jump-list of the directories you actually use
#
# INSTALL:
# * put something like this in your .bashrc/.zshrc:
# . /path/to/z.sh
# * cd around for a while to build up the db
# * PROFIT!!
# * optionally:
# set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
# set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
# set $_Z_OWNER to your username if you want use z while sudo with $HOME kept
#
# USE:
# * z foo # cd to most frecent dir matching foo
# * z foo bar # cd to most frecent dir matching foo and bar
# * z -r foo # cd to highest ranked dir matching foo
# * z -t foo # cd to most recently accessed dir matching foo
# * z -l foo # list matches instead of cd
# * z -c foo # restrict matches to subdirs of $PWD
window與Linux換行符
區別
換行符:
1.windows中的換行符是\r\n,
2. linux/unix下的換行符是\n。
其中:
回車符:\r=0x0d (13) return; #回車(carriage return)
換行符:\n=0x0a (10) newline。#換行(newline)
windows的文本傳到linux下的轉換方法:
#1. 用sed 命令替換
sed -e 's/^M//g' dos.txt > linux.txt
# 注意: ^M 在Linux/Unix下是這樣輸入的:先按CTRL+v,接着按CTRL+SHIFT+m)
#2. 在vim 中替換
:%s/^M//g
#3.sed命令替換
sed -e 's/.$//' dos.txt > linux.txt
#dos2unix 將具有windows風格的格式文件轉化爲unix下的格式文件
dos2unix [-kn] file [newfile]
#-k : 保留該文件原來的mtime時間格式(不更新文件上次內容經過修改的時間)
#-n : 保留原來的舊文件,將轉換後的內容輸出到新文件,如:
dos2unix -n old new
Linux文本傳到windows系統的轉換方法:
sed -e 's/$/\r/' 1pnet.txt >dos.txt
#unix2dos 將具有unix風格的格式文件轉化爲具有window下的格式文件
unix2dos [-kn] file [newfile]