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

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
主站蜘蛛池模板: 中方县| 宿州市| 慈溪市| 淮北市| 双流县| 炎陵县| 房产| 永宁县| 新泰市| 象州县| 营山县| 大名县| 常德市| 聂拉木县| 通山县| 万山特区| 泸定县| 岑巩县| 江华| 本溪| 洮南市| 双牌县| 大竹县| 佛学| 灵宝市| 横山县| 云霄县| 荆州市| 南康市| 巢湖市| 宣汉县| 象州县| 铜川市| 阜新市| 福州市| 台湾省| 会宁县| 米脂县| 竹北市| 杨浦区| 大渡口区|