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

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
主站蜘蛛池模板: 鲁甸县| 射阳县| 大庆市| 永春县| 东宁县| 米泉市| 静宁县| 贵南县| 方山县| 会泽县| 襄城县| 乡城县| 元江| 隆林| 溧阳市| 宁强县| 临猗县| 浦县| 朝阳区| 宁安市| 靖江市| 常熟市| 闽清县| 金湖县| 宁阳县| 来凤县| 湖北省| 巫溪县| 黔西| 抚顺市| 万安县| 库尔勒市| 乌鲁木齐县| 林甸县| 吉林市| 怀宁县| 冀州市| 麦盖提县| 泉州市| 北安市| 陵水|