linux 检查兼容性命令,Linux基本命令

1、判断文件夹是否存在

if [ ! -d backup ];then

//不存在 创建多级目录

mkdir -p backup/demo

fi

注意:if条件判断结束一定要加”;“ 方括号[]两边一定要有空格

参数说明:

-e filename 如果filename存在,则为true

-d filename 如果filename为目录,则为true

-f filename 如果filename为常规文件,则为真

-L filename 如果 filename为符号链接,则为真

-r filename 如果 filename可读,则为真

-w filename 如果 filename可写,则为真

-x filename 如果 filename可执行,则为真

-s filename 如果文件长度不为0,则为真

-h filename 如果文件是软链接,则为真

2、创建文件夹、文件

2.1、创建文件夹

mkdir 文件夹

mkdir file 创建file空目录

mkdir -m 设定权限

mkdir -m 777 file 创建可读可写可执行权限的file文件夹

mkdir -p 递归创建多级目录

mkdir -p file1/file2/file3

mkdir -v 每次创建新目录都显示信息

mkdir -v file

显示信息:mkdir: created directory 'file'

mkdir -pv scf/{lib/,bin/,doc/{info,product},logs/{info,product},service/deploy/{info,product}}

mkdir: 已创建目录 “scf”

mkdir: 已创建目录 “scf/lib”

mkdir: 已创建目录 “scf/bin”

mkdir: 已创建目录 “scf/doc”

mkdir: 已创建目录 “scf/doc/info”

mkdir: 已创建目录 “scf/doc/product”

mkdir: 已创建目录 “scf/logs”

mkdir: 已创建目录 “scf/logs/info”

mkdir: 已创建目录 “scf/logs/product”

mkdir: 已创建目录 “scf/service”

mkdir: 已创建目录 “scf/service/deploy”

mkdir: 已创建目录 “scf/service/deploy/info”

mkdir: 已创建目录 “scf/service/deploy/product”

2.2、创建文件

touch 用来创建文件或者修改文件的时间戳

-a:或--time=atime或--time=access或--time=use 只更改存取时间;

-c:或--no-create 不建立任何文件;

-d: 使用指定的日期时间,而非现在的时间;

-f:此参数将忽略不予处理,仅负责解决BSD版本touch指令的兼容性问题;

-m:或--time=mtime或--time=modify 只更该变动时间;

-r: 把指定文件或目录的日期时间,统统设成和参考文件或目录的日期时间相同;

-t: 使用指定的日期时间,而非现在的时间;

创建不存在文件

touch file.txt

一次创建多个文件

touch file1.txt file2.txt file3.txt

在文件夹里面添加

touch test/file.txt

3、文件对比命令

diff [选项] from-file to-file

from-file:对比源文件

to-file:对比目标文件

选项:

-:指定要显示多少行的文本。此参数必须与-c或-u参数一并使用

-a或--text:diff预设只会逐行比较文本文件

-b或--ignore-space-change:不检查空格字符的不同

-B或--ignore-blank-lines:不检查空白行

-c  显示全部内文,并标出不同之处。

-C或--context  与执行"-c-"指令相同。

-d或--minimal  使用不同的演算法,以较小的单位来做比较。

-D或ifdef  此参数的输出格式可用于前置处理器巨集。

-e或--ed  此参数的输出格式可用于ed的script文件。

-f或-forward-ed  输出的格式类似ed的script文件,但按照原来文件的顺序来显示不同处。

-H或--speed-large-files  比较大文件时,可加快速度。

-l或--ignore-matching-lines  若两个文件在某几行有所不同,而这几行同时都包含了选项中指定的字符或字符串,则不显示这两个文件的差异。

-i或--ignore-case  不检查大小写的不同。

-l或--paginate  将结果交由pr程序来分页。

-n或--rcs  将比较结果以RCS的格式来显示。

-N或--new-file  在比较目录时,若文件A仅出现在某个目录中,预设会显示:

Only in目录:文件A若使用-N参数,则diff会将文件A与一个空白的文件比较。

-p  若比较的文件为C语言的程序码文件时,显示差异所在的函数名称。

-P或--unidirectional-new-file  与-N类似,但只有当第二个目录包含了一个第一个目录所没有的文件时,才会将这个文件与空白的文件做比较。

-q或--brief  仅显示有无差异,不显示详细的信息。

-r或--recursive  比较子目录中的文件。

-s或--report-identical-files  若没有发现任何差异,仍然显示信息。

-S或--starting-file  在比较目录时,从指定的文件开始比较。

