Linux 基本命令___0002

来源: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中的换行符是 ,
2. linux/unix下的换行符是 。
其中:
回车符: =0x0d (13) return; #回车(carriage return)
换行符: =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/$/
/' 1pnet.txt >dos.txt
#unix2dos  将具有unix风格的格式文件转化为具有window下的格式文件
unix2dos [-kn] file [newfile]
原文地址:https://www.cnblogs.com/adawong/p/7429869.html