Documentation
Unix 中命令可用的錯誤消息列表
是否可以找出命令包含的錯誤消息?例如,我想查看
mkfs.ext3
命令在不同錯誤情況下列印的錯誤消息列表。我應該查看原始碼還是有其他方法可以實現這一目標?
原始碼將是你最好的選擇。您可以在緊要關頭使用該命令
strings
來獲取有關二進製文件及其可能包含的文本的一些基本資訊。例子
這是輸出的前 20 行。這些是其中包含字元串“error”的行。
$ strings /usr/sbin/mkfs.ext3 | grep -i error | head -20 Syntax error in mke2fs config file (%s, line #%d) Couldn't init profile successfully (error: %ld). Error while enabling multiple mount protection feature. MMP error info: last update: %s node: %s device: %s Syntax error in profile section header Syntax error in profile relation [ERROR] %s:%d:%s:: Unable to allocate dquot [ERROR] %s:%d:%s:: Cannot initialize io on quotafile [ERROR] %s:%d:%s:: Cannot finish IO on new quotafile: %s [ERROR] %s:%d:%s:: Unable to allocate quota handle [ERROR] %s:%d:%s:: Failed to allocate quota context [ERROR] %s:%d:%s:: Failed to allocate dictionary [ERROR] %s:%d:%s:: while opening inode scan. ret=%ld [ERROR] %s:%d:%s:: while getting next inode. ret=%ld [ERROR] %s:%d:%s:: Open quota file failed [ERROR] %s:%d:%s:: Error scanning dquots [ERROR] %s:%d:%s:: ext2fs_file_llseek failed: %ld [ERROR] %s:%d:%s:: ext2fs_file_read failed: %ld [ERROR] %s:%d:%s:: ext2fs_file_write failed: %ld [ERROR] %s:%d:%s:: ext2fs_file_open failed: %s