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

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
主站蜘蛛池模板: 重庆市| 德钦县| 寻乌县| 拜泉县| 忻城县| 东山县| 顺平县| 庆元县| 囊谦县| 绩溪县| 迭部县| 南汇区| 古田县| 治县。| 临泽县| 湖口县| 阜南县| 漳平市| 泗阳县| 嘉禾县| 高唐县| 武穴市| 海丰县| 旌德县| 济阳县| 尉氏县| 阳高县| 格尔木市| 原阳县| 错那县| 阿坝县| 汝南县| 嵊泗县| 西宁市| 惠东县| 柘城县| 藁城市| 永善县| 红安县| 清苑县| 全州县|