\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{neilwai} \pdfinfo{ /Title (linux.pdf) /Creator (Cheatography) /Author (neilwai) /Subject (Linux常用网络传输工具命令 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{15A31A} \definecolor{LightBackground}{HTML}{F0F9F0} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Linux常用网络传输工具命令 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{neilwai} via \textcolor{DarkBackground}{\uline{cheatography.com/196453/cs/41292/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}neilwai \\ \uline{cheatography.com/neilwai} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 15th November, 2023.\\ Updated 15th November, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{ssh 常用参数}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{语法格式}} & ssh {[}参数{]} 域名或IP地址 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -b \seqsplit{bind\_address} & \seqsplit{在拥有多个接口或地址别名的机器上}, 指定收发接口. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} -c \seqsplit{blowfish|3des|des} & \seqsplit{选择加密会话的密码术}. \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} -f & 要求 \seqsplit{在执行命令前退至后台}. \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} -g & \seqsplit{允许远端主机连接本地转发的端口}. \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} -i \seqsplit{identity\_file} & 指定一个 RSA 或 DSA \seqsplit{认证所需的身份(私钥)文件}. \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} -l login\_name & \seqsplit{指定登录远程主机的用户}. \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} -p port & \seqsplit{指定远程主机的端口}. \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} -X & 允许 X11 转发. \tn % Row Count 19 (+ 1) % Row 9 \SetRowColor{white} -C & 要求进行数据压缩 \tn % Row Count 20 (+ 1) % Row 10 \SetRowColor{LightBackground} -F configfile & \seqsplit{指定一个用户级配置文件}. \tn % Row Count 22 (+ 2) % Row 11 \SetRowColor{white} -L \seqsplit{port:host:hostport} & \seqsplit{将本地机(客户机)的某个端口转发到远端指定机器的指定端口}. \tn % Row Count 26 (+ 4) % Row 12 \SetRowColor{LightBackground} -R \seqsplit{port:host:hostport} & \seqsplit{将远程主机(服务器)的某个端口转发到本地端指定机器的指定端口}. \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{ssh 常用参数 (cont)}} \tn % Row 13 \SetRowColor{LightBackground} -D port & \seqsplit{指定一个本地端口代理}. \tn % Row Count 2 (+ 2) % Row 14 \SetRowColor{white} -v & \seqsplit{显示执行过程详细信息} \tn % Row Count 4 (+ 2) % Row 15 \SetRowColor{LightBackground} -V & 显示版本信息 \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{ssh 登陆}} \tn % Row 0 \SetRowColor{LightBackground} ssh user@host -p (Port) & 登陆远程主机 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ssh user@host -p (Port) -i /key & \seqsplit{指定密钥文件登陆} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} ssh -L port:localhost:port user@server & \seqsplit{将本地机(客户机)的某个端口转发到远端指定机器的指定端口} \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} ssh -R port:localhost:port user@server & \seqsplit{将远程主机(服务器)的某个端口转发到本地端指定机器的指定端口} \tn % Row Count 13 (+ 5) % Row 4 \SetRowColor{LightBackground} ssh -X user@host & 开启 X11 转发功能 \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{ssh keygen}} \tn % Row 0 \SetRowColor{LightBackground} ssh-keygen -t algo -b bit -f \textless{}filename\textgreater{} & 构建 ssh 密钥对 \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} ssh-keygen -e -f \textasciitilde{}/id\_dsa \textgreater{} \textasciitilde{}/id\_dsa\_com.pub & \seqsplit{把密钥转换成OpenSSH格式} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} ssh-keygen -F host & \seqsplit{查看是否已经添加了对应主机的密钥} \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} ssh-keygen -R host & 删除主机密钥 \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{rsync}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\# \seqsplit{将本地目录与远程目录相关联,保持文件同步} \newline % Row Count 2 (+ 2) rsync -r /Dir 192.168.10.10:/Dir \newline % Row Count 3 (+ 1) \# \seqsplit{将远程目录与本地目录相关联,保持文件同步} \newline % Row Count 5 (+ 2) rsync -r 192.168.10.10:Dir /Dir \newline % Row Count 6 (+ 1) \# \seqsplit{关联两个本地的目录,保持文件同步} \newline % Row Count 8 (+ 2) rsync -r /Dir1 /Dir2 \newline % Row Count 9 (+ 1) \# \seqsplit{列出本地指定目录内的文件列表} \newline % Row Count 10 (+ 1) rsync /Dir2/ \newline % Row Count 11 (+ 1) \# \seqsplit{列出远程指定目录内的文件列表} \newline % Row Count 12 (+ 1) rsync 192.168.10.10:/Dir/% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.08 cm} x{5.92 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{curl 常用参数}} \tn % Row 0 \SetRowColor{LightBackground} -A & \seqsplit{设置用户代理标头信息} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -C & 断点续转 \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} -d & 以HTTP POST方式传送数据 \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} -H & 自定义头信息 \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} -i & \seqsplit{输出时包括protocol头信息} \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} -I & 只显示请求头信息 \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} -o & \seqsplit{设置新的本地文件名} \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} -O & \seqsplit{把输出写到该文件中,保留远程文件的文件名} \tn % Row Count 13 (+ 3) % Row 8 \SetRowColor{LightBackground} -k & \seqsplit{允许不使用证书到SSL站点} \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} -u & \seqsplit{设置服务器的用户名和密码} \tn % Row Count 17 (+ 2) % Row 10 \SetRowColor{LightBackground} -v & verbose \tn % Row Count 18 (+ 1) % Row 11 \SetRowColor{white} -{}-basic & 使用HTTP基本验证 \tn % Row Count 19 (+ 1) % Row 12 \SetRowColor{LightBackground} -{}-cacert & 设置CA证书文件 \tn % Row Count 20 (+ 1) % Row 13 \SetRowColor{white} -{}-progress-bar & 显示进度条 \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\# \seqsplit{获取指定网站的网页源码} \newline curl https://www.linux.com \newline \# \seqsplit{下载指定网站中的文件} \newline curl -O \seqsplit{https://www.linux.com/Linux.pdf} \newline \# \seqsplit{打印指定网站的HTTP响应头信息} \newline curl -I https://www.linux.com \newline \# \seqsplit{下载指定文件服务器中的文件(用户名:密码)} \newline curl -u linux:redhat \seqsplit{ftp://www.linux.com/Linux.pdf}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{wget}} \tn % Row 0 \SetRowColor{LightBackground} wget http://url/file & 下载文件 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} wget -P /home/ http//:url & \seqsplit{下载文件到指定目录} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} wget -r http://url.com/dir/ & \seqsplit{下载并递归处理所有子文件} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} wget -N http://url/file & \seqsplit{只获取比本地更新的文件} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} wget -r -A jpg,png http://url.com/dir/ & \seqsplit{只递归下载文件类型:} jpg,png files \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} wget -c http://url/file & 断点续传下载 \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} wget -O filename http://url/FILE & 将文档写入 filename \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} wget -b http://url/abc.zip & 后台下载 \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{scp}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{语法格式}} & scp 参数 文件或目录名 {[}远程服务器信息{]} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} -P port & \seqsplit{指定连接远程连接端口} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} -r & \seqsplit{递归的复制整个文件夹} \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} scp File.cfg 192.168.10.10:/Dir & \seqsplit{将本地文件复制到远程主机的指定目录中} \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} scp \seqsplit{192.168.10.10:/Dir/File.cfg} /root & \seqsplit{将远程主机中的文件复制到本地} \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} scp -r Dir 192.168.10.10:/Dir & \seqsplit{将本地目录复制到远程主机的指定目录中} \tn % Row Count 16 (+ 3) % Row 6 \SetRowColor{LightBackground} scp -r 192.168.10.10:/Dir /root & \seqsplit{将远程主机中的目录复制到本地} \tn % Row Count 19 (+ 3) % Row 7 \SetRowColor{white} scp -p File \seqsplit{username@192.168.10.10:/Dir} & \seqsplit{将本地文件复制到远程主机的目录中,指定用户身份,并保留原始文件的权限属性。} \tn % Row Count 25 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}