-t或--expand-tabs  在输出时,将tab字符展开。

-T或--initial-tab  在每行前面加上tab字符以便对齐。

-u,-U或--unified=  以合并的方式来显示文件内容的不同。

-v或--version  显示版本信息。

-w或--ignore-all-space  忽略全部的空格字符。

-W或--width  在使用-y参数时,指定栏宽。

-x或--exclude  不比较选项中所指定的文件或目录。

-X或--exclude-from  您可以将文件或目录类型存成文本文件,然后在=中指定此文本文件。

-y或--side-by-side  以并列的方式显示文件的异同之处。

--help  显示帮助。

--left-column  在使用-y参数时,若两个文件某一行内容相同,则仅在左侧的栏位显示该行内容。

--suppress-common-lines  在使用-y参数时,仅显示不同之处

diff test.sh test1.sh

输出:

1,4d0

< if [ "`diff -w package.json ./rntest/cstTask/package.json`" ];then

< echo `diff -w package.json ./rntest/cstTask/package.json`

< mkdir tests

< fi

4、拷贝命令

4.1、文件复制命令

cp [选项] 源文件(source) 目标文件或者目录(destination)

-a: 是指archive的意思,也说是指复制所有的目录

-d: 若源文件为连接文件(link file),则复制连接文件属性而非文件本身

-f: 强制(force),若有重复或其它疑问时,不会询问用户,而强制复制

-i: 若目标文件(destination)已存在,在覆盖时会先询问是否真的操作

-l: 建立硬连接(hard link)的连接文件,而非复制文件本身

-p: 与文件的属性一起复制,而非使用默认属性

-r: 递归复制,用于目录的复制操作

-s: 复制成符号连接文件(symbolic link),即“快捷方式”文件

-u: 若目标文件比源文件旧,更新目标文件

cp -f package.json ./backup

4.2、文件移动

mv [选项] source destination

-f: force,强制直接移动而不询问

-i: 若目标文件(destination)已经存在,就会询问是否覆盖

