所有终端命令都存储在哪里以及如何查看它们?

sig*_*jog 10 command-line

我忘记了查看磁盘空间的终端命令。所以我从终端命令的资源开始,比如 pdf 和网页。
那些终端命令不是存储在文件系统的某个地方吗?
在这种情况下,它们存储在哪里以及如何查看终端命令?
PS:它就像一个单一的命令,它列出并显示系统中存储的所有其余命令。

saj*_*i89 22

您可以尝试使用该apropos命令来查找知道该命令的基本概念的命令。例如,如果您需要查找处理disk函数的命令,请尝试:apropos disk。使用的好处apropos是它给出了命令的简短描述。

例如:

$ apropos disk
arm_sync_file_range (2) - sync a file segment with disk
baobab (1)           - A graphical tool to analyze disk usage
cfdisk (8)           - display or manipulate disk partition table
cgdisk (8)           - Curses-based GUID partition table (GPT) manipulator
df (1)               - report file system disk space usage
dvd+rw-booktype (1)  - format DVD+-RW/-RAM disk with a logical format
dvd+rw-format (1)    - format DVD+-RW/-RAM disk
dvd+rw-mediainfo (1) - display information about dvd drive and disk
fdformat (8)         - low-level format a floppy disk
fdisk (8)            - manipulate disk partition table
gdisk (8)            - Interactive GUID partition table (GPT) manipulator
git-count-objects (1) - Count unpacked number of objects and their disk consumption
git-credential-store (1) - Helper to store credentials on disk
gnome-disk-image-mounter (1) - Attach and mount disk images
gnome-disks (1)      - the GNOME Disks application
grub-mkstandalone (1) - make a memdisk-based GRUB image
grub-render-label (1) - generate a .disk_label for Apple Macs.
hd (4)               - MFM/IDE hard disk devices
initrd (4)           - boot loader initialized RAM disk
mbadblocks (1)       - tests a floppy disk, and marks the bad blocks in the FAT
mcat (1)             - dump raw disk image
mcheck (1)           - verify all files on an MS-DOS formatted disk
memdiskfind (1)      - utility to search for a MEMDISK instance
mformat (1)          - add an MSDOS filesystem to a low-level formatted floppy disk
mkdiskimage (1)      - Create a blank MS-DOS formatted hard disk image
mmount (1)           - mount an MSDOS disk
mpartition (1)       - partition an MSDOS hard disk
mtools (1)           - utilities to access DOS disks in Unix.
mxtar (1)            - Wrapper for using GNU tar directly from a floppy disk
mzip (1)             - change protection mode and eject disk on Zip/Jaz drive
netscsid (1)         - write data to optical disk media
partx (8)            - tell the Linux kernel about the presence and numbering of on-disk partitions
quotactl (2)         - manipulate disk quotas
ram (4)              - ram disk device
sd (4)               - driver for SCSI disk drives
sfdisk (8)           - partition table manipulator for Linux
sgdisk (8)           - Command-line GUID partition table (GPT) manipulator for Linux and Unix
sync (2)             - commit buffer cache to disk
sync (8)             - synchronize data on disk with memory
sync_file_range (2)  - sync a file segment with disk
sync_file_range2 (2) - sync a file segment with disk
syncfs (2)           - commit buffer cache to disk
udisks (8)           - Disk Manager
udisksctl (1)        - The udisks command line tool
udisksd (8)          - The udisks system daemon
usb-creator-gtk (8)  - Ubuntu startup disk creation tool for Gtk+
wodim (1)            - write data to optical disk media
Run Code Online (Sandbox Code Playgroud)

至于系统命令的位置,大部分命令都存放在以下目录中:

/bin/
/usr/bin
/usr/sbin
/sbin
Run Code Online (Sandbox Code Playgroud)

您可以使用该ls命令列出存储在每个目录中的特定命令。

了解更多信息:

更新:

您可以使用echo $PATH, 查找当前为可执行文件指定的所有路径:

例如:

$ echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Run Code Online (Sandbox Code Playgroud)

然后,您可以使用ls每个单独的文件夹(每个文件夹由 分隔:)来查找该路径中存在的可执行命令。

PATH 是类 Unix 操作系统、DOS、OS/2 和 Microsoft Windows 上的环境变量,指定一组可执行程序所在的目录。通常,每个正在执行的进程或用户会话都有自己的 PATH 设置。

礼貌: http : //en.wikipedia.org/wiki/PATH_%28variable%29

apropos输出括号中的man数字是指节号。这些man页面被分为不同的部分,即:

  1. 命令(程序)

    用户可以在 shell 中执行的那些命令。

  2. 系统调用

    那些必须由内核执行的功能。

  3. 图书馆调用

    大多数 libc 函数。

  4. 特殊文件(设备)

    在 /dev 中找到的文件。

  5. 文件格式和约定

    /etc/passwd 和其他人类可读文件的格式。

  6. 游戏

  7. 概述、约定和杂项

    各种主题、约定和协议、字符集标准和其他杂项的概述。

  8. 系统管理命令

    像 mount(8) 这样的命令,其中很多只有 root 才能执行。系统管理命令(通常仅适用于 root)

  9. 内核例程 [非标准]

礼貌: http : //manpages.ubuntu.com/manpages/trusty/man7/man-pages.7.html

  • $echo $PATH 将告诉您所有命令的位置。您可以获取 $PATH 变量的输出并执行以下操作: $ls /bin /usr/local /usr/bin 并获取路径中所有内容的列表。 (2认同)

hee*_*ayl 7

您还可以使用man -k <keyword>基于特定关键字搜索任何命令。apropos其他答案中提到的实际上使用由mandb. 因此,以下两个将产生相同的输出:

man -k disk
apropos disk
Run Code Online (Sandbox Code Playgroud)

默认情况下,以上两者都提供基于正则表达式的模式搜索。

见的联机帮助页man,并apropos了解详细信息。


归档时间:

查看次数:

29197 次

最近记录:

11 年,2 月 前