官术网_书友最值得收藏!

The very helpful apropos command

The apropos command is one of the most helpful and yet underrated Linux commands. Let's see a brief description of what the apropos command does:

elliot@ubuntu-linux:~$ whatis apropos
apropos (1) - search the manual page names and descriptions

WOW! The apropos command helps you in searching for the right command to use to achieve a specific task. For example, let's say you want to rename a file, but you are unsure which Linux command to use; in this case, you can run the apropos rename command:

elliot@ubuntu-linux:~$ apropos rename
file-rename (1p) - renames multiple files
File::Rename (3pm) - Perl extension for renaming multiple files
gvfs-rename (1) - (unknown subject)
mmove (1) - move or rename an MSDOS file or subdirectory
mren (1) - rename an existing MSDOS file
mv (1) - move (rename) files
prename (1p) - renames multiple files
rename (1) - renames multiple files
rename.ul (1) - rename files

BOOM! It listed all the commands that have the word rename showing in the description of their man pages. I bet you can spot the mv command in the output.

Let's say you want to view the calendar but you're unsure which command to use; in this case, you can run:

elliot@ubuntu-linux:~$ apropos calendar
cal (1) - displays a calendar and the date of Easter
calendar (1) - reminder service
ncal (1) - displays a calendar and the date of Easter

You can see that it displayed the cal command in the output.

For the last example, let's say you want to display your CPU information, but you don't know which command to use; in this case, you can run:

elliot@ubuntu-linux:~$ apropos cpu 
chcpu (8) - configure CPUs
cpuid (4) - x86 CPUID access device
cpuset (7) - confine processes to processor and memory node subsets
lscpu (1) - display information about the CPU architecture
msr (4) - x86 CPU MSR access device
sched (7) - overview of CPU scheduling
taskset (1) - set or retrieve a process's CPU affinity

Here you go! You can see that it listed the lscpu command that we have used earlier. The apropos command is here to rescue you whenever you forget a command or you're unsure which command to use. You just have to supply a keyword (preferably a verb) that highlights what you want to accomplish to the apropos command:

apropos keyword

COOL TIP

The man -k command will display the same result as the apropos command.

elliot@ubuntu-linux:~$ man -k cpu 
chcpu (8) - configure CPUs
cpuid (4) - x86 CPUID access device
cpuset (7) - confine processes to processor and memory node subsets
lscpu (1) - display information about the CPU architecture
msr (4) - x86 CPU MSR access device
sched (7) - overview of CPU scheduling
taskset (1) - set or retrieve a process's CPU affinity
主站蜘蛛池模板: 科尔| 攀枝花市| 成武县| 安丘市| 改则县| 连山| 周口市| 泸定县| 朝阳区| 梁山县| 永兴县| 泸溪县| 河南省| 萨迦县| 达尔| 宜君县| 仲巴县| 磐石市| 兴和县| 共和县| 家居| 永靖县| 五指山市| 资兴市| 泗阳县| 古浪县| 峨眉山市| 赫章县| 新昌县| 花莲县| 定州市| 鄂托克旗| 涪陵区| 兴化市| 桑日县| 石景山区| 花垣县| 土默特右旗| 即墨市| 乌海市| 招远市|