-u: 若目标文件已经存在,且源文件比较新,才会更新

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux Hardware Compatibility Lists Debian GNU/Linux device driver check page - This database verifies the PCI devices at this time (X drivers, ISA, USB, IEEE1394 or any other devices are out of its focus). Paste your result of 'lspci -n' taken from GNU/Linux OS (such as Debian, Knoppix, RedHat, and so on) to the box, then push 'Check' button. openSUSE Hardware Compatibility List - The following pages are used by the openSUSE community to record the compatibility of various hardware and full systems with SUSE Linux. Please share your experience by adding your hardware, especially if you had some issue that you overcame. Mandriva Hardware Database - This hardware database allows you to check the compatibility of your hardware with the Mandriva Linux OS. The certified hardware has the highest level of compatibility. Red Hat Hardware Catalog - Database containing certified hardware for Red Hat products. UbuntuUsers Hardwaredatenbank - Auf dieser Seite soll eine Hardwaredatenbank fuer Ubuntu Linux entstehen. Sie koennen hier unter Ubuntu Linux verwendete (neuere) Hardware hinzufuegen, welche gut laeuft. LinuxQuestions.org HCL - This is the Linux Hardware Compatibility List from LinuxQuestions.org. Linux Hardware Compatibility HOWTO - This document attempts to list most of the hardware known to be either supported or unsupported under Linux. Linux Hardware Components - The manufacturers and distributors listed on this site sell hardware and peripherals that are Linux-friendly. If you're looking for drivers or need to know if your hardware is supported, this is a good place to find out. LinuxCompatible.org Compatibility List - This is a user submitted compatibility database for hardware running under GNU/Linux. Phoronix Linux Compatible Hardware - is designed to be a community-driven indexing system for computer hardware under GNU/Linux. This system allows you to post GNU/Linux information on hardware as well as sharing your own personal experiences when it comes to GNU/Linux compatibility. You are also able to browse and search the database for other hardware as well. FSF Hardware Database - Free Software Foundation's listing of hardware that supports free software. Linux-Hardware.org - Die Linux Hardware Datenbank soll Usern einen Ueberblick verschaffen, welche Hardware von welcher Distribution unterstuezt wird. Sie ist so angelegt, dass sie problemlos fuer alle Distributionen genutzt und von Usern ergaenzt werden kann. Linux Support for HP PC's - This page provides an overview of Linux support for HP PC's and peripeherals. Don't base purchasing decisions on the information provided here. This site's main goal is to provide information for people already owning an HP PC. Tuxhardware.de - (TU)X-beliebige Hardware. Tuxhardware.de ist ein Online- Shop in Deutschland der Produkte mit LINUX- Eignung anbietet. Hier finden Sie u.a. auch Installationsanleitungen, Tipps & Tricks und Links zu Treibern. Unix printer compatiblity database listing - The LinuxPrinting.org printer database contains a wealth of information about specific printers, along with extensive driver information, basic specifications, and an associated set of configuration tools. You can just go straight to a particular printer, or you can list all printers from a given manufacturer. Looking for a printer to buy? Take a look at: "Suggested Printers for Free Software Users". Gutenprint Supported Printers - Gutenprint, formerly called Gimp-Print, offers high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with Ghostscript, CUPS, Foomatic, and the Gimp. TurboPrint Supported Printers - This is the list of TurboPrint Supported Printers. It includes almost every Canon, Epson & HP and many Brother printers. TurboPrint makes it possible to use the latest color printers with Linux. It is designed to produce maximum quality photo prints as well as high-speed text documents. Printer set-up and configuration is as simple as on Windows or MacOS. TurboPrint is a high-quality printer driver system for Linux built on existing standards (lpr or CUPS printer spooler, ghostscript interpreter for Postscript) thus achieving easy integration and maximum compatibility with existing applications. Von TurboPrint unterstuetzte Drucker - TurboPrint ermoeglicht den Einsatz moderner Farbdrucker unter Linux. Mit TurboPrint erzielen Sie sowohl die bestmoegliche Druckqualitaet bei fotorealistischen Ausdrucken, als auch eine schnelle Ausgabe von Text-Dokumenten. Drucker-Einrichtung und Konfiguration sind durch grafische Menues genauso einfach wie in MS Windows. TurboPrint unterstuetzt fast alle Canon, Epson & HP und viele Brother Drucker. ESP Print Pro Supported Printers - ESP Print Pro supports thousands of printers - search for yours. ESP Print Pro is a complete (commercial) UNIX cross- platform printing software package, containing thousands of high quality printer drivers for AIX, Digital UNIX, HP-UX, IRIX, Linux and Solaris (Intel and SPARC). A free 21-day demo license is available for first-time users. SANE: Supported Devices - shows if your scanner is supported and if yes, by which backend. If it's not supported, it may at least point to documentation or test programs. The search engine contains information from the latest stable SANE release, the development ("CVS") version of SANE and from external backends. The database is updated once per day. VueScan: Supported Scanners - is a continuously upgraded list of VueScan supported scanners. VueScan supports more than 500 different scanners, and these are organized by vendor name. VueScan is a scanning utility that works with most high- quality flatbed and film scanners to produce scans that have excellent color fidelity and color balance. A free trial version is available. Digital Camera Support for UNIX, Linux and BSD - trys to explain how to find out if your camera may work or not under a UNIX system. This site includes a table summarize for digital cameras, how they are supported under UNIX operating systems. Supported Cameras in gPhoto - On this page, you find a list of the supported camera models of the current release of gPhoto (=digital camera software applications for Unix-like systems. gPhoto2 is a free, redistributable, ready to use set of digital camera software applications for Unix-like systems). Support for additional cameras may be in the current libgphoto2 SVN trunk code. They will be added to the next release. If your camera is neither supported in the current release nor in current SVN trunk, it is possible that it is an old camera for which the original gPhoto driver has not been ported yet (mostly due to lack of demand) or it is a new camera for which there is no support at all. Working Webcams with PWC - This is a web-based collaboration area for the next generation Philips Web Camera Linux Kernel Module. On this page, you find a list of the supported Webcams. ALSA Soundcard Matrix - ALSA ("Advanced Linux Sound Architecture") supported audio- cards or chipsets. ALSA provides audio and MIDI functionality to the Linux operating system. OSS Sound Card List - OSS supported audio- cards or chipsets. This list is not 100% complete. There are dozens of sound cards that are based on some standard sound chips (or motherboard chipset) made by vendors like Intel, VIA, Cirrus/Crystal, Analog Devices, Realtek, Yamaha, C'Media, Trident, Sigmatel and many others. Such cards may not be listed in the following list but they are still supported. Driver Status for XFree86 4.3.0 - provides information about the status of the driver and hardware support in XFree86 4.3.0 compared with that in XFree86 3.3.6. Xi Graphics Accelerated-X support - listed by Notebooks/ Laptops, Graphics Cards, Graphics Chips. Li

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值