Linux fdformat命令用于对指定的软碟机装置进行低阶格式化。
使用这个指令对软碟格式化的时候,最好指定像是下面的装置:
如果使用像是 /dev/fd0 之类的装置,如果里面的磁碟不是标准容量,格式化可能会失败。在这种情况之下,使用者可以用 setfdprm 指令先行指定必要参数。
fdformat [-n] device
参数:
fdformat -n /dev/fd0h1440
将磁碟机 A 的磁片格式化成 1.4MB 的磁片。并且省略确认的步骤。
Linux fsconf命令用于设置文件系统相关功能。
fsconf是Red Hat Linux发行版专门用来调整Linux各项设置的程序。
fsconf [--check]
参数:
Linux fsck.minix命令用于检查文件系统并尝试修复错误。
当minix文件系统发生错误时,可用fsck.minix指令尝试加以参考。
fsck.minix [-aflmrsv][外围设备代号]
参数:
Linux fsck(英文全拼:file system check)命令用于检查与修复 Linux 档案系统,可以同时检查一个或多个 Linux 档案系统。
fsck [-sACVRP] [-t fstype] [--] [fsck-options] filesys [...]
参数 :
检查 msdos 档案系统的 /dev/hda5 是否正常,如果有异常便自动修复 :
fsck -t msdos -a /dev/hda5
注意 此指令可与 /etc/fstab 相互参考操作来加以了解。
Linux ext2ed命令是ext2文件系统编辑程序。
ext2ed可直接处理硬盘分区上的数据,这指令只有Red Hat Linux才提供。
ext2ed
一般指令:
Linux e2fsck命令用于检查使用 Linux ext2 档案系统的 partition 是否正常工作。
e2fsck [-pacnydfvFV] [-b superblock] [-B blocksize] [-l|-L bad_blocks_file] [-C fd] device
参数说明:
检查 /dev/hda5 是否正常,如果有异常便自动修复,并且设定若有问答,均回答[是] :
e2fsck -a -y /dev/hda5
注意 :
大部份使用 e2fsck 来检查硬盘 partition 的情况时,通常都是情形特殊,因此最好先将该 partition umount,然后再执行 e2fsck 来做检查,若是要非要检查 / 时,则请进入 singal user mode 再执行。
Linux dd 命令用于读取、转换并输出数据。
dd 可从标准输入或文件中读取数据,根据指定的格式来转换数据,再输出到文件、设备或标准输出。
参数说明:
在Linux 下制作启动盘,可使用如下命令:
dd if=boot.img of=/dev/fd0 bs=1440k
将testfile文件中的所有英文字母转换为大写,然后转成为testfile_1文件,在命令提示符中使用如下命令:
dd if=testfile_2 of=testfile_1 conv=ucase
其中testfile_2 的内容为:
$ cat testfile_2 #testfile_2的内容 HELLO LINUX! Linux is a free unix-type opterating system. This is a linux testfile! Linux test
转换完成后,testfile_1 的内容如下:
$ dd if=testfile_2 of=testfile_1 conv=ucase #使用dd 命令,大小写转换记录了0+1 的读入 记录了0+1 的写出 95字节(95 B)已复制,0.000131446 秒,723 KB/s cmd@hdd-desktop:~$ cat testfile_1 #查看转换后的testfile_1文件内容 HELLO LINUX! LINUX IS A FREE UNIX-TYPE OPTERATING SYSTEM. THIS IS A LINUX TESTFILE! LINUX TEST #testfile_2中的所有字符都变成了大写字母
由标准输入设备读入字符串,并将字符串转换成大写后,再输出到标准输出设备,使用的命令为:
dd conv=ucase
输入以上命令后按回车键,输入字符串,再按回车键,按组合键Ctrl+D 退出,出现以下结果:
$ dd conv=ucase Hello Linux! #输入字符串后按回车键 HELLO LINUX! #按组合键Ctrl+D退出,转换成大写结果 记录了0+1 的读入 记录了0+1 的写出 13字节(13 B)已复制,12.1558 秒,0.0 KB/s
Linux cfdisk命令用于磁盘分区。
cfdisk是用来磁盘分区的程序,它十分类似DOS的fdisk,具有互动式操作界面而非传统fdisk的问答式界面,您可以轻易地利用方向键来操控分区操作。
cfdisk [-avz][-c <柱面数目>-h <磁头数目>-s <盘区数目>][-P <r,s,t>][外围设备代号]
进行磁盘分区:
# cfsik
进行磁盘分区,使用箭头进行操作,而不使用反白表示:
# cfsik -a
进行磁盘分区,使用箭头进行操作,而不使用反白表示:
# cfsik -s 3
Linux badblocks命令用于检查磁盘装置中损坏的区块。
执行指令时须指定所要检查的磁盘装置,及此装置的磁盘区块数。
badblocks [-svw][-b <区块大小>][-o <输出文件>][磁盘装置][磁盘区块数][启始区块]
参数说明:
查看系统当前硬盘信息。
# fdisk -l
例如,显示信息如下:
Disk /dev/sda: 298.9 GB, 298999349248 bytes 255 heads, 63 sectors/track, 36351 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 262 2104483+ 82 Linux swap / Solaris /dev/sda2 * 263 32898 262148670 83 Linux /dev/sda3 32899 36351 27736222+ 83 Linux Disk /dev/sdb: 42.9 GB, 42949672960 bytes 64 heads, 32 sectors/track, 40960 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
通过命令扫描硬盘。
# badblocks -s -v /dev/sdnx
其中n表示硬盘设备名,x表示硬盘对应的分区号。例如需要检查"/dev/sda2",执行命令如下:
# badblocks -s -v /dev/sda2 Checking blocks 0 to 30681000 Checking for bad blocks (read-only test): 306809600674112/ 306810000000 30680964 30680965 30680966 30680967 30680968 30680969 30680970 30680971 30680972 30680973 ... done Pass completed, 37 bad blocks found.其中,“37 bad blocks found”表示硬盘存在37个坏块。
Linux zipinfo命令用于列出压缩文件信息。
执行zipinfo指令可得知zip压缩文件的详细信息。
zipinfo [-12hlmMstTvz][压缩文件][文件...][-x <范本样式>]
参数:
显示压缩文件信息
[root@w3cschool.cc a]# zipinfo cp.zip Archive: cp.zip 486 bytes 4 files -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 a.c -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 b.c -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 c.c -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 e.c 4 files, 0 bytes uncompressed, 0 bytes compressed: 0.0% [root@w3cschool.cc a]#
显示压缩文件中每个文件的信息
[root@w3cschool.cc a]# zipinfo -v cp.zip Archive: cp.zip 486 bytes 4 files End-of-central-directory record: ------------------------------- Actual offset of end-of-central-dir record: 464 (000001D0h) Expected offset of end-of-central-dir record: 464 (000001D0h) (based on the length of the central directory and its expected offset) This zipfile constitutes the sole disk of a single-part archive; its central directory contains 4 entries. The central directory is 248 (000000F8h) bytes long, and its (expected) offset in bytes from the beginning of the zipfile is 216 (000000D8h). There is no zipfile comment. Central directory entry #1: --------------------------- a.c offset of local header from start of archive: 0 (00000000h) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment. Central directory entry #2: --------------------------- b.c offset of local header from start of archive: 54 (00000036h) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment. Central directory entry #3: --------------------------- c.c offset of local header from start of archive: 108 (0000006Ch) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment. Central directory entry #4: --------------------------- e.c offset of local header from start of archive: 162 (000000A2h) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment.